From de27727b7d5708dddb43b73e8c6ae02b845aded2 Mon Sep 17 00:00:00 2001 From: prashant-gurung899 Date: Thu, 11 Jul 2024 15:27:02 +0545 Subject: [PATCH] add test to remove versions using CLI command Signed-off-by: prashant-gurung899 --- .../acceptance/features/bootstrap/CliContext.php | 15 +++++++++++++++ .../features/cliCommands/removeVersions.feature | 13 +++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 tests/acceptance/features/cliCommands/removeVersions.feature diff --git a/tests/acceptance/features/bootstrap/CliContext.php b/tests/acceptance/features/bootstrap/CliContext.php index eccd28a01d9..01db60cb4c1 100644 --- a/tests/acceptance/features/bootstrap/CliContext.php +++ b/tests/acceptance/features/bootstrap/CliContext.php @@ -82,6 +82,7 @@ public function theAdministratorResetsThePasswordOfUserUsingTheCLI(string $statu "command" => $command, "inputs" => [$password, $password] ]; + $this->featureContext->setResponse(CliHelper::runCommand($body)); if ($status === "non-existing") { return; @@ -103,6 +104,20 @@ public function theAdministratorChecksTheBackupConsistencyUsingTheCli():void { $this->featureContext->setResponse(CliHelper::runCommand($body)); } + /** + * @When the administrator removes all versions of resources using the CLI + * + * @return void + */ + public function theAdministratorRemovesAllVersionsOfResources() { + $path = $this->featureContext->getStorageUsersRoot(); + $command = "revisions purge -p $path --dry-run=false"; + $body = [ + "command" => $command + ]; + $this->featureContext->setResponse(CliHelper::runCommand($body)); + } + /** * @Then the command should be successful * diff --git a/tests/acceptance/features/cliCommands/removeVersions.feature b/tests/acceptance/features/cliCommands/removeVersions.feature new file mode 100644 index 00000000000..aaa8f0b77a7 --- /dev/null +++ b/tests/acceptance/features/cliCommands/removeVersions.feature @@ -0,0 +1,13 @@ +@env-config +Feature: remove versions via CLI command + + + Scenario: remove old versions of resources in storage + Given user "Alice" has been created with default attributes and without skeleton files + And user "Alice" has uploaded file with content "This is version 1" to "textfile.txt" + And user "Alice" has uploaded file with content "This is version 2" to "textfile.txt" + And user "Alice" has uploaded file with content "This is version 3" to "textfile.txt" + And the administrator has stopped the server + When the administrator removes all versions of resources using the CLI + Then the command should be successful + And the command output should contain "✅ Deleted 2 revisions (6 files / 2 blobs)"