Merge pull request #3461 from monopole/anotherTest

Add another test covering fix of 3412
This commit is contained in:
Jeff Regan
2021-01-14 11:52:56 -08:00
committed by GitHub

View File

@@ -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) {