Merge pull request #11439 from owncloud/test/post-processing-tests

[tests-only] Fix post processing test scenarios
This commit is contained in:
Sawjan Gurung authored and GitHub committed 2025-06-19 10:13:42 +05:45
commit 9fc043abc5
5 files changed
+80 -12

No files matched your search

@@ -3006,7 +3006,8 @@ class FeatureContext extends BehatVariablesContext {
}
/**
* @Given the system waits for :arg1 seconds
* @Given the administrator has waited for :seconds seconds
* @When the administrator waits for :seconds seconds
*
* @param string $seconds
*
+40
View File
@@ -1035,6 +1035,46 @@ trait WebDav {
$this->checkDownloadedContentMatches($content->getRaw(), '', $response);
}
/**
* @When for user :user file :fileName of space :space should be in postprocessing
*
* @param string $user
* @param string $fileName
* @param string $space
*
* @return void
*/
public function forUserFileShouldBeInPostprocessing(
string $user,
string $fileName,
string $space,
): void {
$user = $this->getActualUsername($user);
$password = $this->getPasswordForUser($user);
$davPathVersion = $this->getDavPathVersion();
$suffixPath = $user;
if ($davPathVersion === WebDavHelper::DAV_VERSION_SPACES) {
$spaceId = $this->spacesContext->getSpaceIdByName($user, $space);
$suffixPath = $spaceId;
}
$davPath = WebDavHelper::getDavPath($davPathVersion, $suffixPath, "files");
$fullUrl = $this->getBaseUrl() . "/$davPath/$fileName";
$response = HttpRequestHelper::sendRequestOnce(
$fullUrl,
"GET",
$user,
$password,
);
Assert::assertEquals(
425,
$response->getStatusCode(),
__METHOD__
. " : File '$fileName' not in postprocessing."
. " Expected status code to be '425', but got '"
. $response->getStatusCode() . "'"
);
}
/**
* @When user :user downloads file :fileName using the WebDAV API
* @When user :user tries to download file :fileName using the WebDAV API
@@ -382,6 +382,7 @@ The expected failures in this file are from features in the owncloud/ocis repo.
- [apiActivities/activitiesByFileId.feature:2015](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiActivities/activitiesByFileId.feature#L2015)
#### [Activity. no event for deleting a file using file-id](https://github.com/owncloud/ocis/issues/10328)
- [apiActivities/activitiesByFileId.feature:2190](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiActivities/activitiesByFileId.feature#L2190)
#### Uploaders are not allowed to `MOVE`
@@ -394,7 +395,7 @@ The expected failures in this file are from features in the owncloud/ocis repo.
#### [[CLI] Error while resuming an upload](https://github.com/owncloud/ocis/issues/11290)
- [cliCommands/uploadSessions.feature:156](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/cliCommands/uploadSessions.feature#L156)
- [cliCommands/uploadSessions.feature:173](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/cliCommands/uploadSessions.feature#L173)
Note: always have an empty line at the end of this file.
The bash script that processes this file requires that the last line has a newline on the end.
@@ -108,7 +108,7 @@ Feature: trashbin
And user "Alice" has created a folder "uploadFolder" in space "Newspace"
And user "Alice" has uploaded a file inside space "Newspace" with content "hello world" to "text.txt"
And user "Alice" has removed the file "text.txt" from space "Newspace"
And the system waits for "1" seconds
And the administrator waits for "1" seconds
When the administrator purges the expired trash resources
Then there should be no trashed resources of space "Personal" owned by user "Alice"
And there should be "1" trashed resources of space "Newspace" owned by user "Alice":
@@ -130,7 +130,7 @@ Feature: trashbin
And user "Alice" has created a folder "uploadFolder" in space "Newspace"
And user "Alice" has uploaded a file inside space "Newspace" with content "hello world" to "text.txt"
And user "Alice" has removed the file "text.txt" from space "Newspace"
And the system waits for "1" seconds
And the administrator waits for "1" seconds
When the administrator purges the expired trash resources
Then there should be no trashed resources of space "Newspace" owned by user "Alice"
And there should be "1" trashed resources of space "Personal" owned by user "Alice":
@@ -29,7 +29,7 @@ Feature: List upload sessions via CLI command
| 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 the system waits for "5" seconds
And the administrator has waited for "2" seconds
And user "Alice" has uploaded file with content "uploaded content" to "/file1.txt"
And user "Alice" has uploaded file with content "uploaded content" to "/file2.txt"
When the administrator lists all the upload sessions with flag "processing"
@@ -88,27 +88,44 @@ Feature: List upload sessions via CLI command
Scenario: restart upload sessions that are in postprocessing
Given user "Alice" has uploaded file with content "upload content" to "/file1.txt"
And the config "POSTPROCESSING_DELAY" has been set to "10s"
Given the config "POSTPROCESSING_DELAY" has been set to "3s"
And user "Alice" has uploaded file with content "upload content" to "/file1.txt"
And user "Alice" has uploaded file with content "upload content" to "/file2.txt"
And the administrator has waited for "1" seconds
And the administrator has stopped the server
And the administrator has started the server
When the administrator waits for "3" seconds
Then for user "Alice" file "file1.txt" of space "Personal" should be in postprocessing
And for user "Alice" file "file2.txt" of space "Personal" should be in postprocessing
When the administrator restarts the upload sessions that are in postprocessing
Then the command should be successful
And the CLI response should contain these entries:
| file2.txt |
And the CLI response should not contain these entries:
| file1.txt |
When the administrator waits for "3" seconds
Then the content of file "file1.txt" for user "Alice" should be "upload content"
And the content of file "file2.txt" for user "Alice" should be "upload content"
Scenario: restart upload sessions of a single file
Given the config "POSTPROCESSING_DELAY" has been set to "10s"
And user "Alice" has uploaded file with content "upload content" to "/file1.txt"
And user "Alice" has uploaded file with content "upload content" to "/file2.txt"
Given the config "POSTPROCESSING_DELAY" has been set to "3s"
And user "Alice" has uploaded file with content "uploaded content" to "file1.txt"
And user "Alice" has uploaded file with content "uploaded content" to "file2.txt"
And the administrator has waited for "1" seconds
And the administrator has stopped the server
And the administrator has started the server
When the administrator waits for "3" seconds
Then for user "Alice" file "file1.txt" of space "Personal" should be in postprocessing
And for user "Alice" file "file2.txt" of space "Personal" should be in postprocessing
When the administrator restarts the upload sessions of file "file1.txt"
Then the command should be successful
And the CLI response should contain these entries:
| file1.txt |
And the CLI response should not contain these entries:
| file2.txt |
When the administrator waits for "3" seconds
Then for user "Alice" file "file2.txt" of space "Personal" should be in postprocessing
And the content of file "file1.txt" for user "Alice" should be "uploaded content"
Scenario: clean all upload sessions that are not in post-processing
@@ -154,11 +171,20 @@ Feature: List upload sessions via CLI command
@issue-11290
Scenario: resume all upload sessions
Given the config "POSTPROCESSING_DELAY" has been set to "10s"
Given the following configs have been set:
| config | value |
| POSTPROCESSING_STEPS | virusscan,delay |
| ANTIVIRUS_INFECTED_FILE_HANDLING | abort |
| POSTPROCESSING_DELAY | 3s |
And user "Alice" has uploaded file with content "upload content" to "file.txt"
And the administrator has waited for "1" seconds
And the administrator has stopped the server
And the administrator has started the server
When the administrator waits for "3" seconds
Then for user "Alice" file "file.txt" of space "Personal" should be in postprocessing
When the administrator resumes all the upload sessions using the CLI
Then the command should be successful
And the CLI response should contain these entries:
| file.txt |
When the administrator waits for "3" seconds
Then the content of file "file.txt" for user "Alice" should be "upload content"