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

test: avoid flake in test external #3432

Merged
merged 1 commit into from
Jan 24, 2025
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
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ test-e2e-without-cluster: build-examples ## Run all of the core Zarf CLI E2E tes
test-external: ## Run the Zarf CLI E2E tests for an external registry and cluster
@test -s $(ZARF_BIN) || $(MAKE)
@test -s ./build/zarf-init-$(ARCH)-$(CLI_VERSION).tar.zst || $(MAKE) init-package
@test -s ./build/zarf-package-podinfo-flux-$(ARCH).tar.zst || $(ZARF_BIN) package create examples/podinfo-flux -o build -a $(ARCH) --confirm
@test -s ./build/zarf-package-argocd-$(ARCH).tar.zst || $(ZARF_BIN) package create examples/argocd -o build -a $(ARCH) --confirm
cd src/test/external && go test -failfast -v -timeout 30m

Expand Down
2 changes: 1 addition & 1 deletion src/internal/packager/sbom/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func Catalog(ctx context.Context, componentSBOMs map[string]*layout.ComponentSBO
for _, refInfo := range imageList {
// TODO(mkcp): Remove message on logger release
builder.spinner.Updatef("Creating image SBOMs (%d of %d): %s", currImage, imageCount, refInfo.Reference)
l.Info("creating image SBOMs", "reference", refInfo.Reference)
l.Info("creating image SBOM", "image-name", refInfo.Reference)

// Get the image that we are creating an SBOM for
img, err := utils.LoadOCIImage(paths.Images.Base, refInfo)
Expand Down
12 changes: 7 additions & 5 deletions src/test/external/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@ import (

var zarfBinPath = path.Join("../../../build", test.GetCLIName())

func createPodInfoPackageWithInsecureSources(t *testing.T, temp string) {
err := copy.Copy("../../../examples/podinfo-flux", temp)
func createPodInfoPackageWithInsecureSources(t *testing.T, packageDir string) {
temp := t.TempDir()
err := copy.Copy("../../../examples/podinfo-flux", packageDir)
require.NoError(t, err)
// This is done because while .spec.insecure is auto set to true for internal registries by the agent
// it is not for external registries, however since we are using an insecure external registry, we still need it
err = exec.CmdWithPrint(zarfBinPath, "tools", "yq", "eval", ".spec.insecure = true", "-i", filepath.Join(temp, "helm", "podinfo-source.yaml"))
err = exec.CmdWithPrint(zarfBinPath, "tools", "yq", "eval", ".spec.insecure = true", "-i", filepath.Join(packageDir, "helm", "podinfo-source.yaml"))
require.NoError(t, err, "unable to yq edit helm source")
err = exec.CmdWithPrint(zarfBinPath, "tools", "yq", "eval", ".spec.insecure = true", "-i", filepath.Join(temp, "oci", "podinfo-source.yaml"))
err = exec.CmdWithPrint(zarfBinPath, "tools", "yq", "eval", ".spec.insecure = true", "-i", filepath.Join(packageDir, "oci", "podinfo-source.yaml"))
require.NoError(t, err, "unable to yq edit oci source")
err = exec.CmdWithPrint(zarfBinPath, "package", "create", temp, "--confirm", "--output", temp)
// avoiding Zarf cache because of flake https://github.com/zarf-dev/zarf/issues/3194
err = exec.CmdWithPrint(zarfBinPath, "package", "create", packageDir, "--confirm", "--output", packageDir, "--zarf-cache", temp)
require.NoError(t, err, "unable to create package")
}

Expand Down
Loading