From fbc4c17960252285d573e1943bc69751bd34e9e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Sun, 11 Oct 2026 02:06:07 +0200 Subject: [PATCH] Improve test suite to avoid flaky container event order --- tests/FunctionalClientTest.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tests/FunctionalClientTest.php b/tests/FunctionalClientTest.php index 7a049a7..d51292a 100644 --- a/tests/FunctionalClientTest.php +++ b/tests/FunctionalClientTest.php @@ -75,6 +75,11 @@ public function testCreateStartAndRemoveContainer() $this->assertEquals("test\n", $ret); + $promise = $this->client->containerWait($container['Id']); + $ret = \React\Async\await($promise); + + $this->assertEquals(0, $ret['StatusCode']); + $promise = $this->client->containerAttach($container['Id'], true, false); $ret = \React\Async\await($promise); @@ -97,14 +102,8 @@ public function testCreateStartAndRemoveContainer() $actions[] = $one['Action']; } - // expect 4 events as of Docker 20.10 (2020), 5 in earlier versions - if (count($actions) === 4) { - // start, die, attach, destroy - $this->assertEquals(array('start', 'die', 'attach', 'destroy'), $actions); - } else { - // expects "start", "attach", "kill", "die", "destroy" events - $this->assertEquals(array('start', 'attach', 'kill', 'die', 'destroy'), $actions); - } + // expects "start", "die", "attach", "destroy" events (container already exited before attaching) + $this->assertEquals(array('start', 'die', 'attach', 'destroy'), $actions); } /**