Skip to content

Commit 29412f2

Browse files
committed
test: update golden files and expectations for new YAML output order
After switching Resource.AsYAML() to use RNode.MustString(), YAML output now preserves the original field order from source YAML instead of alphabetical ordering. Update all golden files and test expectations to match the new output order. This is a follow-up to the MustString() migration in PR kubernetes-sigs#6046.
1 parent 35044bc commit 29412f2

File tree

245 files changed

+1941
-2071
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

245 files changed

+1941
-2071
lines changed

api/krusty/fnplugin_test.go

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -113,20 +113,20 @@ metadata:
113113
labels:
114114
airshipit.org/ephemeral-user-data: "true"
115115
name: node1-bmc-secret
116+
type: Opaque
116117
stringData:
117118
userData: |
118119
bootcmd:
119120
- mkdir /mnt/vda
120-
type: Opaque
121121
---
122122
apiVersion: apps/v1
123123
kind: Deployment
124124
metadata:
125-
annotations:
126-
tshirt-size: small
125+
name: nginx
127126
labels:
128127
app: nginx
129-
name: nginx
128+
annotations:
129+
tshirt-size: small
130130
spec:
131131
selector:
132132
matchLabels:
@@ -137,8 +137,8 @@ spec:
137137
app: nginx
138138
spec:
139139
containers:
140-
- image: nginx
141-
name: nginx
140+
- name: nginx
141+
image: nginx
142142
`, string(yml))
143143
require.NoError(t, fSys.RemoveAll(tmpDir.String()))
144144
}
@@ -204,20 +204,20 @@ metadata:
204204
labels:
205205
airshipit.org/ephemeral-user-data: "true"
206206
name: node1-bmc-secret
207+
type: Opaque
207208
stringData:
208209
userData: |
209210
bootcmd:
210211
- mkdir /mnt/vda
211-
type: Opaque
212212
---
213213
apiVersion: apps/v1
214214
kind: Deployment
215215
metadata:
216-
annotations:
217-
tshirt-size: small
216+
name: nginx
218217
labels:
219218
app: nginx
220-
name: nginx
219+
annotations:
220+
tshirt-size: small
221221
spec:
222222
selector:
223223
matchLabels:
@@ -228,8 +228,8 @@ spec:
228228
app: nginx
229229
spec:
230230
containers:
231-
- image: nginx
232-
name: nginx
231+
- name: nginx
232+
image: nginx
233233
`, string(yml))
234234
require.NoError(t, fSys.RemoveAll(tmpDir.String()))
235235
}
@@ -295,20 +295,20 @@ metadata:
295295
labels:
296296
airshipit.org/ephemeral-user-data: "true"
297297
name: node1-bmc-secret
298+
type: Opaque
298299
stringData:
299300
userData: |
300301
bootcmd:
301302
- mkdir /mnt/vda
302-
type: Opaque
303303
---
304304
apiVersion: apps/v1
305305
kind: Deployment
306306
metadata:
307-
annotations:
308-
tshirt-size: small
307+
name: nginx
309308
labels:
310309
app: nginx
311-
name: nginx
310+
annotations:
311+
tshirt-size: small
312312
spec:
313313
selector:
314314
matchLabels:
@@ -319,8 +319,8 @@ spec:
319319
app: nginx
320320
spec:
321321
containers:
322-
- image: nginx
323-
name: nginx
322+
- name: nginx
323+
image: nginx
324324
`, string(yml))
325325
require.NoError(t, fSys.RemoveAll(tmpDir.String()))
326326
}
@@ -564,13 +564,13 @@ metadata:
564564
app: simplegenerator
565565
name: simplegenerator-svc
566566
spec:
567+
selector:
568+
app: simplegenerator
567569
ports:
568570
- name: http
569571
port: 8081
570572
protocol: TCP
571573
targetPort: 8081
572-
selector:
573-
app: simplegenerator
574574
`, string(actual))
575575
}
576576

@@ -614,11 +614,11 @@ metadata:
614614
assert.Equal(t, `apiVersion: apps/v1
615615
kind: Deployment
616616
metadata:
617+
name: foo
617618
annotations:
618619
a-bool-value: "false"
619620
a-int-value: "0"
620621
a-string-value: ""
621-
name: foo
622622
`, string(actual))
623623
}
624624

@@ -677,16 +677,16 @@ data:
677677
assert.Equal(t, `apiVersion: v1
678678
kind: Namespace
679679
metadata:
680+
name: my-namespace
680681
labels:
681682
my-ns-name: function-test
682-
name: my-namespace
683683
---
684684
apiVersion: v1
685685
kind: Namespace
686686
metadata:
687+
name: another-namespace
687688
labels:
688689
my-ns-name: function-test
689-
name: another-namespace
690690
`, string(actual))
691691
}
692692

api/krusty/originannotation_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,15 +654,15 @@ buildMetadata: [originAnnotations]
654654
require.NoError(t, err)
655655
assert.Contains(t, string(yml), `kind: ConfigMap
656656
metadata:
657+
name: ldap-configmap-4d7m6k5b42
657658
annotations:
658659
config.kubernetes.io/origin: |
659660
repo: https://github.com/kubernetes-sigs/kustomize
660661
ref: v1.0.6
661662
configuredIn: examples/ldap/base/kustomization.yaml
662663
configuredBy:
663664
apiVersion: builtin
664-
kind: ConfigMapGenerator
665-
name: ldap-configmap-4d7m6k5b42`)
665+
kind: ConfigMapGenerator`)
666666
require.NoError(t, fSys.RemoveAll(tmpDir.String()))
667667
}
668668

api/krusty/pluginenv_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,14 @@ metadata:
102102
th.GetT().Fatalf("unexpected error: %v", err)
103103
}
104104

105-
expected := `apiVersion: v1
106-
env:
107-
kustomize_plugin_config_root: ` + dir + `
108-
kustomize_plugin_home: ` + pHome + `
109-
pwd: ` + dir + `
110-
kind: GeneratedEnv
105+
expected := `kind: GeneratedEnv
106+
apiVersion: v1
111107
metadata:
112108
name: hello
109+
env:
110+
pwd: ` + dir + `
111+
kustomize_plugin_home: ` + pHome + `
112+
kustomize_plugin_config_root: ` + dir + `
113113
`
114114

