From df12ce021b0ce81f8537d500a80689fa427b6653 Mon Sep 17 00:00:00 2001 From: Andrew Bayer Date: Tue, 30 Aug 2022 18:05:24 -0400 Subject: [PATCH] Fix TestYamls for change in `ko create` With https://github.com/google/ko/pull/750, which we picked up when we bumped `ko` to `v0.12.0` in the test-runner image, `-n (namespace)` is no longer an argument for `ko create`. So we need to ensure that the namespace for the `TestYamls` CRDs is actually set properly, and get rid of the `-n (namespace)` from our invocation of `ko create`. Signed-off-by: Andrew Bayer --- test/examples_test.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/examples_test.go b/test/examples_test.go index 617b1aecf8f..45bfdacb8fd 100644 --- a/test/examples_test.go +++ b/test/examples_test.go @@ -77,8 +77,7 @@ func substituteEnv(input []byte, namespace string) ([]byte, error) { } output := defaultKoDockerRepoRE.ReplaceAll(input, []byte(val)) - // Strip any "namespace: default"s, all resources will be created in - // the test namespace using `ko create -n` + // Replace any "namespace: default"s with the test namespace. output = defaultNamespaceRE.ReplaceAll(output, []byte("namespace: "+namespace)) // Replace image names to arch specific ones, where it's necessary @@ -91,7 +90,7 @@ func substituteEnv(input []byte, namespace string) ([]byte, error) { // koCreate wraps the ko binary and invokes `ko create` for input within // namespace func koCreate(input []byte, namespace string) ([]byte, error) { - cmd := exec.Command("ko", "create", "--platform", "linux/"+getTestArch(), "-n", namespace, "-f", "-") + cmd := exec.Command("ko", "create", "--platform", "linux/"+getTestArch(), "-f", "-", "--", "--namespace", namespace) cmd.Stdin = bytes.NewReader(input) return cmd.CombinedOutput() }