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

chore: cleanup errchecking in tests #3040

Merged
merged 37 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
8c16eda
add errcheck linting
mkcp Sep 11, 2024
430467e
linter ignore some intentionally unhandled errs
mkcp Sep 12, 2024
2e093b1
handle some env var set and unset errors in tests
mkcp Sep 12, 2024
0e9405e
make some notes in cmd/destroy.go for later
mkcp Sep 12, 2024
5ad8530
direct handle some deferred cleanups to add direct error handling
mkcp Sep 12, 2024
23663e4
capture errors from cmd/root
mkcp Sep 13, 2024
7645357
capture errors on src/config/config.go. checking ci
mkcp Sep 13, 2024
4b5c794
fix: ensure we capture and propagate errors in src/internal
mkcp Sep 25, 2024
849680d
fix: propagate or log unhandled errors in src/cmd
mkcp Sep 25, 2024
433aacd
fix: check for or intentionally ignore some dangling errors in tests
mkcp Sep 25, 2024
b579634
fix: use RemoveAll not remove so it doesnt error every time
mkcp Sep 25, 2024
7b418d6
fix: disabling the err catch to see if it's something i changed
mkcp Sep 25, 2024
e8e4ee9
fix: should fix the directory not empty panic
mkcp Sep 25, 2024
73cb6a4
fix: see if CI is flaking with the original tests. probably just need…
mkcp Sep 25, 2024
81b8c05
fix: these tests should clean up properly and not error
mkcp Sep 25, 2024
cf43754
fix: actually cleaning up the test with RemovalAll seems to cause a p…
mkcp Sep 25, 2024
2f1bd63
fix: reintroduce the ext_in_cluster test error catches
mkcp Sep 25, 2024
f377bb0
fix: missed a spot
mkcp Sep 25, 2024
4d87c74
fix: e2e 24 - can we assert that this error exists or do we have to i…
mkcp Sep 25, 2024
1676109
fix: address some fixmes before merge
mkcp Sep 25, 2024
8e36039
fix: does this work now?
mkcp Sep 25, 2024
76a6665
fix: handle and propagate errors in pkg/utils
mkcp Sep 25, 2024
c6e592d
fix: propagate any errors in ColorPrintYAML
mkcp Sep 25, 2024
752f0ff
fix: propagate any errors in src/pkg/message
mkcp Sep 25, 2024
cbb192e
fix: propagate any errors in src/pkg/variables
mkcp Sep 25, 2024
9eb3ef0
fix: propagate any errors in src/pkg/layout
mkcp Sep 25, 2024
0e6ef61
fix: srcfile is already closed and the error handled, no need to defe…
mkcp Sep 25, 2024
7879eb8
fix: ensure errors from deferred resource cleanup are passed back to …
mkcp Sep 26, 2024
1c471d2
chore: undo linter rule for CI so we can merge incremental changes
mkcp Sep 26, 2024
a62fba9
chore: undo the other linter rule
mkcp Sep 26, 2024
3ddd3dc
chore: undo non-testing changes
mkcp Sep 26, 2024
20241aa
fix: remove nolints for now to make ci happy. we'll have to readd later
mkcp Sep 26, 2024
9d5eced
fix: ensure we're defering resource cleanup in the tests
mkcp Sep 26, 2024
93417ee
chore: mark todos where we'll need to nolint later
mkcp Sep 26, 2024
cc6b253
chore: ensure NoError e2e.CleanFiles and pass thru testing.T
mkcp Sep 30, 2024
838e1e0
chore: use const
mkcp Sep 30, 2024
e23dd79
chore: ensure we don't try to close a nil response body
mkcp Sep 30, 2024
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
18 changes: 13 additions & 5 deletions src/test/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package test

