@@ -474,17 +474,25 @@ public function testCreateConnectDisconnectAndRemoveNetwork()
474
474
$ promise = $ this ->client ->containerRemove ($ container ['Id ' ]);
475
475
$ ret = \React \Async \await ($ promise );
476
476
477
- // get all events between starting and removing for this container
477
+ // get all events between starting and removing for this network
478
478
$ promise = $ this ->client ->events ($ start , $ end , array ('network ' => array ($ network ['Id ' ])));
479
479
$ ret = \React \Async \await ($ promise );
480
480
481
- // expects "create", "disconnect", "destroy" events ("connect" will be skipped because we don't start the container)
482
- $ this ->assertCount (3 , $ ret );
483
- $ this ->assertEquals ('create ' , $ ret [0 ]['Action ' ]);
484
- $ this ->assertEquals ('disconnect ' , $ ret [1 ]['Action ' ]);
485
- $ this ->assertEquals ('destroy ' , $ ret [2 ]['Action ' ]);
481
+ // Support for both Ubuntu 22.04 (3 events) and Ubuntu 24.04 (2 events)
482
+ if (count ($ ret ) === 3 ) {
483
+ // On Ubuntu 22.04: expects "create", "disconnect", "destroy" events
484
+ $ this ->assertEquals ('create ' , $ ret [0 ]['Action ' ]);
485
+ $ this ->assertEquals ('disconnect ' , $ ret [1 ]['Action ' ]);
486
+ $ this ->assertEquals ('destroy ' , $ ret [2 ]['Action ' ]);
487
+ } else {
488
+ // On Ubuntu 24.04: expects only "create" and "destroy" events
489
+ $ this ->assertCount (2 , $ ret );
490
+ $ this ->assertEquals ('create ' , $ ret [0 ]['Action ' ]);
491
+ $ this ->assertEquals ('destroy ' , $ ret [1 ]['Action ' ]);
492
+ }
486
493
}
487
494
495
+
488
496
/**
489
497
* @depends testImageInspectCheckIfBusyboxExists
490
498
*/
0 commit comments