added explicit tests for overlay commands

Signed-off-by: Christian Goll <cgoll@suse.com>
This commit is contained in:
Christian Goll
2023-11-06 17:04:59 +01:00
committed by Jonathon Anderson
parent 7f502c1f8a
commit 5d25b3a4a6
5 changed files with 154 additions and 10 deletions

View File

@@ -119,6 +119,18 @@ func (env *TestEnv) WriteFile(t *testing.T, fileName string, content string) {
assert.NoError(t, err)
}
// WriteFileAbs uses an absloute path in opposite to WriteFile
func (env *TestEnv) WriteFileAbs(t *testing.T, fileName string, content string) {
dirName := filepath.Dir(fileName)
err := os.MkdirAll(dirName, 0755)
assert.NoError(t, err)
f, err := os.Create(fileName)
assert.NoError(t, err)
defer f.Close()
_, err = f.WriteString(content)
assert.NoError(t, err)
}
// ReadFile returns the content of fileName as converted to a
// string.
//