diff --git a/app/kumactl/cmd/apply/testdata/apply-multiple-resource-different-type.yaml b/app/kumactl/cmd/apply/testdata/apply-multiple-resource-different-type.yaml index 223cf852f440..c6f1bed72bc7 100644 --- a/app/kumactl/cmd/apply/testdata/apply-multiple-resource-different-type.yaml +++ b/app/kumactl/cmd/apply/testdata/apply-multiple-resource-different-type.yaml @@ -1,3 +1,4 @@ +# Just a starting comment --- name: sample1 # --- Checking a random separation doesn't break everything diff --git a/pkg/util/yaml/split.go b/pkg/util/yaml/split.go index b59103dac701..f1e1c2179237 100644 --- a/pkg/util/yaml/split.go +++ b/pkg/util/yaml/split.go @@ -5,7 +5,10 @@ import ( "strings" ) -var sep = regexp.MustCompile("(?:^|\\s*\n)---\\s*") +var ( + sep = regexp.MustCompile("(?:^|\\s*\n)---\\s*") + comment = regexp.MustCompile("^#.*$") +) // SplitYAML takes YAMLs separated by `---` line and splits it into multiple YAMLs. Empty entries are ignored func SplitYAML(yamls string) []string { @@ -14,6 +17,7 @@ func SplitYAML(yamls string) []string { trimYAMLs := strings.TrimSpace(yamls) docs := sep.Split(trimYAMLs, -1) for _, doc := range docs { + doc = comment.ReplaceAllString(doc, "") if doc == "" { continue } diff --git a/test/e2e/federation/federation_suite_test.go b/test/e2e/federation/federation_suite_test.go index f0a69983f8af..4f42babfd837 100644 --- a/test/e2e/federation/federation_suite_test.go +++ b/test/e2e/federation/federation_suite_test.go @@ -14,6 +14,6 @@ func TestE2E(t *testing.T) { } var ( - _ = PDescribe("Federation with Kube Global", Label("job-3"), federation.FederateKubeZoneCPToKubeGlobal, Ordered) - _ = PDescribe("Federation with Universal Global", Label("job-3"), federation.FederateKubeZoneCPToUniversalGlobal, Ordered) + _ = Describe("Federation with Kube Global", Label("job-3"), federation.FederateKubeZoneCPToKubeGlobal, Ordered) + _ = Describe("Federation with Universal Global", Label("job-3"), federation.FederateKubeZoneCPToUniversalGlobal, Ordered) )