From 93dd571df9ee978e0a04d98e3988da8bd4662e16 Mon Sep 17 00:00:00 2001 From: Natasha Sarkar Date: Wed, 3 Mar 2021 11:18:42 -0800 Subject: [PATCH] regression test for panic on duplicate keys --- api/krusty/duplicatekeys_test.go | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 api/krusty/duplicatekeys_test.go diff --git a/api/krusty/duplicatekeys_test.go b/api/krusty/duplicatekeys_test.go new file mode 100644 index 000000000..016aa61f0 --- /dev/null +++ b/api/krusty/duplicatekeys_test.go @@ -0,0 +1,39 @@ +package krusty_test + +import ( + "testing" + + kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest" +) + +func TestDuplicateKeys(t *testing.T) { + th := kusttest_test.MakeHarness(t) + th.WriteK(".", ` +resources: +- resources.yaml +`) + th.WriteF("resources.yaml", ` +apiVersion: apps/v1 +kind: Deployment +metadata: + name: podinfo +spec: + selector: + matchLabels: + app: podinfo + template: + spec: + containers: + - name: podinfod + image: ghcr.io/stefanprodan/podinfo:5.0.3 + command: + - ./podinfo + env: + - name: PODINFO_UI_COLOR + value: "#34577c" + env: + - name: PODINFO_UI_COLOR + value: "#34577c" +`) + th.RunWithErr(".", th.MakeDefaultOptions()) +}