Skip to content

Commit

Permalink
Merge pull request #3461 from monopole/anotherTest
Browse files Browse the repository at this point in the history
Add another test covering fix of 3412
  • Loading branch information
monopole authored Jan 14, 2021
2 parents e3fcec1 + b41df22 commit 64ffbcb
Showing 1 changed file with 36 additions and 3 deletions.
39 changes: 36 additions & 3 deletions api/krusty/configmaps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ metadata:
`)
}

// Observation: Numbers no longer quoted
func TestGeneratorIntVsStringWithMerge(t *testing.T) {
th := kusttest_test.MakeHarness(t)
th.WriteK("base", `
Expand All @@ -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"
Expand All @@ -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) {
Expand Down

0 comments on commit 64ffbcb

Please sign in to comment.