import (
"bufio"
"errors"
"fmt"
"os"
"regexp"
Expand Down Expand Up @@ -53,13 +54,16 @@ func GetCLIName() string {
}

// Zarf executes a Zarf command.
func (e2e *ZarfE2ETest) Zarf(t *testing.T, args ...string) (string, string, error) {
func (e2e *ZarfE2ETest) Zarf(t *testing.T, args ...string) (_ string, _ string, err error) {
if !slices.Contains(args, "--tmpdir") && !slices.Contains(args, "tools") {
tmpdir, err := os.MkdirTemp("", "zarf-")
if err != nil {
return "", "", err
}
defer os.RemoveAll(tmpdir)
defer func(path string) {
errRemove := os.RemoveAll(path)
err = errors.Join(err, errRemove)
}(tmpdir)
args = append(args, "--tmpdir", tmpdir)
}
if !slices.Contains(args, "--zarf-cache") && !slices.Contains(args, "tools") && os.Getenv("CI") == "true" {
Expand All @@ -74,7 +78,10 @@ func (e2e *ZarfE2ETest) Zarf(t *testing.T, args ...string) (string, string, erro
return "", "", err
}
args = append(args, "--zarf-cache", cacheDir)
defer os.RemoveAll(cacheDir)
defer func(path string) {
errRemove := os.RemoveAll(path)
err = errors.Join(err, errRemove)
}(cacheDir)
}
return exec.CmdWithTesting(t, exec.PrintCfg(), e2e.ZarfBinPath, args...)
}
Expand All @@ -87,9 +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 {
_ = os.RemoveAll(file)
err := os.RemoveAll(file)
AustinAbro321 marked this conversation as resolved.
Show resolved Hide resolved
require.NoError(t, err)
}
}

Expand Down
13 changes: 7 additions & 6 deletions src/test/e2e/00_use_cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -110,7 +110,8 @@ func TestUseCLI(t *testing.T) {
t.Run("changing log level", func(t *testing.T) {
t.Parallel()
// Test that changing the log level actually applies the requested level
_, stdErr, _ := e2e.Zarf(t, "internal", "crc32", "zarf", "--log-level=debug")
_, stdErr, err := e2e.Zarf(t, "internal", "crc32", "zarf", "--log-level=debug")
require.NoError(t, err)
expectedOutString := "Log level set to debug"
require.Contains(t, stdErr, expectedOutString, "The log level should be changed to 'debug'")
})
Expand Down Expand Up @@ -138,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) {
Expand All @@ -164,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")
Expand Down Expand Up @@ -197,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)
Expand Down
2 changes: 1 addition & 1 deletion src/test/e2e/01_component_choice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions src/test/e2e/02_component_actions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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) {
Expand All @@ -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")
Expand All @@ -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) {
Expand Down
12 changes: 6 additions & 6 deletions src/test/e2e/03_deprecations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand All @@ -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###")
Expand Down
2 changes: 1 addition & 1 deletion src/test/e2e/04_create_templating_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
8 changes: 4 additions & 4 deletions src/test/e2e/05_tarball_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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) {
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/test/e2e/06_create_sbom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion src/test/e2e/07_create_git_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/test/e2e/08_create_differential_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/test/e2e/11_oci_pull_inspect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
6 changes: 4 additions & 2 deletions src/test/e2e/12_lint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ func TestLint(t *testing.T) {

testPackagePath := filepath.Join("src", "test", "packages", "12-lint")
configPath := filepath.Join(testPackagePath, "zarf-config.toml")
os.Setenv("ZARF_CONFIG", configPath)
osSetErr := os.Setenv("ZARF_CONFIG", configPath)
require.NoError(t, osSetErr, "Unable to set ZARF_CONFIG")
_, stderr, err := e2e.Zarf(t, "dev", "lint", testPackagePath, "-f", "good-flavor")
os.Unsetenv("ZARF_CONFIG")
osUnsetErr := os.Unsetenv("ZARF_CONFIG")
require.NoError(t, osUnsetErr, "Unable to cleanup ZARF_CONFIG")
require.Error(t, err, "Require an exit code since there was warnings / errors")
strippedStderr := e2e.StripMessageFormatting(stderr)

Expand Down
79 changes: 44 additions & 35 deletions src/test/e2e/14_oci_compose_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,45 +137,54 @@ func (suite *PublishCopySkeletonSuite) Test_2_FilePaths() {
}

for _, pkgTar := range pkgTars {
var pkg v1alpha1.ZarfPackage

unpacked := strings.TrimSuffix(pkgTar, ".tar.zst")
defer os.RemoveAll(unpacked)
defer os.RemoveAll(pkgTar)
_, _, err := e2e.Zarf(suite.T(), "tools", "archiver", "decompress", pkgTar, unpacked, "--unarchive-all")
suite.NoError(err)
suite.DirExists(unpacked)

// Verify skeleton contains kustomize-generated manifests.
if strings.HasSuffix(pkgTar, "zarf-package-test-compose-package-skeleton-0.0.1.tar.zst") {
kustomizeGeneratedManifests := []string{
"kustomization-connect-service-0.yaml",
"kustomization-connect-service-1.yaml",
"kustomization-connect-service-two-0.yaml",
}
manifestDir := filepath.Join(unpacked, "components", "test-compose-package", "manifests")
for _, manifest := range kustomizeGeneratedManifests {
manifestPath := filepath.Join(manifestDir, manifest)
suite.FileExists(manifestPath, "expected to find kustomize-generated manifest: %q", manifestPath)
var configMap corev1.ConfigMap
err := utils.ReadYaml(manifestPath, &configMap)
suite.NoError(err)
suite.Equal("ConfigMap", configMap.Kind, "expected manifest %q to be of kind ConfigMap", manifestPath)
// Wrap in a fn to ensure our defers cleanup resources on each iteration
mkcp marked this conversation as resolved.
Show resolved Hide resolved
func() {
var pkg v1alpha1.ZarfPackage

unpacked := strings.TrimSuffix(pkgTar, ".tar.zst")
_, _, err := e2e.Zarf(suite.T(), "tools", "archiver", "decompress", pkgTar, unpacked, "--unarchive-all")
suite.NoError(err)
suite.DirExists(unpacked)

// Cleanup resources
defer func() {
suite.NoError(os.RemoveAll(unpacked))
}()
defer func() {
suite.NoError(os.RemoveAll(pkgTar))
}()

// Verify skeleton contains kustomize-generated manifests.
if strings.HasSuffix(pkgTar, "zarf-package-test-compose-package-skeleton-0.0.1.tar.zst") {
kustomizeGeneratedManifests := []string{
"kustomization-connect-service-0.yaml",
"kustomization-connect-service-1.yaml",
"kustomization-connect-service-two-0.yaml",
}
manifestDir := filepath.Join(unpacked, "components", "test-compose-package", "manifests")
for _, manifest := range kustomizeGeneratedManifests {
manifestPath := filepath.Join(manifestDir, manifest)
suite.FileExists(manifestPath, "expected to find kustomize-generated manifest: %q", manifestPath)
var configMap corev1.ConfigMap
err := utils.ReadYaml(manifestPath, &configMap)
suite.NoError(err)
suite.Equal("ConfigMap", configMap.Kind, "expected manifest %q to be of kind ConfigMap", manifestPath)
}
}
}

err = utils.ReadYaml(filepath.Join(unpacked, layout.ZarfYAML), &pkg)
suite.NoError(err)
suite.NotNil(pkg)
err = utils.ReadYaml(filepath.Join(unpacked, layout.ZarfYAML), &pkg)
suite.NoError(err)
suite.NotNil(pkg)

components := pkg.Components
suite.NotNil(components)
components := pkg.Components
suite.NotNil(components)

isSkeleton := false
if strings.Contains(pkgTar, "-skeleton-") {
isSkeleton = true
}
suite.verifyComponentPaths(unpacked, components, isSkeleton)
isSkeleton := false
if strings.Contains(pkgTar, "-skeleton-") {
isSkeleton = true
}
suite.verifyComponentPaths(unpacked, components, isSkeleton)
}()
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/test/e2e/20_zarf_init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down Expand Up @@ -104,8 +104,8 @@ func TestZarfInit(t *testing.T) {
verifyZarfServiceLabels(t)

// Special sizing-hacking for reducing resources where Kind + CI eats a lot of free cycles (ignore errors)
_, _, _ = e2e.Kubectl(t, "scale", "deploy", "-n", "kube-system", "coredns", "--replicas=1")
_, _, _ = e2e.Kubectl(t, "scale", "deploy", "-n", "zarf", "agent-hook", "--replicas=1")
_, _, _ = e2e.Kubectl(t, "scale", "deploy", "-n", "kube-system", "coredns", "--replicas=1") // TODO(mkcp): intentionally ignored, mark nolint
_, _, _ = e2e.Kubectl(t, "scale", "deploy", "-n", "zarf", "agent-hook", "--replicas=1") // TODO(mkcp): intentionally ignored, mark nolint
}

func checkLogForSensitiveState(t *testing.T, logText string, zarfState types.ZarfState) {
Expand Down
Loading