Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests-only][full-ci] adding test to remove old versions of resources using cli command #9584

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/acceptance/config/behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ default:
- FeatureContext: *common_feature_context_params
- CliContext:
- OcisConfigContext:
- FilesVersionsContext:
- SharingNgContext:

extensions:
Expand Down
15 changes: 15 additions & 0 deletions tests/acceptance/features/bootstrap/CliContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -103,6 +104,20 @@ public function theAdministratorChecksTheBackupConsistencyUsingTheCli():void {
$this->featureContext->setResponse(CliHelper::runCommand($body));
}

/**
* @When the administrator removes all the file versions 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
*
Expand Down
15 changes: 15 additions & 0 deletions tests/acceptance/features/cliCommands/removeFileVersions.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@env-config
Feature: remove file versions via CLI command


Scenario: remove all file versions
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"
When the administrator removes all the file versions using the CLI
Then the command should be successful
And the command output should contain "✅ Deleted 2 revisions (6 files / 2 blobs)"
When user "Alice" gets the number of versions of file "textfile.txt"
Then the HTTP status code should be "207"
And the number of versions should be "0"