Skip to content

Commit 885c101

Browse files
committed
test(spanner): add deadline exceeded polling to testCreateBackup2
1 parent 78192ae commit 885c101

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

Spanner/tests/System/BackupTest.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,19 @@ public function testCreateBackup2()
292292
$backup = self::$instance->backup(self::$backupId2);
293293

294294
$op = $backup->create(self::$dbName2, $expireTime);
295-
$op->pollUntilComplete();
295+
$timeout = time() + self::LONG_TIMEOUT_SECONDS;
296+
while (time() < $timeout) {
297+
try {
298+
$op->pollUntilComplete([
299+
'maxPollingDurationSeconds' => $timeout - time()
300+
]);
301+
break;
302+
} catch (\Google\ApiCore\ApiException $e) {
303+
if ($e->getStatus() !== 'DEADLINE_EXCEEDED') {
304+
throw $e;
305+
}
306+
}
307+
}
296308

297309
self::$deletionQueue->add(function () use ($backup) {
298310
$backup->delete();

0 commit comments

Comments
 (0)