no panic if listing non existing container image

Signed-off-by: Christian Goll <cgoll@suse.com>
This commit is contained in:
Christian Goll
2024-09-16 12:10:51 +02:00
committed by Jonathon Anderson
parent c0c93b153a
commit 883de9c4fc
6 changed files with 66 additions and 65 deletions

View File

@@ -10,6 +10,7 @@ import (
"path"
"path/filepath"
"testing"
"time"
warewulfconf "github.com/warewulf/warewulf/internal/pkg/config"
@@ -131,6 +132,10 @@ func (env *TestEnv) WriteFile(t *testing.T, fileName string, content string) {
defer f.Close()
_, err = f.WriteString(content)
assert.NoError(t, err)
err = os.Chtimes(env.GetPath(fileName),
time.Date(2006, time.February, 1, 3, 4, 5, 0, time.UTC),
time.Date(2006, time.February, 1, 3, 4, 5, 0, time.UTC))
assert.NoError(t, err)
}
// ReadFile returns the content of fileName as converted to a