Skip to content

Commit

Permalink
tests with slogger
Browse files Browse the repository at this point in the history
Signed-off-by: Austin Abro <[email protected]>
  • Loading branch information
AustinAbro321 committed Dec 13, 2024
1 parent 9581a66 commit 23f125c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
3 changes: 0 additions & 3 deletions src/test/e2e/25_helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,6 @@ func testHelmUninstallRollback(t *testing.T) {
stdOut, stdErr, err = e2e.Zarf(t, "package", "deploy", evilPath, "--timeout", "10s", "--confirm")
require.Error(t, err, stdOut, stdErr)

// This package contains SBOMable things but was created with --skip-sbom
require.Contains(t, string(stdErr), "This package does NOT contain an SBOM.")

// Ensure this leaves behind a dos-games chart.
// We do not want to uninstall charts that had failed installs/upgrades
// to prevent unintentional deletion and/or data loss in production environments.
Expand Down
4 changes: 3 additions & 1 deletion src/test/e2e/26_simple_packages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

"github.com/stretchr/testify/require"
"github.com/zarf-dev/zarf/src/pkg/cluster"
"github.com/zarf-dev/zarf/src/pkg/logger"
)

func TestDosGames(t *testing.T) {
Expand All @@ -26,7 +27,8 @@ func TestDosGames(t *testing.T) {

c, err := cluster.NewCluster()
require.NoError(t, err)
tunnel, err := c.Connect(context.Background(), "doom")
ctx := logger.WithContext(context.Background(), e2e.GetLogger(t))
tunnel, err := c.Connect(ctx, "doom")
require.NoError(t, err)
defer tunnel.Close()

Expand Down
3 changes: 1 addition & 2 deletions src/test/e2e/31_checksum_and_signature_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ func TestChecksumAndSignature(t *testing.T) {
// Test that we get an error when trying to deploy a package without providing the public key
stdOut, stdErr, err = e2e.Zarf(t, "package", "deploy", pkgName, "--confirm")
require.Error(t, err, stdOut, stdErr)
require.Contains(t, e2e.StripMessageFormatting(stdErr), "failed to deploy package: unable to load the package: package is signed but no key was provided - add a key with the --key flag or use the --skip-signature-validation flag and run the command again")
require.Contains(t, stdErr, "failed to deploy package: unable to load the package: package is signed but no key was provided - add a key with the --key flag or use the --skip-signature-validation flag and run the command again")

// Test that we don't get an error when we remember to provide the public key
stdOut, stdErr, err = e2e.Zarf(t, "package", "deploy", pkgName, publicKeyFlag, "--confirm")
require.NoError(t, err, stdOut, stdErr)
require.Contains(t, stdErr, "Zarf deployment complete")

// Remove the package
stdOut, stdErr, err = e2e.Zarf(t, "package", "remove", pkgName, publicKeyFlag, "--confirm")
Expand Down
2 changes: 1 addition & 1 deletion src/test/e2e/35_custom_retries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestRetries(t *testing.T) {

stdOut, stdErr, err = e2e.Zarf(t, "package", "deploy", path.Join(tmpDir, pkgName), "--retries", "2", "--timeout", "3s", "--tmpdir", tmpDir, "--confirm")
require.Error(t, err, stdOut, stdErr)
require.Contains(t, e2e.StripMessageFormatting(stdErr), "unable to install chart after 2 attempts")
require.Contains(t, stdErr, "unable to install chart after 2 attempts")

_, _, err = e2e.Zarf(t, "package", "remove", "dos-games", "--confirm")
require.NoError(t, err)
Expand Down

0 comments on commit 23f125c

Please sign in to comment.