add test to clean upload sessions that are not processing

This commit is contained in:
Prajwol Amatya
2024-10-08 09:54:26 +05:45
parent 3f71d37ad6
commit 0a12fd9834
2 changed files with 29 additions and 4 deletions

View File

@@ -257,12 +257,19 @@ class CliContext implements Context {
}
/**
* @When the administrator cleans all expired upload sessions
* @When the administrator cleans upload sessions with the following flags:
*
* @param TableNode $table
*
* @return void
*/
public function theAdministratorCleansAllExpiredUploadSessions(): void {
$command = "storage-users uploads sessions --expired --clean --json";
public function theAdministratorCleansUploadSessionsWithTheFollowingFlags(TableNode $table): void {
$flag = "";
foreach ($table->getRows() as $row) {
$flag .= "--$row[0] ";
}
$flagString = trim($flag);
$command = "storage-users uploads sessions $flagString --clean --json";
$body = [
"command" => $command
];

View File

@@ -76,7 +76,8 @@ Feature: List upload sessions via CLI command
And the config "STORAGE_USERS_UPLOAD_EXPIRATION" has been set to "0"
And user "Alice" has uploaded file with content "upload content" to "/file2.txt"
And user "Alice" has uploaded file with content "upload content" to "/file3.txt"
When the administrator cleans all expired upload sessions
When the administrator cleans upload sessions with the following flags:
| expired |
Then the command should be successful
And the CLI response should contain these entries:
| file2.txt |
@@ -107,3 +108,20 @@ Feature: List upload sessions via CLI command
| file1.txt |
And the CLI response should not contain these entries:
| file2.txt |
Scenario: clean all upload sessions that are not in post-processing
Given the following configs have been set:
| config | value |
| POSTPROCESSING_STEPS | virusscan |
| ANTIVIRUS_INFECTED_FILE_HANDLING | abort |
And user "Alice" has uploaded file "filesForUpload/filesWithVirus/eicar.com" to "/virusFile.txt"
And the config "POSTPROCESSING_DELAY" has been set to "10s"
And user "Alice" has uploaded file with content "upload content" to "/file1.txt"
When the administrator cleans upload sessions with the following flags:
| processing=false |
Then the command should be successful
And the CLI response should contain these entries:
| virusFile.txt |
And the CLI response should not contain these entries:
| file1.txt |