@@ -99,18 +99,20 @@ func TestValidateManifestMissingData(t *testing.T) {
99
99
}
100
100
101
101
for _ , test := range tests {
102
- test := test
103
- name := fmt .Sprintf ("manifest missing %s" , strings .Join (test .missingFields , "." ))
102
+ name := "manifest missing " + strings .Join (test .missingFields , "." )
104
103
105
104
t .Run (
106
105
name ,
107
106
func (t * testing.T ) {
108
107
t .Parallel ()
108
+
109
109
configmap := * createExConfigMap ("configmap1" )
110
+
110
111
err := unstructured .SetNestedField (configmap , "" , test .missingFields ... )
111
112
if err != nil {
112
113
t .Fatal (err .Error ())
113
114
}
115
+
114
116
manifests := []map [string ]interface {}{configmap }
115
117
116
118
patcher := manifestPatcher {manifests : manifests , patches : []map [string ]interface {}{}}
@@ -136,8 +138,7 @@ func TestValidatePatchMissingData(t *testing.T) {
136
138
}
137
139
138
140
for _ , test := range tests {
139
- test := test
140
- name := fmt .Sprintf ("patch missing %s" , strings .Join (test .missingFields , "." ))
141
+ name := "patch missing " + strings .Join (test .missingFields , "." )
141
142
142
143
t .Run (
143
144
name ,
@@ -159,10 +160,12 @@ func TestValidatePatchMissingData(t *testing.T) {
159
160
},
160
161
},
161
162
}
163
+
162
164
err := unstructured .SetNestedField (patch , "" , test .missingFields ... )
163
165
if err != nil {
164
166
t .Fatal (err .Error ())
165
167
}
168
+
166
169
patches := []map [string ]interface {}{patch }
167
170
168
171
patcher := manifestPatcher {manifests : manifests , patches : patches }
@@ -187,8 +190,7 @@ func TestValidatePatchInvalidSingleManifest(t *testing.T) {
187
190
}
188
191
189
192
for _ , test := range tests {
190
- test := test
191
- name := fmt .Sprintf ("patch invalid %s" , strings .Join (test .invalidFields , "." ))
193
+ name := "patch invalid " + strings .Join (test .invalidFields , "." )
192
194
193
195
t .Run (
194
196
name ,
@@ -207,10 +209,12 @@ func TestValidatePatchInvalidSingleManifest(t *testing.T) {
207
209
},
208
210
},
209
211
}
212
+
210
213
err := unstructured .SetNestedField (patch , true , test .invalidFields ... )
211
214
if err != nil {
212
215
t .Fatal (err .Error ())
213
216
}
217
+
214
218
patches := []map [string ]interface {}{patch }
215
219
216
220
patcher := manifestPatcher {manifests : manifests , patches : patches }
0 commit comments