From 2c61d4c6d8fb8eb14df9bb49c372005fc3908881 Mon Sep 17 00:00:00 2001 From: Kit Patella Date: Thu, 26 Sep 2024 10:05:45 -0700 Subject: [PATCH] chore: extract test changes to another branch Signed-off-by: Kit Patella --- src/test/common.go | 19 +++------- src/test/e2e/00_use_cli_test.go | 3 +- src/test/e2e/12_lint_test.go | 6 ++-- src/test/e2e/14_oci_compose_test.go | 8 ++--- src/test/e2e/20_zarf_init_test.go | 4 +-- src/test/e2e/21_connect_creds_test.go | 4 +-- src/test/e2e/24_variables_test.go | 6 ++-- src/test/e2e/25_helm_test.go | 8 ++--- src/test/e2e/28_wait_test.go | 2 +- src/test/e2e/29_config_file_test.go | 29 ++++++---------- src/test/external/common.go | 3 +- src/test/external/ext_in_cluster_test.go | 5 +-- src/test/external/ext_out_cluster_test.go | 42 +++++++---------------- src/test/upgrade/previously_built_test.go | 30 ++++++---------- 14 files changed, 53 insertions(+), 116 deletions(-) diff --git a/src/test/common.go b/src/test/common.go index dbeae330ff..746600feb1 100644 --- a/src/test/common.go +++ b/src/test/common.go @@ -6,9 +6,7 @@ package test import ( "bufio" - "errors" "fmt" - "log/slog" "os" "regexp" "runtime" @@ -55,16 +53,13 @@ func GetCLIName() string { } // Zarf executes a Zarf command. -func (e2e *ZarfE2ETest) Zarf(t *testing.T, args ...string) (_ string, _ string, err error) { +func (e2e *ZarfE2ETest) Zarf(t *testing.T, args ...string) (string, string, error) { if !slices.Contains(args, "--tmpdir") && !slices.Contains(args, "tools") { tmpdir, err := os.MkdirTemp("", "zarf-") if err != nil { return "", "", err } - defer func(path string) { - errRemove := os.RemoveAll(path) - err = errors.Join(err, errRemove) - }(tmpdir) + defer os.RemoveAll(tmpdir) args = append(args, "--tmpdir", tmpdir) } if !slices.Contains(args, "--zarf-cache") && !slices.Contains(args, "tools") && os.Getenv("CI") == "true" { @@ -79,10 +74,7 @@ func (e2e *ZarfE2ETest) Zarf(t *testing.T, args ...string) (_ string, _ string, return "", "", err } args = append(args, "--zarf-cache", cacheDir) - defer func(path string) { - errRemove := os.RemoveAll(path) - err = errors.Join(err, errRemove) - }(cacheDir) + defer os.RemoveAll(cacheDir) } return exec.CmdWithTesting(t, exec.PrintCfg(), e2e.ZarfBinPath, args...) } @@ -97,10 +89,7 @@ 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) { for _, file := range files { - err := os.RemoveAll(file) - if err != nil { - slog.Debug("Unable to cleanup files", "files", files, "error", err) - } + _ = os.RemoveAll(file) } } diff --git a/src/test/e2e/00_use_cli_test.go b/src/test/e2e/00_use_cli_test.go index d834445367..366bacb7f9 100644 --- a/src/test/e2e/00_use_cli_test.go +++ b/src/test/e2e/00_use_cli_test.go @@ -110,8 +110,7 @@ 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, err := e2e.Zarf(t, "internal", "crc32", "zarf", "--log-level=debug") - require.NoError(t, err) + _, stdErr, _ := e2e.Zarf(t, "internal", "crc32", "zarf", "--log-level=debug") expectedOutString := "Log level set to debug" require.Contains(t, stdErr, expectedOutString, "The log level should be changed to 'debug'") }) diff --git a/src/test/e2e/12_lint_test.go b/src/test/e2e/12_lint_test.go index 2c77b14056..dea06dd678 100644 --- a/src/test/e2e/12_lint_test.go +++ b/src/test/e2e/12_lint_test.go @@ -29,11 +29,9 @@ func TestLint(t *testing.T) { testPackagePath := filepath.Join("src", "test", "packages", "12-lint") configPath := filepath.Join(testPackagePath, "zarf-config.toml") - osSetErr := os.Setenv("ZARF_CONFIG", configPath) - require.NoError(t, osSetErr, "Unable to set ZARF_CONFIG") + os.Setenv("ZARF_CONFIG", configPath) _, stderr, err := e2e.Zarf(t, "dev", "lint", testPackagePath, "-f", "good-flavor") - osUnsetErr := os.Unsetenv("ZARF_CONFIG") - require.NoError(t, osUnsetErr, "Unable to cleanup ZARF_CONFIG") + os.Unsetenv("ZARF_CONFIG") require.Error(t, err, "Require an exit code since there was warnings / errors") strippedStderr := e2e.StripMessageFormatting(stderr) diff --git a/src/test/e2e/14_oci_compose_test.go b/src/test/e2e/14_oci_compose_test.go index 95d1436f74..7159394107 100644 --- a/src/test/e2e/14_oci_compose_test.go +++ b/src/test/e2e/14_oci_compose_test.go @@ -140,6 +140,8 @@ func (suite *PublishCopySkeletonSuite) Test_2_FilePaths() { 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) @@ -174,12 +176,6 @@ func (suite *PublishCopySkeletonSuite) Test_2_FilePaths() { isSkeleton = true } suite.verifyComponentPaths(unpacked, components, isSkeleton) - - // Cleanup resources - err = os.RemoveAll(unpacked) - suite.NoError(err) - err = os.RemoveAll(pkgTar) - suite.NoError(err) } } diff --git a/src/test/e2e/20_zarf_init_test.go b/src/test/e2e/20_zarf_init_test.go index 66106556bd..c94bfa4226 100644 --- a/src/test/e2e/20_zarf_init_test.go +++ b/src/test/e2e/20_zarf_init_test.go @@ -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") //nolint:errcheck - _, _, _ = e2e.Kubectl(t, "scale", "deploy", "-n", "zarf", "agent-hook", "--replicas=1") //nolint:errcheck + _, _, _ = e2e.Kubectl(t, "scale", "deploy", "-n", "kube-system", "coredns", "--replicas=1") + _, _, _ = e2e.Kubectl(t, "scale", "deploy", "-n", "zarf", "agent-hook", "--replicas=1") } func checkLogForSensitiveState(t *testing.T, logText string, zarfState types.ZarfState) { diff --git a/src/test/e2e/21_connect_creds_test.go b/src/test/e2e/21_connect_creds_test.go index 93a28c1690..c58244a736 100644 --- a/src/test/e2e/21_connect_creds_test.go +++ b/src/test/e2e/21_connect_creds_test.go @@ -74,6 +74,7 @@ func TestMetrics(t *testing.T) { if err != nil { t.Fatal(err) } + defer resp.Body.Close() // Read the response body body, err := io.ReadAll(resp.Body) @@ -85,9 +86,6 @@ func TestMetrics(t *testing.T) { require.Contains(t, string(body), desiredString) require.NoError(t, err, resp) require.Equal(t, 200, resp.StatusCode) - - err = resp.Body.Close() - require.NoError(t, err) } func connectToZarfServices(ctx context.Context, t *testing.T) { diff --git a/src/test/e2e/24_variables_test.go b/src/test/e2e/24_variables_test.go index aa16771d53..f5b06116d0 100644 --- a/src/test/e2e/24_variables_test.go +++ b/src/test/e2e/24_variables_test.go @@ -43,9 +43,8 @@ func TestVariables(t *testing.T) { require.Contains(t, stdErr, "", expectedOutString) // Test that not specifying a prompted variable results in an error - _, stdErr, err = e2e.Zarf(t, "package", "deploy", path, "--confirm") + _, stdErr, _ = e2e.Zarf(t, "package", "deploy", path, "--confirm") expectedOutString = "variable 'SITE_NAME' must be '--set' when using the '--confirm' flag" - require.Error(t, err) require.Contains(t, stdErr, "", expectedOutString) // Test that specifying an invalid variable value results in an error @@ -74,8 +73,7 @@ func TestVariables(t *testing.T) { require.Contains(t, string(outputTF), "unicorn-land") // Verify the configmap was properly templated - kubectlOut, _, err := e2e.Kubectl(t, "-n", "nginx", "get", "configmap", "nginx-configmap", "-o", "jsonpath='{.data.index\\.html}' ") - require.NoError(t, err, "unable to get nginx configmap") + kubectlOut, _, _ := e2e.Kubectl(t, "-n", "nginx", "get", "configmap", "nginx-configmap", "-o", "jsonpath='{.data.index\\.html}' ") // OPTIONAL_FOOTER should remain unset because it was not set during deploy require.Contains(t, string(kubectlOut), "\n \n ") // STYLE should take the default value diff --git a/src/test/e2e/25_helm_test.go b/src/test/e2e/25_helm_test.go index 8589f8156f..3e51900cdd 100644 --- a/src/test/e2e/25_helm_test.go +++ b/src/test/e2e/25_helm_test.go @@ -99,8 +99,7 @@ func testHelmEscaping(t *testing.T) { require.NoError(t, err, stdOut, stdErr) // Verify the configmap was deployed, escaped, and contains all of its data - kubectlOut, err := exec.Command("kubectl", "-n", "default", "describe", "cm", "dont-template-me").Output() - require.NoError(t, err, "unable to describe configmap") + kubectlOut, _ := exec.Command("kubectl", "-n", "default", "describe", "cm", "dont-template-me").Output() require.Contains(t, string(kubectlOut), `alert: OOMKilled {{ "{{ \"random.Values\" }}" }}`) require.Contains(t, string(kubectlOut), "backtick1: \"content with backticks `some random things`\"") require.Contains(t, string(kubectlOut), "backtick2: \"nested templating with backticks {{` random.Values `}}\"") @@ -176,9 +175,8 @@ func testHelmAdoption(t *testing.T) { deploymentManifest := "src/test/packages/25-manifest-adoption/deployment.yaml" // Deploy dos-games manually into the cluster without Zarf - kubectlOut, _, err := e2e.Kubectl(t, "apply", "-f", deploymentManifest) - require.NoError(t, err, "unable to apply", "deploymentManifest", deploymentManifest) - require.Contains(t, kubectlOut, "deployment.apps/game created") + kubectlOut, _, _ := e2e.Kubectl(t, "apply", "-f", deploymentManifest) + require.Contains(t, string(kubectlOut), "deployment.apps/game created") // Deploy dos-games into the cluster with Zarf stdOut, stdErr, err := e2e.Zarf(t, "package", "deploy", packagePath, "--confirm", "--adopt-existing-resources") diff --git a/src/test/e2e/28_wait_test.go b/src/test/e2e/28_wait_test.go index 2881966863..e67b60d178 100644 --- a/src/test/e2e/28_wait_test.go +++ b/src/test/e2e/28_wait_test.go @@ -51,7 +51,7 @@ func TestNoWait(t *testing.T) { case <-time.After(30 * time.Second): t.Error("Timeout waiting for zarf deploy (it tried to wait)") t.Log("Removing hanging namespace...") - _, _, _ = e2e.Kubectl(t, "delete", "namespace", "no-wait", "--force=true", "--wait=false", "--grace-period=0") //nolint:errcheck + _, _, _ = e2e.Kubectl(t, "delete", "namespace", "no-wait", "--force=true", "--wait=false", "--grace-period=0") } require.NoError(t, err, stdOut, stdErr) diff --git a/src/test/e2e/29_config_file_test.go b/src/test/e2e/29_config_file_test.go index 043cc9a606..0cea0b4dd9 100644 --- a/src/test/e2e/29_config_file_test.go +++ b/src/test/e2e/29_config_file_test.go @@ -26,6 +26,7 @@ func TestConfigFile(t *testing.T) { // Test the config file environment variable t.Setenv("ZARF_CONFIG", filepath.Join(dir, config)) + defer os.Unsetenv("ZARF_CONFIG") configFileTests(t, dir, path) configFileDefaultTests(t) @@ -33,10 +34,7 @@ func TestConfigFile(t *testing.T) { stdOut, stdErr, err := e2e.Zarf(t, "package", "remove", path, "--confirm") require.NoError(t, err, stdOut, stdErr) - // Cleanup e2e.CleanFiles(path) - err = os.Unsetenv("ZARF_CONFIG") - require.NoError(t, err) } func configFileTests(t *testing.T, dir, path string) { @@ -142,36 +140,29 @@ func configFileDefaultTests(t *testing.T) { // Test remaining default initializers t.Setenv("ZARF_CONFIG", filepath.Join("src", "test", "zarf-config-test.toml")) + defer os.Unsetenv("ZARF_CONFIG") // Test global flags - stdOut, _, err := e2e.Zarf(t, "--help") - require.NoError(t, err) + stdOut, _, _ := e2e.Zarf(t, "--help") for _, test := range globalFlags { - require.Contains(t, stdOut, test) + require.Contains(t, string(stdOut), test) } // Test init flags - stdOut, _, err = e2e.Zarf(t, "init", "--help") - require.NoError(t, err) + stdOut, _, _ = e2e.Zarf(t, "init", "--help") for _, test := range initFlags { - require.Contains(t, stdOut, test) + require.Contains(t, string(stdOut), test) } // Test package create flags - stdOut, _, err = e2e.Zarf(t, "package", "create", "--help") - require.NoError(t, err) + stdOut, _, _ = e2e.Zarf(t, "package", "create", "--help") for _, test := range packageCreateFlags { - require.Contains(t, stdOut, test) + require.Contains(t, string(stdOut), test) } // Test package deploy flags - stdOut, _, err = e2e.Zarf(t, "package", "deploy", "--help") - require.NoError(t, err) + stdOut, _, _ = e2e.Zarf(t, "package", "deploy", "--help") for _, test := range packageDeployFlags { - require.Contains(t, stdOut, test) + require.Contains(t, string(stdOut), test) } - - // Cleanup - err = os.Unsetenv("ZARF_CONFIG") - require.NoError(t, err) } diff --git a/src/test/external/common.go b/src/test/external/common.go index dd5446002d..0209ddadb2 100644 --- a/src/test/external/common.go +++ b/src/test/external/common.go @@ -28,8 +28,7 @@ func createPodInfoPackageWithInsecureSources(t *testing.T, temp string) { 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")) require.NoError(t, err, "unable to yq edit oci source") - err = exec.CmdWithPrint(zarfBinPath, "package", "create", temp, "--confirm", "--output", temp) - require.NoError(t, err, "unable to create package") + exec.CmdWithPrint(zarfBinPath, "package", "create", temp, "--confirm", "--output", temp) } func verifyWaitSuccess(t *testing.T, timeoutMinutes time.Duration, cmd string, args []string, condition string, onTimeout string) bool { diff --git a/src/test/external/ext_in_cluster_test.go b/src/test/external/ext_in_cluster_test.go index 709846d1d0..ad1e338935 100644 --- a/src/test/external/ext_in_cluster_test.go +++ b/src/test/external/ext_in_cluster_test.go @@ -157,6 +157,7 @@ func (suite *ExtInClusterTestSuite) Test_1_Deploy() { err := exec.CmdWithPrint(zarfBinPath, initArgs...) suite.NoError(err, "unable to initialize the k8s server with zarf") temp := suite.T().TempDir() + defer os.Remove(temp) createPodInfoPackageWithInsecureSources(suite.T(), temp) // Deploy the flux example package @@ -199,10 +200,6 @@ func (suite *ExtInClusterTestSuite) Test_1_Deploy() { _, _, err = exec.CmdWithTesting(suite.T(), exec.PrintCfg(), zarfBinPath, "destroy", "--confirm") suite.NoError(err, "unable to teardown zarf") - - // Cleanup tmpdir - err = os.RemoveAll(temp) - suite.NoError(err, "failed to clean up tempdir") } func TestExtInClusterTestSuite(t *testing.T) { diff --git a/src/test/external/ext_out_cluster_test.go b/src/test/external/ext_out_cluster_test.go index 9b429d442c..e2cbaccefb 100644 --- a/src/test/external/ext_out_cluster_test.go +++ b/src/test/external/ext_out_cluster_test.go @@ -58,12 +58,10 @@ func (suite *ExtOutClusterTestSuite) SetupSuite() { suite.Assertions = require.New(suite.T()) // Teardown any leftovers from previous tests - // NOTE(mkcp): We dogsled these errors because some of these commands will error if they don't cleanup a resource, - // which is ok. A better solution would be checking for none or unexpected kinds of errors. - _ = exec.CmdWithPrint("k3d", "cluster", "delete", clusterName) //nolint:errcheck - _ = exec.CmdWithPrint("docker", "rm", "-f", "k3d-"+registryHost) //nolint:errcheck - _ = exec.CmdWithPrint("docker", "compose", "down") //nolint:errcheck - _ = exec.CmdWithPrint("docker", "network", "remove", network) //nolint:errcheck + _ = exec.CmdWithPrint("k3d", "cluster", "delete", clusterName) + _ = exec.CmdWithPrint("docker", "rm", "-f", "k3d-"+registryHost) + _ = exec.CmdWithPrint("docker", "compose", "down") + _ = exec.CmdWithPrint("docker", "network", "remove", network) // Setup a network for everything to live inside err := exec.CmdWithPrint("docker", "network", "create", "--driver=bridge", "--subnet="+subnet, "--gateway="+gateway, network) @@ -149,6 +147,7 @@ func (suite *ExtOutClusterTestSuite) Test_1_Deploy() { func (suite *ExtOutClusterTestSuite) Test_2_DeployGitOps() { // Deploy the flux example package temp := suite.T().TempDir() + defer os.Remove(temp) createPodInfoPackageWithInsecureSources(suite.T(), temp) deployArgs := []string{"package", "deploy", filepath.Join(temp, "zarf-package-podinfo-flux-amd64.tar.zst"), "--confirm"} @@ -159,10 +158,6 @@ func (suite *ExtOutClusterTestSuite) Test_2_DeployGitOps() { deployArgs = []string{"package", "deploy", path, "--confirm"} err = exec.CmdWithPrint(zarfBinPath, deployArgs...) suite.NoError(err) - - // Clean up tmpdir - err = os.RemoveAll(temp) - suite.NoError(err, "unable to remove temporary directory") } func (suite *ExtOutClusterTestSuite) Test_3_AuthToPrivateHelmChart() { @@ -173,12 +168,12 @@ func (suite *ExtOutClusterTestSuite) Test_3_AuthToPrivateHelmChart() { tempDir := suite.T().TempDir() repoPath := filepath.Join(tempDir, "repositories.yaml") - err := os.Setenv("HELM_REPOSITORY_CONFIG", repoPath) - suite.NoError(err, "unable to set HELM_REPOSITORY_CONFIG") + os.Setenv("HELM_REPOSITORY_CONFIG", repoPath) + defer os.Unsetenv("HELM_REPOSITORY_CONFIG") packagePath := filepath.Join("..", "packages", "external-helm-auth") findImageArgs := []string{"dev", "find-images", packagePath} - err = exec.CmdWithPrint(zarfBinPath, findImageArgs...) + err := exec.CmdWithPrint(zarfBinPath, findImageArgs...) suite.Error(err, "Since auth has not been setup, this should fail") repoFile := repo.NewFile() @@ -200,10 +195,6 @@ func (suite *ExtOutClusterTestSuite) Test_3_AuthToPrivateHelmChart() { packageCreateArgs := []string{"package", "create", packagePath, fmt.Sprintf("--output=%s", tempDir), "--confirm"} err = exec.CmdWithPrint(zarfBinPath, packageCreateArgs...) suite.NoError(err, "Unable to create package, helm auth likely failed") - - // Cleanup env var - err = os.Unsetenv("HELM_REPOSITORY_CONFIG") - suite.NoError(err, "unable to unset HELM_REPOSITORY_CONFIG") } func (suite *ExtOutClusterTestSuite) createHelmChartInGitea(baseURL string, username string, password string) { @@ -222,6 +213,7 @@ func (suite *ExtOutClusterTestSuite) createHelmChartInGitea(baseURL string, user file, err := os.Open(podinfoTarballPath) suite.NoError(err) + defer file.Close() body := &bytes.Buffer{} writer := multipart.NewWriter(body) @@ -229,12 +221,7 @@ func (suite *ExtOutClusterTestSuite) createHelmChartInGitea(baseURL string, user suite.NoError(err) _, err = io.Copy(part, file) suite.NoError(err) - - // Cleanup file and writer - err = file.Close() - suite.NoError(err, "unable to close file") - err = writer.Close() - suite.NoError(err, "unable to close writer") + writer.Close() req, err := http.NewRequest("POST", url, body) suite.NoError(err) @@ -246,8 +233,7 @@ func (suite *ExtOutClusterTestSuite) createHelmChartInGitea(baseURL string, user resp, err := client.Do(req) suite.NoError(err) - err = resp.Body.Close() - suite.NoError(err, "unable to close response body") + resp.Body.Close() } func (suite *ExtOutClusterTestSuite) makeGiteaUserPrivate(baseURL string, username string, password string) { @@ -272,12 +258,10 @@ func (suite *ExtOutClusterTestSuite) makeGiteaUserPrivate(baseURL string, userna client := &http.Client{} resp, err := client.Do(req) suite.NoError(err) + defer resp.Body.Close() + _, err = io.ReadAll(resp.Body) suite.NoError(err) - - // Cleanup - err = resp.Body.Close() - suite.NoError(err, "unable to close response body") } func TestExtOurClusterTestSuite(t *testing.T) { diff --git a/src/test/upgrade/previously_built_test.go b/src/test/upgrade/previously_built_test.go index 178a97ca5b..0b59761d6d 100644 --- a/src/test/upgrade/previously_built_test.go +++ b/src/test/upgrade/previously_built_test.go @@ -29,24 +29,18 @@ func TestPreviouslyBuiltZarfPackage(t *testing.T) { t.Log("Upgrade: Previously Built Zarf Package") // For the upgrade test, podinfo-upgrade should already be in the cluster (version 6.3.3) (see .github/workflows/test-upgrade.yml) - kubectlOut, _, err := kubectl(t, "-n=podinfo-upgrade", "rollout", "status", "deployment/podinfo-upgrade") - require.NoError(t, err) + kubectlOut, _, _ := kubectl(t, "-n=podinfo-upgrade", "rollout", "status", "deployment/podinfo-upgrade") require.Contains(t, kubectlOut, "successfully rolled out") - kubectlOut, _, err = kubectl(t, "-n=podinfo-upgrade", "get", "deployment", "podinfo-upgrade", "-o=jsonpath={.metadata.labels}}") - require.NoError(t, err) + kubectlOut, _, _ = kubectl(t, "-n=podinfo-upgrade", "get", "deployment", "podinfo-upgrade", "-o=jsonpath={.metadata.labels}}") require.Contains(t, kubectlOut, "6.3.3") // Verify that the private-registry secret and private-git-server secret in the podinfo-upgrade namespace are the same after re-init // This tests that `zarf tools update-creds` successfully updated the other namespace - zarfRegistrySecret, _, err := kubectl(t, "-n=zarf", "get", "secret", "private-registry", "-o", "jsonpath={.data}") - require.NoError(t, err) - podinfoRegistrySecret, _, err := kubectl(t, "-n=podinfo-upgrade", "get", "secret", "private-registry", "-o", "jsonpath={.data}") - require.NoError(t, err) + zarfRegistrySecret, _, _ := kubectl(t, "-n=zarf", "get", "secret", "private-registry", "-o", "jsonpath={.data}") + podinfoRegistrySecret, _, _ := kubectl(t, "-n=podinfo-upgrade", "get", "secret", "private-registry", "-o", "jsonpath={.data}") require.Equal(t, zarfRegistrySecret, podinfoRegistrySecret, "the zarf registry secret and podinfo-upgrade registry secret did not match") - zarfGitServerSecret, _, err := kubectl(t, "-n=zarf", "get", "secret", "private-git-server", "-o", "jsonpath={.data}") - require.NoError(t, err) - podinfoGitServerSecret, _, err := kubectl(t, "-n=podinfo-upgrade", "get", "secret", "private-git-server", "-o", "jsonpath={.data}") - require.NoError(t, err) + zarfGitServerSecret, _, _ := kubectl(t, "-n=zarf", "get", "secret", "private-git-server", "-o", "jsonpath={.data}") + podinfoGitServerSecret, _, _ := kubectl(t, "-n=podinfo-upgrade", "get", "secret", "private-git-server", "-o", "jsonpath={.data}") require.Equal(t, zarfGitServerSecret, podinfoGitServerSecret, "the zarf git server secret and podinfo-upgrade git server secret did not match") // We also expect a 6.3.4 package to have been previously built @@ -62,11 +56,9 @@ func TestPreviouslyBuiltZarfPackage(t *testing.T) { require.Contains(t, stdErr, "-----BEGIN PUBLIC KEY-----") // Verify that podinfo-upgrade successfully deploys in the cluster (version 6.3.4) - kubectlOut, _, err = kubectl(t, "-n=podinfo-upgrade", "rollout", "status", "deployment/podinfo-upgrade") - require.NoError(t, err) + kubectlOut, _, _ = kubectl(t, "-n=podinfo-upgrade", "rollout", "status", "deployment/podinfo-upgrade") require.Contains(t, kubectlOut, "successfully rolled out") - kubectlOut, _, err = kubectl(t, "-n=podinfo-upgrade", "get", "deployment", "podinfo-upgrade", "-o=jsonpath={.metadata.labels}}") - require.NoError(t, err) + kubectlOut, _, _ = kubectl(t, "-n=podinfo-upgrade", "get", "deployment", "podinfo-upgrade", "-o=jsonpath={.metadata.labels}}") require.Contains(t, kubectlOut, "6.3.4") // We also want to build a new package. @@ -83,11 +75,9 @@ func TestPreviouslyBuiltZarfPackage(t *testing.T) { require.Contains(t, stdErr, "-----BEGIN PUBLIC KEY-----") // Verify that podinfo-upgrade successfully deploys in the cluster (version 6.3.5) - kubectlOut, _, err = kubectl(t, "-n=podinfo-upgrade", "rollout", "status", "deployment/podinfo-upgrade") - require.NoError(t, err) + kubectlOut, _, _ = kubectl(t, "-n=podinfo-upgrade", "rollout", "status", "deployment/podinfo-upgrade") require.Contains(t, kubectlOut, "successfully rolled out") - kubectlOut, _, err = kubectl(t, "-n=podinfo-upgrade", "get", "deployment", "podinfo-upgrade", "-o=jsonpath={.metadata.labels}}") - require.NoError(t, err) + kubectlOut, _, _ = kubectl(t, "-n=podinfo-upgrade", "get", "deployment", "podinfo-upgrade", "-o=jsonpath={.metadata.labels}}") require.Contains(t, kubectlOut, "6.3.5") // Remove the package.