Skip to content

Commit

Permalink
Merge pull request #6835 from owncloud/retry-409-for-given-step-upload
Browse files Browse the repository at this point in the history
[tests-only] [full-ci] Retry if 409 is received when uploading in a Given step
  • Loading branch information
phil-davis authored Jul 19, 2023
2 parents b505e33 + bd634cb commit 02a3bfd
Show file tree
Hide file tree
Showing 2 changed files with 236 additions and 52 deletions.
45 changes: 40 additions & 5 deletions tests/TestHelpers/UploadHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class UploadHelper extends Assert {
* @param int|null $chunkingVersion (1|2|null)
* if set to null chunking will not be used
* @param int|null $noOfChunks how many chunks to upload
* @param bool|null $isGivenStep
*
* @return ResponseInterface
* @throws GuzzleException
Expand All @@ -63,7 +64,8 @@ public static function upload(
?array $headers = [],
?int $davPathVersionToUse = 1,
?int $chunkingVersion = null,
?int $noOfChunks = 1
?int $noOfChunks = 1,
?bool $isGivenStep = false
): ResponseInterface {
//simple upload with no chunking
if ($chunkingVersion === null) {
Expand All @@ -77,7 +79,16 @@ public static function upload(
$headers,
$xRequestId,
$data,
$davPathVersionToUse
$davPathVersionToUse,
"files",
null,
"basic",
false,
0,
null,
[],
null,
$isGivenStep
);
} else {
//prepare chunking
Expand All @@ -102,7 +113,15 @@ public static function upload(
$xRequestId,
null,
$davPathVersionToUse,
"uploads"
"uploads",
null,
"basic",
false,
0,
null,
[],
null,
$isGivenStep
);
if ($result->getStatusCode() >= 400) {
return $result;
Expand Down Expand Up @@ -130,7 +149,15 @@ public static function upload(
$xRequestId,
$chunk,
$davPathVersionToUse,
$davRequestType
$davRequestType,
null,
"basic",
false,
0,
null,
[],
null,
$isGivenStep
);
if ($result->getStatusCode() >= 400) {
return $result;
Expand All @@ -152,7 +179,15 @@ public static function upload(
$xRequestId,
null,
$davPathVersionToUse,
"uploads"
"uploads",
null,
"basic",
false,
0,
null,
[],
null,
$isGivenStep
);
if ($result->getStatusCode() >= 400) {
return $result;
Expand Down
Loading

0 comments on commit 02a3bfd

Please sign in to comment.