Skip to content

Commit d8cf3c0

Browse files
committed
add tests for post processing command for different steps
Signed-off-by: nabim777 <[email protected]>
1 parent a1f0ac5 commit d8cf3c0

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed

tests/acceptance/bootstrap/CliContext.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,40 @@ public function theAdministratorResumesOrRestartsUploadSessionOfFileUsingPostpro
525525
$this->featureContext->setResponse(CliHelper::runCommand($body));
526526
}
527527

528+
/**
529+
* @When /^the administrator resumes all uploads session using post processing command$/
530+
*
531+
* @return void
532+
* @throws JsonException
533+
*/
534+
public function theAdministratorResumesAllUploadsSessionUsingPostprocessingCommand(): void {
535+
$command = "postprocessing resume";
536+
var_dump($command);
537+
$body = [
538+
"command" => $command,
539+
];
540+
$this->featureContext->setResponse(CliHelper::runCommand($body));
541+
}
542+
543+
/**
544+
* @When /^the administrator resumes all uploads session in (finished|virusscan) step using post processing command$/
545+
*
546+
* @param string $step
547+
*
548+
* @return void
549+
* @throws JsonException
550+
*/
551+
public function theAdministratorResumesAllUploadsSessionInFinishedOrVirusScanStepUsingPostprocessingCommand(
552+
string $step,
553+
): void {
554+
$command = "postprocessing resume -s $step";
555+
var_dump($command);
556+
$body = [
557+
"command" => $command,
558+
];
559+
$this->featureContext->setResponse(CliHelper::runCommand($body));
560+
}
561+
528562
/**
529563
* @Then /^the CLI response (should|should not) contain these entries:$/
530564
*

tests/acceptance/features/cliCommands/uploadSessions.feature

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,3 +245,58 @@ Feature: List upload sessions via CLI command
245245
When the administrator waits for "3" seconds
246246
Then for user "Alice" file "file2.txt" of space "Personal" should be in postprocessing
247247
And the content of file "file1.txt" for user "Alice" should be "uploaded content"
248+
249+
250+
Scenario: resume all failed upload using postprocessing command
251+
Given the config "POSTPROCESSING_DELAY" has been set to "3s"
252+
And user "Alice" has uploaded file with content "uploaded content" to "file1.txt"
253+
And user "Alice" has uploaded file with content "uploaded content" to "file2.txt"
254+
And the administrator has waited for "1" seconds
255+
And the administrator has stopped the server
256+
And the administrator has started the server
257+
When the administrator waits for "3" seconds
258+
Then for user "Alice" file "file1.txt" of space "Personal" should be in postprocessing
259+
And for user "Alice" file "file2.txt" of space "Personal" should be in postprocessing
260+
When the administrator resumes all uploads session using post processing command
261+
Then the command should be successful
262+
When the administrator waits for "3" seconds
263+
And the content of file "file1.txt" for user "Alice" should be "uploaded content"
264+
And the content of file "file2.txt" for user "Alice" should be "uploaded content"
265+
266+
267+
Scenario: resume all failed upload on finished step using postprocessing command
268+
Given the config "POSTPROCESSING_DELAY" has been set to "3s"
269+
And user "Alice" has uploaded file with content "uploaded content" to "file1.txt"
270+
And user "Alice" has uploaded file with content "uploaded content" to "file2.txt"
271+
And the administrator has waited for "1" seconds
272+
And the administrator has stopped the server
273+
And the administrator has started the server
274+
When the administrator waits for "3" seconds
275+
Then for user "Alice" file "file1.txt" of space "Personal" should be in postprocessing
276+
And for user "Alice" file "file2.txt" of space "Personal" should be in postprocessing
277+
When the administrator resumes all uploads session in finished step using post processing command
278+
Then the command should be successful
279+
When the administrator waits for "3" seconds
280+
And the content of file "file1.txt" for user "Alice" should be "uploaded content"
281+
And the content of file "file2.txt" for user "Alice" should be "uploaded content"
282+
283+
284+
# Scenario: resume all failed upload on virus scan step using postprocessing command
285+
# Given the following configs have been set:
286+
# | config | value |
287+
# | POSTPROCESSING_STEPS | virusscan |
288+
# | ANTIVIRUS_INFECTED_FILE_HANDLING | abort |
289+
# | POSTPROCESSING_DELAY | 10s |
290+
# And user "Alice" has uploaded file with content "uploaded content" to "file1.txt"
291+
# And user "Alice" has uploaded file with content "uploaded content" to "file2.txt"
292+
# And the administrator has waited for "1" seconds
293+
# And the administrator has stopped the server
294+
# And the administrator has started the server
295+
# When the administrator waits for "3" seconds
296+
# Then for user "Alice" file "file1.txt" of space "Personal" should be in postprocessing
297+
# And for user "Alice" file "file2.txt" of space "Personal" should be in postprocessing
298+
# When the administrator resumes all uploads session in virusscan step using post processing command
299+
# Then the command should be successful
300+
# When the administrator waits for "3" seconds
301+
# And the content of file "file1.txt" for user "Alice" should be "uploaded content"
302+
# And the content of file "file2.txt" for user "Alice" should be "uploaded content"

0 commit comments

Comments
 (0)