Skip to content

Commit

Permalink
chore: ExponentialBackoff UT throws risky warning (#6126)
Browse files Browse the repository at this point in the history
  • Loading branch information
vishwarajanand authored Apr 28, 2023
1 parent 776eca3 commit 35c8f95
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions Core/tests/Unit/ExponentialBackoffTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ public function delayProvider()
*/
public function testRetryListener()
{
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Intentionally failing request');
$args = ['foo' => 'bar'];
$retryListener = function (
$ex,
Expand All @@ -180,17 +182,11 @@ public function testRetryListener()
// Setting $retries to 0 so that retry doesn't happens after first
// failure.
$backoff = new ExponentialBackoff(0, null, $retryListener);
try {
$backoff->execute(
function () {
throw new \Exception('Intentionally failing request');
},
[$args]
);
} catch (\Exception $err) {
// Do nothing.
// Catching the intentional failing call being made above:
// "Intentionally failing request"
}
$backoff->execute(
function () {
throw new \Exception('Intentionally failing request');
},
[$args]
);
}
}

0 comments on commit 35c8f95

Please sign in to comment.