From b7aa1904fa7bf843e4d678a0d5fd649e4f91e24b Mon Sep 17 00:00:00 2001 From: Marcus Weiner Date: Sat, 5 Aug 2023 22:47:00 +0200 Subject: [PATCH] Reproduce bug Signed-off-by: Marcus Weiner --- cmd/flux/diff_kustomization_test.go | 6 ++++++ .../flux-kustomization-multiobj.yaml | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 cmd/flux/testdata/diff-kustomization/flux-kustomization-multiobj.yaml diff --git a/cmd/flux/diff_kustomization_test.go b/cmd/flux/diff_kustomization_test.go index fc2a9c67ce..a381a61f0a 100644 --- a/cmd/flux/diff_kustomization_test.go +++ b/cmd/flux/diff_kustomization_test.go @@ -91,6 +91,12 @@ func TestDiffKustomization(t *testing.T) { objectFile: "./testdata/diff-kustomization/stringdata-sops-secret.yaml", assert: assertGoldenFile("./testdata/diff-kustomization/diff-with-drifted-stringdata-sops-secret.golden"), }, + { + name: "diff where kustomization file has multiple objects with the same name", + args: "diff kustomization podinfo --path ./testdata/build-kustomization/podinfo --progress-bar=false --kustomization-file ./testdata/diff-kustomization/flux-kustomization-multiobj.yaml", + objectFile: "", + assert: assertGoldenFile("./testdata/diff-kustomization/nothing-is-deployed.golden"), + }, } tmpl := map[string]string{ diff --git a/cmd/flux/testdata/diff-kustomization/flux-kustomization-multiobj.yaml b/cmd/flux/testdata/diff-kustomization/flux-kustomization-multiobj.yaml new file mode 100644 index 0000000000..4311926014 --- /dev/null +++ b/cmd/flux/testdata/diff-kustomization/flux-kustomization-multiobj.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: podinfo + +--- +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: podinfo +spec: + interval: 5m0s + path: ./kustomize + force: true + prune: true + sourceRef: + kind: GitRepository + name: podinfo