diff --git a/.github/workflows/component-tests.yaml b/.github/workflows/component-tests.yaml index e1dfeea90..6c45625f0 100644 --- a/.github/workflows/component-tests.yaml +++ b/.github/workflows/component-tests.yaml @@ -79,10 +79,10 @@ jobs: - name: Set up Kind run: | - curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.20.0/kind-$(uname)-amd64 + curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.31.0/kind-linux-amd64 chmod +x ./kind ./kind create cluster - curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.21.0/bin/linux/amd64/kubectl + curl -LO "https://dl.k8s.io/release/v1.35.0/bin/linux/amd64/kubectl" chmod +x ./kubectl sudo mv ./kubectl /usr/local/bin/kubectl - name: Install Helm and Kubectl diff --git a/tests/component_test.go b/tests/component_test.go index cdede98ff..380f32576 100644 --- a/tests/component_test.go +++ b/tests/component_test.go @@ -357,22 +357,22 @@ func Test_07_RuleBindingApplyTest(t *testing.T) { } // valid - exitCode := testutils.RunCommand("kubectl", "apply", "-f", ruleBindingPath("all-valid.yaml")) + exitCode := testutils.RunCommand("kubectl", "apply", "--validate=false", "-f", ruleBindingPath("all-valid.yaml")) assert.Equal(t, 0, exitCode, "Error applying valid rule binding") exitCode = testutils.RunCommand("kubectl", "delete", "-f", ruleBindingPath("all-valid.yaml")) require.Equal(t, 0, exitCode, "Error deleting valid rule binding") // duplicate fields file := ruleBindingPath("dup-fields-name-tag.yaml") - exitCode = testutils.RunCommand("kubectl", "apply", "-f", file) + exitCode = testutils.RunCommand("kubectl", "apply", "--validate=false", "-f", file) assert.NotEqualf(t, 0, exitCode, "Expected error when applying rule binding '%s'", file) file = ruleBindingPath("dup-fields-name-id.yaml") - exitCode = testutils.RunCommand("kubectl", "apply", "-f", file) + exitCode = testutils.RunCommand("kubectl", "apply", "--validate=false", "-f", file) assert.NotEqualf(t, 0, exitCode, "Expected error when applying rule binding '%s'", file) file = ruleBindingPath("dup-fields-id-tag.yaml") - exitCode = testutils.RunCommand("kubectl", "apply", "-f", file) + exitCode = testutils.RunCommand("kubectl", "apply", "--validate=false", "-f", file) assert.NotEqualf(t, 0, exitCode, "Expected error when applying rule binding '%s'", file) } diff --git a/tests/testutils/utils.go b/tests/testutils/utils.go index 1ba07ba02..1e39599cc 100644 --- a/tests/testutils/utils.go +++ b/tests/testutils/utils.go @@ -1,7 +1,9 @@ package testutils import ( + "bytes" "errors" + "fmt" "io" "os/exec" ) @@ -9,10 +11,14 @@ import ( func RunCommand(name string, args ...string) int { cmd := exec.Command(name, args...) cmd.Stdout = io.Discard - cmd.Stderr = io.Discard + var stderr bytes.Buffer + cmd.Stderr = &stderr if err := cmd.Run(); err != nil { var exiterr *exec.ExitError if errors.As(err, &exiterr) { + if stderr.Len() > 0 { + fmt.Printf("Command '%s %v' failed: %s\n", name, args, stderr.String()) + } return exiterr.ExitCode() } }