Skip to content

Commit 7b26c8c

Browse files
committed
test: retry copy opetation on 500 status code
Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>
1 parent 4712c7c commit 7b26c8c

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

‎tests/acceptance/bootstrap/SpacesContext.php‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2270,7 +2270,20 @@ private function copyFileBetweenSpaces(
22702270
$davPath = WebdavHelper::getDavPath(WebDavHelper::DAV_VERSION_SPACES, $space["id"]);
22712271
$fullUrl = "$baseUrl/$davPath/$encodedName";
22722272

2273-
$this->featureContext->setResponse($this->copyFilesAndFoldersRequest($user, $fullUrl, $headers));
2273+
// With OCIS_ASYNC_UPLOADS=true in CI, file may still be in postprocessing while copying it.
2274+
// And the copy operation just returns 500 status code
2275+
// So retrying the copy operation
2276+
$retried = 0;
2277+
do {
2278+
$response = $this->copyFilesAndFoldersRequest($user, $fullUrl, $headers);
2279+
if ($response->getStatusCode() !== 500) {
2280+
break;
2281+
}
2282+
$retried++;
2283+
\sleep(1);
2284+
} while ($retried < STANDARD_RETRY_COUNT);
2285+
2286+
$this->featureContext->setResponse($response);
22742287
}
22752288

22762289
/**

0 commit comments

Comments
 (0)