diff options
author | Morris Jobke <hey@morrisjobke.de> | 2021-03-18 08:57:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-18 08:57:09 +0100 |
commit | 6401d882833aeea775d64b70bc8b46c881ea8161 (patch) | |
tree | adc6cfa53079a6c4a5db24c636140d4b66abc932 /build | |
parent | 5cdc3e9c9da5db8bf98c2786018941c412ffe146 (diff) | |
parent | 9ccabff6ba9a0e89d7128fbdd43d48fe7a68b11e (diff) | |
download | nextcloud-server-6401d882833aeea775d64b70bc8b46c881ea8161.tar.gz nextcloud-server-6401d882833aeea775d64b70bc8b46c881ea8161.zip |
Merge pull request #25331 from nextcloud/fix-valid-storages-removed-when-cleaning-remote-storages
Fix valid storages removed when cleaning remote storages
Diffstat (limited to 'build')
-rw-r--r-- | build/integration/features/bootstrap/FederationContext.php | 14 | ||||
-rw-r--r-- | build/integration/federation_features/cleanup-remote-storage.feature | 53 |
2 files changed, 67 insertions, 0 deletions
diff --git a/build/integration/features/bootstrap/FederationContext.php b/build/integration/features/bootstrap/FederationContext.php index 41581110bdf..359d3226b30 100644 --- a/build/integration/features/bootstrap/FederationContext.php +++ b/build/integration/features/bootstrap/FederationContext.php @@ -37,6 +37,20 @@ require __DIR__ . '/../../vendor/autoload.php'; class FederationContext implements Context, SnippetAcceptingContext { use WebDav; use AppConfiguration; + use CommandLine; + + /** + * @BeforeScenario + */ + public function cleanupRemoteStorages() { + // Ensure that dangling remote storages from previous tests will not + // interfere with the current scenario. + // The storages must be cleaned before each scenario; they can not be + // cleaned after each scenario, as this hook is executed before the hook + // that removes the users, so the shares would be still valid and thus + // the storages would not be dangling yet. + $this->runOcc(['sharing:cleanup-remote-storages']); + } /** * @Given /^User "([^"]*)" from server "(LOCAL|REMOTE)" shares "([^"]*)" with user "([^"]*)" from server "(LOCAL|REMOTE)"$/ diff --git a/build/integration/federation_features/cleanup-remote-storage.feature b/build/integration/federation_features/cleanup-remote-storage.feature new file mode 100644 index 00000000000..c782987cac0 --- /dev/null +++ b/build/integration/federation_features/cleanup-remote-storage.feature @@ -0,0 +1,53 @@ +Feature: cleanup-remote-storage + Background: + Given using api version "1" + + Scenario: cleanup remote storage with active storages + Given Using server "LOCAL" + And user "user0" exists + Given Using server "REMOTE" + And user "user1" exists + # Rename file so it has a unique name in the target server (as the target + # server may have its own /textfile0.txt" file) + And User "user1" copies file "/textfile0.txt" to "/remote-share.txt" + And User "user1" from server "REMOTE" shares "/remote-share.txt" with user "user0" from server "LOCAL" + And Using server "LOCAL" + # Accept and download the file to ensure that a storage is created for the + # federated share + And User "user0" from server "LOCAL" accepts last pending share + And As an "user0" + And Downloading file "/remote-share.txt" + And the HTTP status code should be "200" + When invoking occ with "sharing:cleanup-remote-storage" + Then the command was successful + And the command output contains the text "1 remote storage(s) need(s) to be checked" + And the command output contains the text "1 remote share(s) exist" + And the command output contains the text "no storages deleted" + + Scenario: cleanup remote storage with inactive storages + Given Using server "LOCAL" + And user "user0" exists + Given Using server "REMOTE" + And user "user1" exists + # Rename file so it has a unique name in the target server (as the target + # server may have its own /textfile0.txt" file) + And User "user1" copies file "/textfile0.txt" to "/remote-share.txt" + And User "user1" from server "REMOTE" shares "/remote-share.txt" with user "user0" from server "LOCAL" + And Using server "LOCAL" + # Accept and download the file to ensure that a storage is created for the + # federated share + And User "user0" from server "LOCAL" accepts last pending share + And As an "user0" + And Downloading file "/remote-share.txt" + And the HTTP status code should be "200" + And Using server "REMOTE" + And As an "user1" + And Deleting last share + And the OCS status code should be "100" + And the HTTP status code should be "200" + When Using server "LOCAL" + And invoking occ with "sharing:cleanup-remote-storage" + Then the command was successful + And the command output contains the text "1 remote storage(s) need(s) to be checked" + And the command output contains the text "0 remote share(s) exist" + And the command output contains the text "deleted 1 storage" |