115115
if string(actual) != expected {
@@ -144,14 +144,14 @@ metadata:
144144
th.GetT().Fatalf("unexpected error: %v", err)
145145
}
146146

147-
expected := `apiVersion: v1
148-
env:
149-
kustomize_plugin_config_root: ` + dir + `
150-
kustomize_plugin_home: ` + pHome + `
151-
pwd: ` + dir + `
152-
kind: GeneratedEnv
147+
expected := `kind: GeneratedEnv
148+
apiVersion: v1
153149
metadata:
154150
name: hello
151+
env:
152+
pwd: ` + dir + `
153+
kustomize_plugin_home: ` + pHome + `
154+
kustomize_plugin_config_root: ` + dir + `
155155
`
156156

157157
if string(actual) != expected {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
apiVersion: v1
22
kind: Service
33
metadata:
4+
name: myService
45
labels:
56
app.kubernetes.io/managed-by: kustomize-(test)
6-
name: myService
77
spec:
88
ports:
99
- port: 7002
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
apiVersion: v1
22
kind: Service
33
metadata:
4+
name: foo-myService
45
annotations:
56
alpha.config.kubernetes.io/transformations: |
67
- configuredIn: kustomization.yaml
@@ -9,7 +10,6 @@ metadata:
910
kind: PrefixTransformer
1011
config.kubernetes.io/origin: |
1112
path: service.yaml
12-
name: foo-myService
1313
spec:
1414
ports:
1515
- port: 7002
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
apiVersion: v1
22
kind: Secret
33
metadata:
4-
annotations:
5-
config.kubernetes.io/origin: |
6-
path: ../base/short_secret.yaml
74
labels:
85
airshipit.org/ephemeral-user-data: "true"
96
name: node1-bmc-secret
7+
annotations:
8+
config.kubernetes.io/origin: |
9+
path: ../base/short_secret.yaml
10+
type: Opaque
1011
stringData:
1112
userData: |
1213
bootcmd:
1314
- mkdir /mnt/vda
14-
type: Opaque
1515
---
1616
apiVersion: v1
17-
data:
18-
crisis: "true"
19-
fruit: Indian Gooseberry
20-
year: "2020"
2117
kind: ConfigMap
2218
metadata:
19+
name: bob-79t79mt227
2320
annotations:
2421
config.kubernetes.io/origin: |
2522
configuredIn: ../base/configmap.yaml
2623
configuredBy:
2724
apiVersion: builtin
2825
kind: ConfigMapGenerator
2926
name: notImportantHere
30-
name: bob-79t79mt227
27+
data:
28+
crisis: "true"
29+
fruit: Indian Gooseberry
30+
year: "2020"
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
apiVersion: v1
2-
data:
3-
crisis: "true"
4-
fruit: Indian Gooseberry
5-
month: "12"
6-
year: "2020"
72
kind: ConfigMap
83
metadata:
4+
name: bob-bk46gm59c6
95
annotations:
106
config.kubernetes.io/origin: |
117
configuredIn: ../base/kustomization.yaml
128
configuredBy:
139
apiVersion: builtin
1410
kind: ConfigMapGenerator
15-
name: bob-bk46gm59c6
11+
data:
12+
crisis: "true"
13+
fruit: Indian Gooseberry
14+
month: "12"
15+
year: "2020"
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
apiVersion: v1
2-
data:
3-
month: "12"
42
kind: ConfigMap
53
metadata:
4+
name: bob-f8t5fhtbhc
65
annotations:
76
config.kubernetes.io/origin: |
87
configuredIn: kustomization.yaml
98
configuredBy:
109
apiVersion: builtin
1110
kind: ConfigMapGenerator
12-
name: bob-f8t5fhtbhc
11+
data:
12+
month: "12"
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
apiVersion: v1
22
kind: Secret
33
metadata:
4-
annotations:
5-
config.kubernetes.io/origin: |
6-
path: short_secret.yaml
74
labels:
85
airshipit.org/ephemeral-user-data: "true"
96
name: node1-bmc-secret
7+
annotations:
8+
config.kubernetes.io/origin: |
9+
path: short_secret.yaml
10+
type: Opaque
1011
stringData:
1112
userData: |
1213
bootcmd:
1314
- mkdir /mnt/vda
14-
type: Opaque
1515
---
1616
apiVersion: apps/v1
1717
kind: Deployment
1818
metadata:
19+
name: nginx
20+
labels:
21+
app: nginx
1922
annotations:
2023
config.kubernetes.io/origin: |
2124
configuredIn: gener.yaml
2225
configuredBy:
2326
kind: executable
2427
name: demo
2528
tshirt-size: small
26-
labels:
27-
app: nginx
28-
name: nginx
2929
spec:
3030
selector:
3131
matchLabels:
@@ -36,5 +36,5 @@ spec:
3636
app: nginx
3737
spec:
3838
containers:
39-
- image: nginx
40-
name: nginx
39+
- name: nginx
40+
image: nginx

0 commit comments

Comments
 (0)