@@ -6,6 +6,7 @@ package krusty_test
66import (
77 "testing"
88
9+ "github.com/stretchr/testify/assert"
910 kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
1011)
1112
@@ -138,10 +139,10 @@ configMapGenerator:
138139- name: json
139140 literals:
140141 - 'v2=[{"path": "var/druid/segment-cache"}]'
141- - >-
142- druid_segmentCache_locations=[{"path":
143- "var/druid/segment-cache",
144- "maxSize": 32000000000,
142+ - >-
143+ druid_segmentCache_locations=[{"path":
144+ "var/druid/segment-cache",
145+ "maxSize": 32000000000,
145146 "freeSpacePercent": 1.0}]
146147secretGenerator:
147148- name: bob
@@ -201,12 +202,12 @@ metadata:
201202---
202203apiVersion: v1
203204data:
204- druid_segmentCache_locations: '[{"path": "var/druid/segment-cache", "maxSize":
205- 32000000000, "freeSpacePercent": 1.0}]'
205+ druid_segmentCache_locations: '[{"path": "var/druid/segment-cache", "maxSize": 32000000000,
206+ "freeSpacePercent": 1.0}]'
206207 v2: '[{"path": "var/druid/segment-cache"}]'
207208kind: ConfigMap
208209metadata:
209- name: blah-json-5298bc8g99
210+ name: blah-json-m8529t979f
210211---
211212apiVersion: v1
212213data:
@@ -228,7 +229,6 @@ type: Opaque
228229` )
229230}
230231
231- // TODO: These should be errors instead.
232232func TestGeneratorRepeatsInKustomization (t * testing.T ) {
233233 th := kusttest_test .MakeHarness (t )
234234 th .WriteK ("." , `
@@ -261,24 +261,13 @@ krypton
261261xenon
262262radon
263263` )
264- m := th .Run ("." , th .MakeDefaultOptions ())
265- th .AssertActualEqualsExpected (m , `
266- apiVersion: v1
267- data:
268- fruit: apple
269- nobles: |2
270-
271- helium
272- neon
273- argon
274- krypton
275- xenon
276- radon
277- vegetable: broccoli
278- kind: ConfigMap
279- metadata:
280- name: blah-bob-db529cg5bk
281- ` )
264+ err := th .RunWithErr ("." , th .MakeDefaultOptions ())
265+ if err == nil {
266+ t .Fatalf ("expected an error" )
267+ }
268+ assert .Contains (t , err .Error (),
269+ "kustomization unmarshal error: error converting YAML to JSON: yaml: unmarshal errors:\n " +
270+ " line 13: key \" literals\" already set in map\n line 18: key \" files\" already set in map" )
282271}
283272
284273func TestIssue3393 (t * testing.T ) {
@@ -553,8 +542,6 @@ metadata:
553542func TestDataEndsWithQuotes (t * testing.T ) {
554543 th := kusttest_test .MakeHarness (t )
555544 th .WriteK ("." , `
556- apiVersion: kustomize.config.k8s.io/v1beta1
557- kind: Kustomization
558545configMapGenerator:
559546 - name: test
560547 literals:
0 commit comments