From cc6b253adf94d3dc4376f8d6dbb7f83065767999 Mon Sep 17 00:00:00 2001 From: Kit Patella Date: Mon, 30 Sep 2024 11:14:41 -0700 Subject: [PATCH] chore: ensure NoError e2e.CleanFiles and pass thru testing.T Signed-off-by: Kit Patella --- src/test/common.go | 7 ++----- src/test/e2e/00_use_cli_test.go | 10 +++++----- src/test/e2e/01_component_choice_test.go | 2 +- src/test/e2e/02_component_actions_test.go | 10 +++++----- src/test/e2e/03_deprecations_test.go | 12 ++++++------ src/test/e2e/04_create_templating_test.go | 2 +- src/test/e2e/05_tarball_test.go | 8 ++++---- src/test/e2e/06_create_sbom_test.go | 4 ++-- src/test/e2e/07_create_git_test.go | 2 +- src/test/e2e/08_create_differential_test.go | 4 ++-- src/test/e2e/11_oci_pull_inspect_test.go | 2 +- src/test/e2e/20_zarf_init_test.go | 2 +- src/test/e2e/22_git_and_gitops_test.go | 2 +- src/test/e2e/24_variables_test.go | 4 ++-- src/test/e2e/25_helm_test.go | 2 +- src/test/e2e/29_config_file_test.go | 4 ++-- src/test/e2e/30_component_action_cluster_test.go | 2 +- src/test/e2e/31_checksum_and_signature_test.go | 2 +- src/test/e2e/32_component_webhooks_test.go | 2 +- src/test/e2e/33_manifest_with_symlink_test.go | 4 ++-- src/test/e2e/34_custom_init_package_test.go | 2 +- src/test/e2e/50_oci_publish_deploy_test.go | 4 ++-- src/test/nightly/ecr_publish_test.go | 2 +- 23 files changed, 46 insertions(+), 49 deletions(-) diff --git a/src/test/common.go b/src/test/common.go index dbeae330ff..4201fea6b9 100644 --- a/src/test/common.go +++ b/src/test/common.go @@ -8,7 +8,6 @@ import ( "bufio" "errors" "fmt" - "log/slog" "os" "regexp" "runtime" @@ -95,12 +94,10 @@ func (e2e *ZarfE2ETest) Kubectl(t *testing.T, args ...string) (string, string, e } // CleanFiles removes files and directories that have been created during the test. -func (e2e *ZarfE2ETest) CleanFiles(files ...string) { +func (e2e *ZarfE2ETest) CleanFiles(t *testing.T, files ...string) { for _, file := range files { err := os.RemoveAll(file) - if err != nil { - slog.Debug("Unable to cleanup files", "files", files, "error", err) - } + require.NoError(t, err) } } diff --git a/src/test/e2e/00_use_cli_test.go b/src/test/e2e/00_use_cli_test.go index d834445367..e5bc25cb4d 100644 --- a/src/test/e2e/00_use_cli_test.go +++ b/src/test/e2e/00_use_cli_test.go @@ -27,9 +27,9 @@ func TestUseCLI(t *testing.T) { expectedShasum := "61b50898f982d015ed87093ba822de0fe011cec6dd67db39f99d8c56391a6109\n" shasumTestFilePath := "shasum-test-file" - e2e.CleanFiles(shasumTestFilePath) + e2e.CleanFiles(t, shasumTestFilePath) t.Cleanup(func() { - e2e.CleanFiles(shasumTestFilePath) + e2e.CleanFiles(t, shasumTestFilePath) }) err := os.WriteFile(shasumTestFilePath, []byte("random test data 🦄\n"), helpers.ReadWriteUser) @@ -139,7 +139,7 @@ func TestUseCLI(t *testing.T) { require.FileExists(t, "binaries/eksctl_Darwin_arm64") require.FileExists(t, "binaries/eksctl_Linux_x86_64") - e2e.CleanFiles("binaries/eksctl_Darwin_x86_64", "binaries/eksctl_Darwin_arm64", "binaries/eksctl_Linux_x86_64", path, "eks.yaml") + e2e.CleanFiles(t, "binaries/eksctl_Darwin_x86_64", "binaries/eksctl_Darwin_arm64", "binaries/eksctl_Linux_x86_64", path, "eks.yaml") }) t.Run("zarf package create with tmpdir and cache", func(t *testing.T) { @@ -165,7 +165,7 @@ func TestUseCLI(t *testing.T) { secondFile = "second-choice-file.txt" ) t.Cleanup(func() { - e2e.CleanFiles(firstFile, secondFile) + e2e.CleanFiles(t, firstFile, secondFile) }) path := fmt.Sprintf("build/zarf-package-component-choice-%s.tar.zst", e2e.Arch) stdOut, stdErr, err := e2e.Zarf(t, "package", "deploy", path, "--tmpdir", tmpdir, "--log-level=debug", "--confirm") @@ -198,7 +198,7 @@ func TestUseCLI(t *testing.T) { tlsCert := "tls.crt" tlsKey := "tls.key" t.Cleanup(func() { - e2e.CleanFiles(tlsCA, tlsCert, tlsKey) + e2e.CleanFiles(t, tlsCA, tlsCert, tlsKey) }) stdOut, stdErr, err := e2e.Zarf(t, "tools", "gen-pki", "github.com", "--sub-alt-name", "google.com") require.NoError(t, err, stdOut, stdErr) diff --git a/src/test/e2e/01_component_choice_test.go b/src/test/e2e/01_component_choice_test.go index 8668586956..b16efcb3e8 100644 --- a/src/test/e2e/01_component_choice_test.go +++ b/src/test/e2e/01_component_choice_test.go @@ -19,7 +19,7 @@ func TestComponentChoice(t *testing.T) { secondFile = "second-choice-file.txt" ) t.Cleanup(func() { - e2e.CleanFiles(firstFile, secondFile) + e2e.CleanFiles(t, firstFile, secondFile) }) path := fmt.Sprintf("build/zarf-package-component-choice-%s.tar.zst", e2e.Arch) diff --git a/src/test/e2e/02_component_actions_test.go b/src/test/e2e/02_component_actions_test.go index 8ef710ee90..47804677f2 100644 --- a/src/test/e2e/02_component_actions_test.go +++ b/src/test/e2e/02_component_actions_test.go @@ -26,8 +26,8 @@ func TestComponentActions(t *testing.T) { } allArtifacts := append(deployArtifacts, createArtifacts...) - e2e.CleanFiles(allArtifacts...) - defer e2e.CleanFiles(allArtifacts...) + e2e.CleanFiles(t, allArtifacts...) + defer e2e.CleanFiles(t, allArtifacts...) /* Create */ // Try creating the package to test the onCreate actions. @@ -111,7 +111,7 @@ func TestComponentActions(t *testing.T) { require.FileExists(t, deployWithEnvVarArtifact) // Remove the env var file at the end of the test - e2e.CleanFiles(deployWithEnvVarArtifact) + e2e.CleanFiles(t, deployWithEnvVarArtifact) }) t.Run("action on-deploy-with-template", func(t *testing.T) { @@ -128,7 +128,7 @@ func TestComponentActions(t *testing.T) { require.Contains(t, string(outTemplated), "The snake says ###ZARF_VAR_SNAKE_SOUND###") // Remove the templated file so we can test with dynamic variables - e2e.CleanFiles(deployTemplatedArtifact) + e2e.CleanFiles(t, deployTemplatedArtifact) // Test using a templated file with dynamic variables stdOut, stdErr, err = e2e.Zarf(t, "package", "deploy", path, "--components=on-deploy-with-template-use-of-variable,on-deploy-with-dynamic-variable,on-deploy-with-multiple-variables", "--confirm") @@ -140,7 +140,7 @@ func TestComponentActions(t *testing.T) { require.Contains(t, string(outTemplated), "The snake says hiss") // Remove the templated file at the end of the test - e2e.CleanFiles(deployTemplatedArtifact) + e2e.CleanFiles(t, deployTemplatedArtifact) }) t.Run("action on-deploy-immediate-failure", func(t *testing.T) { diff --git a/src/test/e2e/03_deprecations_test.go b/src/test/e2e/03_deprecations_test.go index 0414a3915e..27fcc4a59a 100644 --- a/src/test/e2e/03_deprecations_test.go +++ b/src/test/e2e/03_deprecations_test.go @@ -24,14 +24,14 @@ func TestDeprecatedComponentScripts(t *testing.T) { "test-deprecated-deploy-after-hook.txt", } allArtifacts := append(deployArtifacts, prepareArtifact) - e2e.CleanFiles(allArtifacts...) - defer e2e.CleanFiles(allArtifacts...) + e2e.CleanFiles(t, allArtifacts...) + defer e2e.CleanFiles(t, allArtifacts...) // 1. Try creating the package to test the create scripts testPackagePath := fmt.Sprintf("%s/zarf-package-deprecated-component-scripts-%s.tar.zst", testPackageDirPath, e2e.Arch) outputFlag := fmt.Sprintf("-o=%s", testPackageDirPath) stdOut, stdErr, err := e2e.Zarf(t, "package", "create", testPackageDirPath, outputFlag, "--confirm") - defer e2e.CleanFiles(testPackagePath) + defer e2e.CleanFiles(t, testPackagePath) require.NoError(t, err, stdOut, stdErr) require.Contains(t, stdErr, "Component '1-test-deprecated-prepare-scripts' is using scripts") require.Contains(t, stdErr, "Component '2-test-deprecated-deploy-scripts' is using scripts") @@ -71,8 +71,8 @@ func TestDeprecatedSetAndPackageVariables(t *testing.T) { "test-deprecated-deploy-after-hook.txt", } allArtifacts := append(deployArtifacts, prepareArtifact) - e2e.CleanFiles(allArtifacts...) - defer e2e.CleanFiles(allArtifacts...) + e2e.CleanFiles(t, allArtifacts...) + defer e2e.CleanFiles(t, allArtifacts...) // 2. Try creating the package to test the create scripts testPackagePath := fmt.Sprintf("%s/zarf-package-deprecated-set-variable-%s.tar.zst", testPackageDirPath, e2e.Arch) @@ -85,7 +85,7 @@ func TestDeprecatedSetAndPackageVariables(t *testing.T) { // Check that the command displays a warning on create stdOut, stdErr, err = e2e.Zarf(t, "package", "create", testPackageDirPath, outputFlag, "--confirm", "--set", "ECHO=Zarf-The-Axolotl") - defer e2e.CleanFiles(testPackagePath) + defer e2e.CleanFiles(t, testPackagePath) require.NoError(t, err, stdOut, stdErr) require.Contains(t, stdErr, "Component '1-test-deprecated-set-variable' is using setVariable") require.Contains(t, stdErr, "deprecated syntax ###ZARF_PKG_VAR_ECHO###") diff --git a/src/test/e2e/04_create_templating_test.go b/src/test/e2e/04_create_templating_test.go index a93f23027d..fb03553553 100644 --- a/src/test/e2e/04_create_templating_test.go +++ b/src/test/e2e/04_create_templating_test.go @@ -65,5 +65,5 @@ func TestCreateTemplating(t *testing.T) { require.NoError(t, err) require.Contains(t, string(filesJSON), "pandas") - e2e.CleanFiles(pkgName, fileFoldersPkgName) + e2e.CleanFiles(t, pkgName, fileFoldersPkgName) } diff --git a/src/test/e2e/05_tarball_test.go b/src/test/e2e/05_tarball_test.go index d1646899cf..5ab956c5a0 100644 --- a/src/test/e2e/05_tarball_test.go +++ b/src/test/e2e/05_tarball_test.go @@ -28,7 +28,7 @@ func TestMultiPartPackage(t *testing.T) { outputFile = "multi-part-demo.dat" ) - e2e.CleanFiles(deployPath, outputFile) + e2e.CleanFiles(t, deployPath, outputFile) // Create the package with a max size of 20MB stdOut, stdErr, err := e2e.Zarf(t, "package", "create", createPath, "--max-package-size=20", "--confirm") @@ -73,8 +73,8 @@ func TestMultiPartPackage(t *testing.T) { err = helpers.SHAsMatch(parts[0], pkgData.Sha256Sum) require.NoError(t, err) - e2e.CleanFiles(parts...) - e2e.CleanFiles(outputFile) + e2e.CleanFiles(t, parts...) + e2e.CleanFiles(t, outputFile) } func TestReproducibleTarballs(t *testing.T) { @@ -98,7 +98,7 @@ func TestReproducibleTarballs(t *testing.T) { err = utils.ReadYaml(filepath.Join(unpack1, layout.ZarfYAML), &pkg1) require.NoError(t, err) - e2e.CleanFiles(unpack1, tb) + e2e.CleanFiles(t, unpack1, tb) stdOut, stdErr, err = e2e.Zarf(t, "package", "create", createPath, "--confirm", "--output", tmp) require.NoError(t, err, stdOut, stdErr) diff --git a/src/test/e2e/06_create_sbom_test.go b/src/test/e2e/06_create_sbom_test.go index a3ee3b4118..0254c56e25 100644 --- a/src/test/e2e/06_create_sbom_test.go +++ b/src/test/e2e/06_create_sbom_test.go @@ -29,7 +29,7 @@ func TestCreateSBOM(t *testing.T) { require.FileExists(t, filepath.Join(sbomPath, "dos-games", "ghcr.io_zarf-dev_doom-game_0.0.1.json")) // Clean the SBOM path so it is force to be recreated - e2e.CleanFiles(sbomPath) + e2e.CleanFiles(t, sbomPath) stdOut, stdErr, err = e2e.Zarf(t, "package", "inspect", pkgName, "--sbom-out", sbomPath) require.NoError(t, err, stdOut, stdErr) @@ -68,5 +68,5 @@ func TestCreateSBOM(t *testing.T) { _, err = os.ReadFile(filepath.Join(sbomPath, "init", "compare.html")) require.NoError(t, err) - e2e.CleanFiles(pkgName) + e2e.CleanFiles(t, pkgName) } diff --git a/src/test/e2e/07_create_git_test.go b/src/test/e2e/07_create_git_test.go index 7a08043c1f..7ec0302e20 100644 --- a/src/test/e2e/07_create_git_test.go +++ b/src/test/e2e/07_create_git_test.go @@ -23,7 +23,7 @@ func TestCreateGit(t *testing.T) { path := fmt.Sprintf("build/zarf-package-git-data-%s-0.0.1.tar.zst", e2e.Arch) stdOut, stdErr, err := e2e.Zarf(t, "tools", "archiver", "decompress", path, extractDir, "--unarchive-all") require.NoError(t, err, stdOut, stdErr) - defer e2e.CleanFiles(extractDir) + defer e2e.CleanFiles(t, extractDir) // Verify the full-repo component gitDir := fmt.Sprintf("%s/components/full-repo/repos/zarf-public-test-2395699829/.git", extractDir) diff --git a/src/test/e2e/08_create_differential_test.go b/src/test/e2e/08_create_differential_test.go index 59e298c22d..35be26761f 100644 --- a/src/test/e2e/08_create_differential_test.go +++ b/src/test/e2e/08_create_differential_test.go @@ -30,7 +30,7 @@ func TestCreateDifferential(t *testing.T) { // Build the package a first time stdOut, stdErr, err := e2e.Zarf(t, "package", "create", packagePath, "--set=PACKAGE_VERSION=v0.25.0", "--confirm") require.NoError(t, err, stdOut, stdErr) - defer e2e.CleanFiles(packageName) + defer e2e.CleanFiles(t, packageName) // Build the differential package without changing the version _, stdErr, err = e2e.Zarf(t, "package", "create", packagePath, "--set=PACKAGE_VERSION=v0.25.0", differentialFlag, "--confirm") @@ -40,7 +40,7 @@ func TestCreateDifferential(t *testing.T) { // Build the differential package stdOut, stdErr, err = e2e.Zarf(t, "package", "create", packagePath, "--set=PACKAGE_VERSION=v0.26.0", differentialFlag, "--confirm") require.NoError(t, err, stdOut, stdErr) - defer e2e.CleanFiles(differentialPackageName) + defer e2e.CleanFiles(t, differentialPackageName) // Extract the yaml of the differential package err = archiver.Extract(differentialPackageName, layout.ZarfYAML, tmpdir) diff --git a/src/test/e2e/11_oci_pull_inspect_test.go b/src/test/e2e/11_oci_pull_inspect_test.go index b7d52fecec..356c5be99a 100644 --- a/src/test/e2e/11_oci_pull_inspect_test.go +++ b/src/test/e2e/11_oci_pull_inspect_test.go @@ -33,7 +33,7 @@ func (suite *PullInspectTestSuite) SetupSuite() { func (suite *PullInspectTestSuite) TearDownSuite() { local := fmt.Sprintf("zarf-package-dos-games-%s-1.0.0.tar.zst", e2e.Arch) - e2e.CleanFiles(local) + e2e.CleanFiles(suite.T(), local) } func (suite *PullInspectTestSuite) Test_0_Pull() { diff --git a/src/test/e2e/20_zarf_init_test.go b/src/test/e2e/20_zarf_init_test.go index 55b985225c..de981f9b13 100644 --- a/src/test/e2e/20_zarf_init_test.go +++ b/src/test/e2e/20_zarf_init_test.go @@ -32,7 +32,7 @@ func TestZarfInit(t *testing.T) { expectedErrorMessage = "unable to run component before action: command \"Check that the host architecture matches the package architecture\"" ) t.Cleanup(func() { - e2e.CleanFiles(mismatchedInitPackage) + e2e.CleanFiles(t, mismatchedInitPackage) }) if runtime.GOOS == "linux" { diff --git a/src/test/e2e/22_git_and_gitops_test.go b/src/test/e2e/22_git_and_gitops_test.go index 901137125b..90eb715259 100644 --- a/src/test/e2e/22_git_and_gitops_test.go +++ b/src/test/e2e/22_git_and_gitops_test.go @@ -27,7 +27,7 @@ func TestGit(t *testing.T) { require.NoError(t, err, stdOut, stdErr) path := fmt.Sprintf("build/zarf-package-git-data-test-%s-1.0.0.tar.zst", e2e.Arch) - defer e2e.CleanFiles(path) + defer e2e.CleanFiles(t, path) // Deploy the git data example (with component globbing to test that as well) stdOut, stdErr, err = e2e.Zarf(t, "package", "deploy", path, "--components=full-repo,specific-*", "--confirm") diff --git a/src/test/e2e/24_variables_test.go b/src/test/e2e/24_variables_test.go index aa16771d53..b583a314d4 100644 --- a/src/test/e2e/24_variables_test.go +++ b/src/test/e2e/24_variables_test.go @@ -24,7 +24,7 @@ func TestVariables(t *testing.T) { tfPath := "modified-terraform.tf" - e2e.CleanFiles(tfPath, evilPath) + e2e.CleanFiles(t, tfPath, evilPath) // Test that specifying an invalid setVariable value results in an error stdOut, stdErr, err := e2e.Zarf(t, "package", "create", evilSrc, "--set", "NUMB3R5=K1TT3H", "--confirm") @@ -93,5 +93,5 @@ func TestVariables(t *testing.T) { stdOut, stdErr, err = e2e.Zarf(t, "package", "remove", path, "--confirm") require.NoError(t, err, stdOut, stdErr) - e2e.CleanFiles(tfPath, evilPath) + e2e.CleanFiles(t, tfPath, evilPath) } diff --git a/src/test/e2e/25_helm_test.go b/src/test/e2e/25_helm_test.go index 8589f8156f..421b62ed0a 100644 --- a/src/test/e2e/25_helm_test.go +++ b/src/test/e2e/25_helm_test.go @@ -38,7 +38,7 @@ func testHelmChartsExample(t *testing.T) { localTgzChartPath := filepath.Join("src", "test", "packages", "25-local-tgz-chart") stdOut, stdErr, err := e2e.Zarf(t, "package", "create", localTgzChartPath, "--tmpdir", tmpdir, "--confirm") require.NoError(t, err, stdOut, stdErr) - defer e2e.CleanFiles(fmt.Sprintf("zarf-package-helm-charts-local-tgz-%s-0.0.1.tar.zst", e2e.Arch)) + defer e2e.CleanFiles(t, fmt.Sprintf("zarf-package-helm-charts-local-tgz-%s-0.0.1.tar.zst", e2e.Arch)) // Create a package that needs dependencies evilChartDepsPath := filepath.Join("src", "test", "packages", "25-evil-chart-deps") diff --git a/src/test/e2e/29_config_file_test.go b/src/test/e2e/29_config_file_test.go index 62b80a50bd..01e38fd885 100644 --- a/src/test/e2e/29_config_file_test.go +++ b/src/test/e2e/29_config_file_test.go @@ -23,7 +23,7 @@ func TestConfigFile(t *testing.T) { envKey = "ZARF_CONFIG" ) - e2e.CleanFiles(path) + e2e.CleanFiles(t, path) // Test the config file environment variable t.Setenv(envKey, filepath.Join(dir, config)) @@ -38,7 +38,7 @@ func TestConfigFile(t *testing.T) { require.NoError(t, err, stdOut, stdErr) // Cleanup - e2e.CleanFiles(path) + e2e.CleanFiles(t, path) } func configFileTests(t *testing.T, dir, path string) { diff --git a/src/test/e2e/30_component_action_cluster_test.go b/src/test/e2e/30_component_action_cluster_test.go index 6763a042dc..16ead6ef8d 100644 --- a/src/test/e2e/30_component_action_cluster_test.go +++ b/src/test/e2e/30_component_action_cluster_test.go @@ -36,7 +36,7 @@ func TestComponentActionEdgeCases(t *testing.T) { stdOut, stdErr, err := e2e.Zarf(t, "package", "create", sourcePath, "--confirm") require.NoError(t, err, stdOut, stdErr) - defer e2e.CleanFiles(packagePath) + defer e2e.CleanFiles(t, packagePath) stdOut, stdErr, err = e2e.Zarf(t, "package", "deploy", packagePath, "--confirm") require.NoError(t, err, stdOut, stdErr) diff --git a/src/test/e2e/31_checksum_and_signature_test.go b/src/test/e2e/31_checksum_and_signature_test.go index 5e60466b91..c6897c8cee 100644 --- a/src/test/e2e/31_checksum_and_signature_test.go +++ b/src/test/e2e/31_checksum_and_signature_test.go @@ -21,7 +21,7 @@ func TestChecksumAndSignature(t *testing.T) { stdOut, stdErr, err := e2e.Zarf(t, "package", "create", testPackageDirPath, privateKeyFlag, "--confirm") require.NoError(t, err, stdOut, stdErr) - defer e2e.CleanFiles(pkgName) + defer e2e.CleanFiles(t, pkgName) // Test that we don't get an error when we remember to provide the public key stdOut, stdErr, err = e2e.Zarf(t, "package", "inspect", pkgName, publicKeyFlag) diff --git a/src/test/e2e/32_component_webhooks_test.go b/src/test/e2e/32_component_webhooks_test.go index 18c9ed33cc..936d9b7e54 100644 --- a/src/test/e2e/32_component_webhooks_test.go +++ b/src/test/e2e/32_component_webhooks_test.go @@ -20,7 +20,7 @@ func TestComponentWebhooks(t *testing.T) { require.NoError(t, err, stdOut, stdErr) stdOut, stdErr, err = e2e.Zarf(t, "tools", "wait-for", "deployment", "pepr-cb5693ef-d13c-5fe1-b5ad-c870fd911b3b", "available", "-n=pepr-system") require.NoError(t, err, stdOut, stdErr) - defer e2e.CleanFiles(webhookPath) + defer e2e.CleanFiles(t, webhookPath) // Ensure package deployments wait for webhooks to complete. gamesPath := fmt.Sprintf("build/zarf-package-dos-games-%s-1.1.0.tar.zst", e2e.Arch) diff --git a/src/test/e2e/33_manifest_with_symlink_test.go b/src/test/e2e/33_manifest_with_symlink_test.go index 9748154dc7..441915581a 100644 --- a/src/test/e2e/33_manifest_with_symlink_test.go +++ b/src/test/e2e/33_manifest_with_symlink_test.go @@ -22,10 +22,10 @@ func TestManifestWithSymlink(t *testing.T) { path := fmt.Sprintf("build/zarf-package-manifest-with-symlink-%s-0.0.1.tar.zst", e2e.Arch) require.FileExists(t, path) - defer e2e.CleanFiles(path) + defer e2e.CleanFiles(t, path) stdOut, stdErr, err = e2e.Zarf(t, "package", "deploy", path, "--confirm") - defer e2e.CleanFiles("temp/manifests") + defer e2e.CleanFiles(t, "temp/manifests") require.NoError(t, err, stdOut, stdErr) require.FileExists(t, "temp/manifests/resources/img", "Symlink does not exist in the package as expected.") } diff --git a/src/test/e2e/34_custom_init_package_test.go b/src/test/e2e/34_custom_init_package_test.go index e3dbeeeeef..b49935e87e 100644 --- a/src/test/e2e/34_custom_init_package_test.go +++ b/src/test/e2e/34_custom_init_package_test.go @@ -22,7 +22,7 @@ func TestCustomInit(t *testing.T) { stdOut, stdErr, err := e2e.Zarf(t, "package", "create", buildPath, privateKeyFlag, "--confirm") require.NoError(t, err, stdOut, stdErr) - defer e2e.CleanFiles(pkgName) + defer e2e.CleanFiles(t, pkgName) /* Test operations during package inspect */ // Test that we can inspect the yaml of the package without the private key diff --git a/src/test/e2e/50_oci_publish_deploy_test.go b/src/test/e2e/50_oci_publish_deploy_test.go index 88ea94fcf0..4c2e250551 100644 --- a/src/test/e2e/50_oci_publish_deploy_test.go +++ b/src/test/e2e/50_oci_publish_deploy_test.go @@ -37,7 +37,7 @@ func (suite *PublishDeploySuiteTestSuite) SetupSuite() { func (suite *PublishDeploySuiteTestSuite) TearDownSuite() { local := fmt.Sprintf("zarf-package-helm-charts-%s-0.0.1.tar.zst", e2e.Arch) - e2e.CleanFiles(local) + e2e.CleanFiles(suite.Suite.T(), local) } func (suite *PublishDeploySuiteTestSuite) Test_0_Publish() { @@ -103,7 +103,7 @@ func (suite *PublishDeploySuiteTestSuite) Test_2_Pull_And_Deploy() { suite.T().Log("E2E: Package Pull oci:// && Package Deploy tarball") local := fmt.Sprintf("zarf-package-helm-charts-%s-0.0.1.tar.zst", e2e.Arch) - defer e2e.CleanFiles(local) + defer e2e.CleanFiles(suite.T(), local) // Verify the package was pulled. suite.FileExists(local) diff --git a/src/test/nightly/ecr_publish_test.go b/src/test/nightly/ecr_publish_test.go index 3cf5876960..817ee10050 100644 --- a/src/test/nightly/ecr_publish_test.go +++ b/src/test/nightly/ecr_publish_test.go @@ -66,7 +66,7 @@ func TestECRPublishing(t *testing.T) { // Validate that we can pull the package down from ECR stdOut, stdErr, err = e2e.Zarf(t, "package", "pull", upstreamPackageURL) require.NoError(t, err, stdOut, stdErr) - defer e2e.CleanFiles(testPackageFileName) + defer e2e.CleanFiles(t, testPackageFileName) // Ensure we get a warning when trying to inspect the package without providing the public key // and the insecure flag