From b41df2293ba217e2b6c99de2b2365d84f6f5a20d Mon Sep 17 00:00:00 2001 From: monopole Date: Thu, 14 Jan 2021 11:32:34 -0800 Subject: [PATCH] Add another test covering fix of 3412 --- api/krusty/configmaps_test.go | 39 ++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/api/krusty/configmaps_test.go b/api/krusty/configmaps_test.go index f52b40c0f1..0d37b77657 100644 --- a/api/krusty/configmaps_test.go +++ b/api/krusty/configmaps_test.go @@ -52,7 +52,6 @@ metadata: `) } -// Observation: Numbers no longer quoted func TestGeneratorIntVsStringWithMerge(t *testing.T) { th := kusttest_test.MakeHarness(t) th.WriteK("base", ` @@ -72,8 +71,7 @@ configMapGenerator: literals: - month=12 `) - opts := th.MakeDefaultOptions() - m := th.Run("overlay", opts) + m := th.Run("overlay", th.MakeDefaultOptions()) th.AssertActualEqualsExpected(m, `apiVersion: v1 data: crisis: "true" @@ -86,6 +84,41 @@ metadata: `) } +func TestGeneratorFromProperties(t *testing.T) { + th := kusttest_test.MakeHarness(t) + th.WriteK("base", ` +configMapGenerator: + - name: test-configmap + behavior: create + envs: + - properties +`) + th.WriteF("base/properties", ` +VAR1=100 +`) + th.WriteK("overlay", ` +resources: +- ../base +configMapGenerator: +- name: test-configmap + behavior: "merge" + envs: + - properties +`) + th.WriteF("overlay/properties", ` +VAR2=200 +`) + m := th.Run("overlay", th.MakeDefaultOptions()) + th.AssertActualEqualsExpected(m, `apiVersion: v1 +data: + VAR1: "100" + VAR2: "200" +kind: ConfigMap +metadata: + name: test-configmap-hdghb5ddkg +`) +} + // Generate a Secret and a ConfigMap from the same data // to compare the result. func TestGeneratorBasics(t *testing.T) {