@@ -178,6 +178,32 @@ func TestEqualObjectMatcher(t *testing.T) {
178
178
},
179
179
want : false ,
180
180
},
181
+ {
182
+ name : "Creation timestamp exists on modified but not on original" ,
183
+ original : & unstructured.Unstructured {
184
+ Object : map [string ]interface {}{
185
+ "spec" : map [string ]interface {}{
186
+ "A" : "A" ,
187
+ },
188
+ "metadata" : map [string ]interface {}{
189
+ "selfLink" : "foo" ,
190
+ "creationTimestamp" : "2020-07-11T00:00:00Z" ,
191
+ },
192
+ },
193
+ },
194
+ modified : & unstructured.Unstructured {
195
+ Object : map [string ]interface {}{
196
+ "spec" : map [string ]interface {}{
197
+ "A" : "A" ,
198
+ },
199
+ "metadata" : map [string ]interface {}{
200
+ "selfLink" : "foo" ,
201
+ "creationTimestamp" : "2021-11-03T11:05:17Z" ,
202
+ },
203
+ },
204
+ },
205
+ want : false ,
206
+ },
181
207
182
208
// Cases to test diff when fields exist only in modified object.
183
209
{
@@ -212,6 +238,28 @@ func TestEqualObjectMatcher(t *testing.T) {
212
238
},
213
239
want : false ,
214
240
},
241
+ {
242
+ name : "Creation timestamp exists on modified but not on original" ,
243
+ original : & unstructured.Unstructured {
244
+ Object : map [string ]interface {}{
245
+ "spec" : map [string ]interface {}{
246
+ "A" : "A" ,
247
+ },
248
+ },
249
+ },
250
+ modified : & unstructured.Unstructured {
251
+ Object : map [string ]interface {}{
252
+ "spec" : map [string ]interface {}{
253
+ "A" : "A" ,
254
+ },
255
+ "metadata" : map [string ]interface {}{
256
+ "selfLink" : "foo" ,
257
+ "creationTimestamp" : "2021-11-03T11:05:17Z" ,
258
+ },
259
+ },
260
+ },
261
+ want : false ,
262
+ },
215
263
216
264
// Test when fields are exists only in the original object.
217
265
{
@@ -246,6 +294,29 @@ func TestEqualObjectMatcher(t *testing.T) {
246
294
},
247
295
want : false ,
248
296
},
297
+ {
298
+ name : "Creation timestamp exists on original but not on modified" ,
299
+ original : & unstructured.Unstructured {
300
+ Object : map [string ]interface {}{
301
+ "spec" : map [string ]interface {}{
302
+ "A" : "A" ,
303
+ },
304
+ "metadata" : map [string ]interface {}{
305
+ "selfLink" : "foo" ,
306
+ "creationTimestamp" : "2021-11-03T11:05:17Z" ,
307
+ },
308
+ },
309
+ },
310
+ modified : & unstructured.Unstructured {
311
+ Object : map [string ]interface {}{
312
+ "spec" : map [string ]interface {}{
313
+ "A" : "A" ,
314
+ },
315
+ },
316
+ },
317
+
318
+ want : false ,
319
+ },
249
320
250
321
// Test metadata fields computed by the system or in status are compared.
251
322
{
0 commit comments