From b461af0382f5bceff7d9aa04857dda15b6bacd4f Mon Sep 17 00:00:00 2001 From: Prajwol Amatya Date: Mon, 12 May 2025 16:45:24 +0545 Subject: [PATCH] added test to restart and resume all stale uploads --- tests/acceptance/bootstrap/CliContext.php | 17 +++++++++++++ ...ected-failures-localAPI-on-OCIS-storage.md | 5 ++++ .../features/cliCommands/staleUpload.feature | 24 +++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/tests/acceptance/bootstrap/CliContext.php b/tests/acceptance/bootstrap/CliContext.php index 45d95068162..630868232b1 100644 --- a/tests/acceptance/bootstrap/CliContext.php +++ b/tests/acceptance/bootstrap/CliContext.php @@ -894,4 +894,21 @@ public function theAdministratorRestoresTheTrashedResourcesOfSpaceOwnedByUser( ]; $this->featureContext->setResponse(CliHelper::runCommand($body)); } + + /** + * @When /^the administrator (resumes|restarts) all the stale uploads$/ + * + * @param string $flag + * + * @return void + * @throws GuzzleException + */ + public function theAdministratorResumesOrRestartsAllTheStaleUploads(string $flag): void { + $flag = rtrim($flag, "s"); + $command = "storage-users uploads sessions --$flag --json"; + $body = [ + "command" => $command + ]; + $this->featureContext->setResponse(CliHelper::runCommand($body)); + } } diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index f58b0a47a20..aec3a187549 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -406,5 +406,10 @@ The expected failures in this file are from features in the owncloud/ocis repo. #### [Activity. no event for deleting a file using file-id](https://github.com/owncloud/ocis/issues/10328) - [apiActivities/activitiesByFileId.feature:2017](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiActivities/activitiesByFileId.feature#L2017) +#### [[CLI]Restart and Resume stale uploads returns empty list](https://github.com/owncloud/ocis/issues/11296) + +- [cliCommands/staleUpload.feature:85](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/cliCommands/staleUpload.feature#L85) +- [cliCommands/staleUpload.feature:97](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/cliCommands/staleUpload.feature#L97) + Note: always have an empty line at the end of this file. The bash script that processes this file requires that the last line has a newline on the end. diff --git a/tests/acceptance/features/cliCommands/staleUpload.feature b/tests/acceptance/features/cliCommands/staleUpload.feature index 201d1f0dac6..6019abaed90 100644 --- a/tests/acceptance/features/cliCommands/staleUpload.feature +++ b/tests/acceptance/features/cliCommands/staleUpload.feature @@ -80,3 +80,27 @@ Feature: stale upload via CLI command Total stale nodes: 1 """ And there should be "0" stale uploads of space "Personal" owned by user "Alice" + + @issue-11296 + Scenario: resume all stale uploads + Given the config "POSTPROCESSING_DELAY" has been set to "10s" + And user "Alice" has uploaded file with content "some content" to "textfile.txt" + And the administrator has stopped the server + And the administrator has created stale upload + And the administrator has started the server + When the administrator resumes all the stale uploads + Then the command should be successful + And the CLI response should contain these entries: + | textfile.txt | + + @issue-11296 + Scenario: restart all stale uploads + Given the config "POSTPROCESSING_DELAY" has been set to "10s" + And user "Alice" has uploaded file with content "some content" to "textfile.txt" + And the administrator has stopped the server + And the administrator has created stale upload + And the administrator has started the server + When the administrator restarts all the stale uploads + Then the command should be successful + And the CLI response should contain these entries: + | textfile.txt |