Remove testenv.WriteFileAbs
Writing absolute file names in testenv breaks safety that files in the test environment are written to the designated temporary path. Adjusted the relevant tests to use testenv.WriteFile. Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
warewulfconf "github.com/hpcng/warewulf/internal/pkg/config"
|
||||
"github.com/hpcng/warewulf/internal/pkg/wwlog"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
@@ -15,8 +14,7 @@ import (
|
||||
|
||||
func Test_Overlay_List(t *testing.T) {
|
||||
env := testenv.New(t)
|
||||
wwconf := warewulfconf.Get()
|
||||
env.WriteFileAbs(t, path.Join(wwconf.Paths.WWOverlaydir, "testoverlay/email.ww"), `
|
||||
env.WriteFile(t, path.Join(testenv.WWOverlaydir, "testoverlay/email.ww"), `
|
||||
{{ if .Tags.email }}eMail: {{ .Tags.email }}{{else}} noMail{{- end }}
|
||||
`)
|
||||
defer env.RemoveAll(t)
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
warewulfconf "github.com/hpcng/warewulf/internal/pkg/config"
|
||||
"github.com/hpcng/warewulf/internal/pkg/wwlog"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
@@ -21,7 +20,6 @@ var (
|
||||
|
||||
func Test_Overlay_List(t *testing.T) {
|
||||
env := testenv.New(t)
|
||||
wwconf := warewulfconf.Get()
|
||||
env.WriteFile(t, "etc/warewulf/nodes.conf",
|
||||
`WW_INTERNAL: 43
|
||||
nodeprofiles:
|
||||
@@ -39,7 +37,7 @@ nodes:
|
||||
- empty
|
||||
`)
|
||||
|
||||
env.WriteFileAbs(t, path.Join(wwconf.Paths.WWOverlaydir, "testoverlay/email.ww"), overlayCont)
|
||||
env.WriteFile(t, path.Join(testenv.WWOverlaydir, "testoverlay/email.ww"), overlayCont)
|
||||
defer env.RemoveAll(t)
|
||||
warewulfd.SetNoDaemon()
|
||||
t.Run("overlay show raw", func(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user