From b4801f0bc76316c7e41862c8c7f19053381001cd Mon Sep 17 00:00:00 2001 From: Prajwol Amatya Date: Thu, 19 Jun 2025 17:00:23 +0545 Subject: [PATCH] add test for restart expired upload session --- tests/acceptance/bootstrap/CliContext.php | 14 ++++++++++++++ .../features/cliCommands/uploadSessions.feature | 13 +++++++++++++ 2 files changed, 27 insertions(+) diff --git a/tests/acceptance/bootstrap/CliContext.php b/tests/acceptance/bootstrap/CliContext.php index 38554cba734..f06dad8c555 100644 --- a/tests/acceptance/bootstrap/CliContext.php +++ b/tests/acceptance/bootstrap/CliContext.php @@ -931,4 +931,18 @@ class CliContext implements Context { ]; $this->featureContext->setResponse(CliHelper::runCommand($body)); } + + /** + * @When the administrator restarts the expired upload sessions using the CLI + * + * @return void + * @throws GuzzleException + */ + public function theAdministratorRestartsTheExpiredUploadSessionsUsingTheCLI(): void { + $command = "storage-users uploads sessions --expired --restart --json"; + $body = [ + "command" => $command, + ]; + $this->featureContext->setResponse(CliHelper::runCommand($body)); + } } diff --git a/tests/acceptance/features/cliCommands/uploadSessions.feature b/tests/acceptance/features/cliCommands/uploadSessions.feature index 71744883d95..0fd8a4e413f 100644 --- a/tests/acceptance/features/cliCommands/uploadSessions.feature +++ b/tests/acceptance/features/cliCommands/uploadSessions.feature @@ -177,3 +177,16 @@ Feature: List upload sessions via CLI command | file.txt | When the administrator waits for "3" seconds Then the content of file "file.txt" for user "Alice" should be "upload content" + + + Scenario: restart expired upload sessions + Given a file "large.zip" with the size of "2GB" has been created locally + And the config "STORAGE_USERS_UPLOAD_EXPIRATION" has been set to "1" + And user "Alice" has uploaded a file from "filesForUpload/textfile.txt" to "file.txt" via TUS inside of the space "Personal" using the WebDAV API + And user "Alice" has tried to upload file "filesForUpload/large.zip" to "large.zip" inside space "Personal" via TUS + When the administrator restarts the expired upload sessions using the CLI + Then the command should be successful + And the CLI response should contain these entries: + | large.zip | + And the CLI response should not contain these entries: + | file.txt |