Skip to content

Commit 73acf9a

Browse files
committed
Fix: PodDisruptionBudgetTest Consistent 409s
Issue here likely due to speed of test versus timing in VM. Trying to eliminate this timing issue in this test. Unclear if 409s should be resolved in client code with a loop or in the library.
1 parent 70e9c02 commit 73acf9a

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

tests/PodDisruptionBudgetTest.php

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,21 @@ public function runGetTests()
153153

154154
public function runUpdateTests()
155155
{
156-
$pdb = $this->cluster->getPodDisruptionBudgetByName('mysql-pdb');
157-
158-
$this->assertTrue($pdb->isSynced());
159-
160-
$pdb->setMinAvailable('25%');
161-
162-
$pdb->createOrUpdate();
156+
$backoff = 0;
157+
do {
158+
try {
159+
$pdb = $this->cluster->getPodDisruptionBudgetByName('mysql-pdb')->setMinAvailable('25%')->createOrUpdate();
160+
} catch (KubernetesAPIException $e) {
161+
if ($e->getCode() == 409) {
162+
sleep(2*$backoff);
163+
$backoff++;
164+
} else {
165+
throw $e;
166+
}
167+
if ($backoff > 3)
168+
break;
169+
}
170+
} while (!isset($pdb));
163171

164172
$this->assertTrue($pdb->isSynced());
165173

0 commit comments

Comments
 (0)