Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correctly cleanup temp directory test #654

Merged
merged 1 commit into from
Aug 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/test/e2e/01_component_choice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,16 @@ func TestComponentChoice(t *testing.T) {
require.NoError(t, err, stdOut, stdErr)

// Verify the file was created
expectedFile := firstFile
require.FileExists(t, expectedFile)
require.FileExists(t, firstFile)
// Verify the second choice file was not created
expectedFile = secondFile
require.NoFileExists(t, expectedFile)
require.NoFileExists(t, secondFile)

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

// Verify the file was created
expectedFile = secondFile
require.FileExists(t, expectedFile)
require.FileExists(t, secondFile)

e2e.cleanFiles(firstFile, secondFile)
}
10 changes: 7 additions & 3 deletions src/test/e2e/03_temp_directory_deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ func TestTempDirectoryDeploy(t *testing.T) {
t.Log("E2E: Temporary directory deploy")

// run `zarf package deploy` with a specified tmp location
otherTmpPath := "/tmp/othertmp"
var (
otherTmpPath = "/tmp/othertmp"
firstFile = "first-choice-file.txt"
secondFile = "second-choice-file.txt"
)

e2e.setup(t)
defer e2e.teardown(t)

e2e.cleanFiles(otherTmpPath)
e2e.cleanFiles(otherTmpPath, firstFile, secondFile)

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

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

e2e.cleanFiles(otherTmpPath)
e2e.cleanFiles(otherTmpPath, firstFile, secondFile)
}