Skip to content

Commit

Permalink
fix: refactors tests and fixes bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
UncleGedd committed Feb 27, 2024
1 parent 70b2c68 commit 06101ef
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 26 deletions.
1 change: 0 additions & 1 deletion src/pkg/bundle/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ func (b *Bundle) processOverrideVariables(overrideMap *map[string]map[string]*va
overrideVal = sharedConfigOverride
} else {
// use default v if no config v is set
//overrideVal = "sharedConfigOverride"
overrideVal = v.Default
}

Expand Down
2 changes: 1 addition & 1 deletion src/pkg/bundle/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func removePackages(packagesToRemove []types.Package, b *Bundle, zarfPackageName
pkg := packagesToRemove[i]
zarfPackageName := pkg.Name
// use the name map if it has been set (remote pkgs where the pkg name isn't consistent)
if zarfPackageNameMap[pkg.Name] != "" {
if _, ok := zarfPackageNameMap[pkg.Name]; ok {
zarfPackageName = zarfPackageNameMap[pkg.Name]
}

Expand Down
13 changes: 0 additions & 13 deletions src/test/bundles/01-uds-bundle/local/uds-bundle.yaml

This file was deleted.

18 changes: 7 additions & 11 deletions src/test/e2e/bundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,14 @@ func TestLocalBundleWithRemotePkgs(t *testing.T) {
pkg = fmt.Sprintf("src/test/packages/podinfo/zarf-package-podinfo-%s-0.0.1.tar.zst", e2e.Arch)
zarfPublish(t, pkg, "localhost:889")

bundleDir := "src/test/bundles/01-uds-bundle/remote"
bundleDir := "src/test/bundles/01-uds-bundle"
bundlePath := filepath.Join(bundleDir, fmt.Sprintf("uds-bundle-example-remote-%s-0.0.1.tar.zst", e2e.Arch))

createLocal(t, bundleDir, e2e.Arch)
inspectLocal(t, bundlePath)
inspectLocalAndSBOMExtract(t, bundlePath)
deploy(t, bundlePath)
remove(t, bundlePath)

// Test create using custom tmpDir
runCmd(t, "create "+bundleDir+" --tmpdir ./customtmp --confirm --insecure")

// remove customtmp folder if it exists
err := os.RemoveAll("./customtmp")
require.NoError(t, err)
}

func TestPackagesFlag(t *testing.T) {
Expand Down Expand Up @@ -178,8 +171,8 @@ func TestResumeFlag(t *testing.T) {
e2e.CreateZarfPkg(t, "src/test/packages/nginx", false)
e2e.CreateZarfPkg(t, "src/test/packages/podinfo", false)

bundleDir := "src/test/bundles/01-uds-bundle/local"
bundlePath := filepath.Join(bundleDir, fmt.Sprintf("uds-bundle-example-local-%s-0.0.1.tar.zst", e2e.Arch))
bundleDir := "src/test/bundles/03-local-and-remote"
bundlePath := filepath.Join(bundleDir, fmt.Sprintf("uds-bundle-test-local-and-remote-%s-0.0.1.tar.zst", e2e.Arch))

createLocal(t, bundleDir, e2e.Arch)
inspectLocal(t, bundlePath)
Expand Down Expand Up @@ -237,7 +230,7 @@ func TestRemoteBundleWithRemotePkgs(t *testing.T) {
}

tarballPath := filepath.Join("build", fmt.Sprintf("uds-bundle-example-remote-%s-0.0.1.tar.zst", e2e.Arch))
bundlePath := "src/test/bundles/01-uds-bundle/remote"
bundlePath := "src/test/bundles/01-uds-bundle"
createRemoteInsecure(t, bundlePath, bundleRef.Registry, e2e.Arch)

// Test without oci prefix
Expand Down Expand Up @@ -531,4 +524,7 @@ func TestBundleTmpDir(t *testing.T) {
case <-time.After(10 * time.Second): // Timeout after 10 seconds
t.Fatal("timeout waiting for directory to get populated")
}
// remove customtmp folder if it exists
err = os.RemoveAll("./customtmp")
require.NoError(t, err)
}

0 comments on commit 06101ef

Please sign in to comment.