Skip to content

Commit 1f353c5

Browse files
authored
Correctly cleanup temp directory test (zarf-dev#654)
1 parent 59ded9e commit 1f353c5

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/test/e2e/01_component_choice_test.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,16 @@ func TestComponentChoice(t *testing.T) {
3131
require.NoError(t, err, stdOut, stdErr)
3232

3333
// Verify the file was created
34-
expectedFile := firstFile
35-
require.FileExists(t, expectedFile)
34+
require.FileExists(t, firstFile)
3635
// Verify the second choice file was not created
37-
expectedFile = secondFile
38-
require.NoFileExists(t, expectedFile)
36+
require.NoFileExists(t, secondFile)
3937

4038
// Deploy using default choice
4139
stdOut, stdErr, err = e2e.execZarfCommand("package", "deploy", path, "--confirm")
4240
require.NoError(t, err, stdOut, stdErr)
4341

4442
// Verify the file was created
45-
expectedFile = secondFile
46-
require.FileExists(t, expectedFile)
43+
require.FileExists(t, secondFile)
4744

4845
e2e.cleanFiles(firstFile, secondFile)
4946
}

src/test/e2e/03_temp_directory_deploy_test.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ func TestTempDirectoryDeploy(t *testing.T) {
1212
t.Log("E2E: Temporary directory deploy")
1313

1414
// run `zarf package deploy` with a specified tmp location
15-
otherTmpPath := "/tmp/othertmp"
15+
var (
16+
otherTmpPath = "/tmp/othertmp"
17+
firstFile = "first-choice-file.txt"
18+
secondFile = "second-choice-file.txt"
19+
)
1620

1721
e2e.setup(t)
1822
defer e2e.teardown(t)
1923

20-
e2e.cleanFiles(otherTmpPath)
24+
e2e.cleanFiles(otherTmpPath, firstFile, secondFile)
2125

2226
path := fmt.Sprintf("build/zarf-package-component-choice-%s.tar.zst", e2e.arch)
2327

@@ -27,5 +31,5 @@ func TestTempDirectoryDeploy(t *testing.T) {
2731
require.Contains(t, stdErr, otherTmpPath, "The other tmp path should show as being created")
2832
require.NoError(t, err, stdOut, stdErr)
2933

30-
e2e.cleanFiles(otherTmpPath)
34+
e2e.cleanFiles(otherTmpPath, firstFile, secondFile)
3135
}

0 commit comments

Comments
 (0)