@@ -343,24 +343,24 @@ func TestApplier(t *testing.T) {
343343 Type : event .Started ,
344344 },
345345 },
346- // Secrets before Deployments (see pkg/ordering )
346+ // Wait events with same status sorted by Identifier (see pkg/testutil )
347347 {
348348 EventType : event .WaitType ,
349349 WaitEvent : & testutil.ExpWaitEvent {
350350 GroupName : "wait-0" ,
351351 Status : event .ReconcilePending ,
352- Identifier : testutil .ToIdentifier (t , resources ["secret " ]),
352+ Identifier : testutil .ToIdentifier (t , resources ["deployment " ]),
353353 },
354354 },
355355 {
356356 EventType : event .WaitType ,
357357 WaitEvent : & testutil.ExpWaitEvent {
358358 GroupName : "wait-0" ,
359359 Status : event .ReconcilePending ,
360- Identifier : testutil .ToIdentifier (t , resources ["deployment " ]),
360+ Identifier : testutil .ToIdentifier (t , resources ["secret " ]),
361361 },
362362 },
363- // Deployment before Secret (see statusEvents )
363+ // Wait events with same status sorted by Identifier (see pkg/testutil )
364364 {
365365 EventType : event .WaitType ,
366366 WaitEvent : & testutil.ExpWaitEvent {
@@ -524,24 +524,24 @@ func TestApplier(t *testing.T) {
524524 Type : event .Started ,
525525 },
526526 },
527- // Apply Secrets before Deployments (see ordering.SortableMetas )
527+ // Wait events with same status sorted by Identifier (see pkg/testutil )
528528 {
529529 EventType : event .WaitType ,
530530 WaitEvent : & testutil.ExpWaitEvent {
531531 GroupName : "wait-0" ,
532532 Status : event .ReconcilePending ,
533- Identifier : testutil .ToIdentifier (t , resources ["secret " ]),
533+ Identifier : testutil .ToIdentifier (t , resources ["deployment " ]),
534534 },
535535 },
536536 {
537537 EventType : event .WaitType ,
538538 WaitEvent : & testutil.ExpWaitEvent {
539539 GroupName : "wait-0" ,
540540 Status : event .ReconcilePending ,
541- Identifier : testutil .ToIdentifier (t , resources ["deployment " ]),
541+ Identifier : testutil .ToIdentifier (t , resources ["secret " ]),
542542 },
543543 },
544- // Wait Deployments before Secrets (see testutil.GroupedEventsByID )
544+ // Wait events with same status sorted by Identifier (see pkg/ testutil)
545545 {
546546 EventType : event .WaitType ,
547547 WaitEvent : & testutil.ExpWaitEvent {
@@ -730,7 +730,7 @@ func TestApplier(t *testing.T) {
730730 Type : event .Started ,
731731 },
732732 },
733- // Prune Deployments before Secrets (see ordering.SortableMetas )
733+ // Wait events with same status sorted by Identifier (see pkg/testutil )
734734 {
735735 EventType : event .WaitType ,
736736 WaitEvent : & testutil.ExpWaitEvent {
@@ -747,7 +747,7 @@ func TestApplier(t *testing.T) {
747747 Identifier : testutil .ToIdentifier (t , resources ["secret" ]),
748748 },
749749 },
750- // Wait Deployments before Secrets (see testutil.GroupedEventsByID )
750+ // Wait events with same status sorted by Identifier (see pkg/ testutil)
751751 {
752752 EventType : event .WaitType ,
753753 WaitEvent : & testutil.ExpWaitEvent {
@@ -1123,6 +1123,7 @@ func TestApplier(t *testing.T) {
11231123 Type : event .Started ,
11241124 },
11251125 },
1126+ // Wait events sorted Pending > Successful (see pkg/testutil)
11261127 {
11271128 EventType : event .WaitType ,
11281129 WaitEvent : & testutil.ExpWaitEvent {
@@ -1214,15 +1215,15 @@ func TestApplier(t *testing.T) {
12141215 Identifiers : object.ObjMetadataSet {
12151216 object .UnstructuredToObjMetadata (
12161217 testutil .Unstructured (t , resources ["deployment" ], JSONPathSetter {
1217- "$.kind " , "" ,
1218+ "$.metadata.name " , "" ,
12181219 }),
12191220 ),
12201221 },
12211222 Error : testutil .EqualErrorString (validation .NewError (
1222- field .Required (field .NewPath ("kind" ), "kind is required" ),
1223+ field .Required (field .NewPath ("metadata" , "name" ), "name is required" ),
12231224 object .UnstructuredToObjMetadata (
12241225 testutil .Unstructured (t , resources ["deployment" ], JSONPathSetter {
1225- "$.kind " , "" ,
1226+ "$.metadata.name " , "" ,
12261227 }),
12271228 ),
12281229 ).Error ()),
@@ -1234,15 +1235,15 @@ func TestApplier(t *testing.T) {
12341235 Identifiers : object.ObjMetadataSet {
12351236 object .UnstructuredToObjMetadata (
12361237 testutil .Unstructured (t , resources ["deployment" ], JSONPathSetter {
1237- "$.metadata.name " , "" ,
1238+ "$.kind " , "" ,
12381239 }),
12391240 ),
12401241 },
12411242 Error : testutil .EqualErrorString (validation .NewError (
1242- field .Required (field .NewPath ("metadata" , "name" ), "name is required" ),
1243+ field .Required (field .NewPath ("kind" ), "kind is required" ),
12431244 object .UnstructuredToObjMetadata (
12441245 testutil .Unstructured (t , resources ["deployment" ], JSONPathSetter {
1245- "$.metadata.name " , "" ,
1246+ "$.kind " , "" ,
12461247 }),
12471248 ),
12481249 ).Error ()),
@@ -1302,7 +1303,7 @@ func TestApplier(t *testing.T) {
13021303 Type : event .Started ,
13031304 },
13041305 },
1305- // Secret pending
1306+ // Wait events sorted Pending > Successful (see pkg/testutil)
13061307 {
13071308 EventType : event .WaitType ,
13081309 WaitEvent : & testutil.ExpWaitEvent {
@@ -1311,7 +1312,6 @@ func TestApplier(t *testing.T) {
13111312 Identifier : testutil .ToIdentifier (t , resources ["secret" ]),
13121313 },
13131314 },
1314- // Secret reconciled
13151315 {
13161316 EventType : event .WaitType ,
13171317 WaitEvent : & testutil.ExpWaitEvent {
@@ -1802,6 +1802,7 @@ func TestApplierCancel(t *testing.T) {
18021802 Type : event .Started ,
18031803 },
18041804 },
1805+ // Wait events sorted Pending > Successful (see pkg/testutil)
18051806 {
18061807 // Deployment reconcile pending.
18071808 EventType : event .WaitType ,
@@ -1920,6 +1921,9 @@ func TestApplierCancel(t *testing.T) {
19201921 }
19211922 }
19221923
1924+ // sort to allow comparison of multiple wait events
1925+ testutil .SortExpEvents (receivedEvents )
1926+
19231927 // Validate the rest of the events
19241928 testutil .AssertEqual (t , tc .expectedEvents , receivedEvents ,
19251929 "Actual events (%d) do not match expected events (%d)" ,
0 commit comments