From 29b9f9b07de15b9f8abc0b221b208ca96032a503 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Tue, 20 Aug 2024 18:12:41 +0545 Subject: [PATCH] test: fix COPY to mountpoint tests --- ...ected-failures-localAPI-on-OCIS-storage.md | 5 ----- .../apiArchiver/downloadByPath.feature | 6 +++--- .../apiSpacesShares/copySpaces.feature | 20 ++++++++++--------- .../features/bootstrap/ArchiverContext.php | 9 +++++---- 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index d545cd63ea..a30aabf4b7 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -13,11 +13,6 @@ The expected failures in this file are from features in the owncloud/ocis repo. - [apiArchiver/downloadByPath.feature:171](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiArchiver/downloadByPath.feature#L171) - [apiArchiver/downloadByPath.feature:172](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiArchiver/downloadByPath.feature#L172) -#### [Shared mount folder gets deleted when overwritten by a file from personal space](https://github.com/owncloud/ocis/issues/7208) - -- [apiSpacesShares/copySpaces.feature:696](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/copySpaces.feature#L696) -- [apiSpacesShares/copySpaces.feature:715](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/copySpaces.feature#L715) - #### [PATCH request for TUS upload with wrong checksum gives incorrect response](https://github.com/owncloud/ocis/issues/1755) - [apiSpacesShares/shareUploadTUS.feature:283](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature#L283) diff --git a/tests/acceptance/features/apiArchiver/downloadByPath.feature b/tests/acceptance/features/apiArchiver/downloadByPath.feature index a0394f75e3..36936d8ef4 100644 --- a/tests/acceptance/features/apiArchiver/downloadByPath.feature +++ b/tests/acceptance/features/apiArchiver/downloadByPath.feature @@ -13,7 +13,7 @@ Feature: download multiple resources bundled into an archive @issue-4637 Scenario Outline: download a single file Given user "Alice" has uploaded file with content "some data" to "/textfile0.txt" - When user "Alice" downloads the archive of "/home/textfile0.txt" using the resource path and setting these headers + When user "Alice" downloads the archive of "/home/textfile0.txt" using the resource path and setting these headers: | header | value | | User-Agent | | Then the HTTP status code should be "200" @@ -30,7 +30,7 @@ Feature: download multiple resources bundled into an archive Given user "Alice" has created folder "my_data" And user "Alice" has uploaded file with content "some data" to "/my_data/textfile0.txt" And user "Alice" has uploaded file with content "more data" to "/my_data/an_other_file.txt" - When user "Alice" downloads the archive of "/home/my_data" using the resource path and setting these headers + When user "Alice" downloads the archive of "/home/my_data" using the resource path and setting these headers: | header | value | | User-Agent | | Then the HTTP status code should be "200" @@ -156,7 +156,7 @@ Feature: download multiple resources bundled into an archive | shareType | user | | permissionsRole | Viewer | And user "Brian" has a share "more_data" synced - When user "Brian" downloads the archive of "/home/Shares" using the resource path and setting these headers + When user "Brian" downloads the archive of "/home/Shares" using the resource path and setting these headers: | header | value | | User-Agent | | Then the HTTP status code should be "200" diff --git a/tests/acceptance/features/apiSpacesShares/copySpaces.feature b/tests/acceptance/features/apiSpacesShares/copySpaces.feature index 8f54594726..43f219147e 100644 --- a/tests/acceptance/features/apiSpacesShares/copySpaces.feature +++ b/tests/acceptance/features/apiSpacesShares/copySpaces.feature @@ -706,10 +706,12 @@ Feature: copy file | permissionsRole | Editor | And user "Alice" has a share "BRIAN-Folder" synced When user "Alice" copies file "/textfile1.txt" from space "Personal" to "/BRIAN-Folder" inside space "Shares" using the WebDAV API - Then the HTTP status code should be "204" - And for user "Alice" the content of the file "/BRIAN-Folder" of the space "Shares" should be "ownCloud test text file 1" - And as "Alice" file "/textfile1.txt" should exist - And user "Alice" should not have any received shares + Then the HTTP status code should be "400" + And as "Alice" folder "Shares/BRIAN-Folder/sample-folder" should exist + And as "Brian" folder "BRIAN-Folder/sample-folder" should exist + But as "Alice" file "Shares/BRIAN-Folder" should not exist + And as "Alice" file "Shares/textfile1.txt" should not exist + And user "Alice" should have a share "BRIAN-Folder" shared by user "Brian" @issue-7208 Scenario: copy a folder over the top of an existing file received as a user share @@ -725,11 +727,11 @@ Feature: copy file | permissionsRole | File Editor | And user "Alice" has a share "sharedfile1.txt" synced When user "Alice" copies folder "/FOLDER" from space "Personal" to "/sharedfile1.txt" inside space "Shares" using the WebDAV API - Then the HTTP status code should be "204" - And as "Alice" folder "/FOLDER/sample-folder" should exist - And for user "Alice" folder "/sharedfile1.txt" of the space "Shares" should contain these files: - | /sample-folder | - And user "Alice" should not have any received shares + Then the HTTP status code should be "400" + And for user "Alice" the content of the file "sharedfile1.txt" of the space "Shares" should be "file to share" + And for user "Brian" the content of the file "sharedfile1.txt" of the space "Personal" should be "file to share" + But as "Alice" folder "Shares/FOLDER/sample-folder" should not exist + And user "Alice" should have a share "sharedfile1.txt" shared by user "Brian" Scenario: copy a folder into another folder at different level which is received as a user share diff --git a/tests/acceptance/features/bootstrap/ArchiverContext.php b/tests/acceptance/features/bootstrap/ArchiverContext.php index 55957f1028..c31865b6be 100644 --- a/tests/acceptance/features/bootstrap/ArchiverContext.php +++ b/tests/acceptance/features/bootstrap/ArchiverContext.php @@ -86,12 +86,13 @@ class ArchiverContext implements Context { * @return void */ public function removeDir(string $dir): void { - $items = \glob("$dir/*"); + $items = array_diff(scandir($dir), ['.', '..']); foreach ($items as $item) { - if (\is_dir($item)) { - $this->removeDir($item); + $itemPath = $dir . DIRECTORY_SEPARATOR . $item; + if (\is_dir($itemPath)) { + $this->removeDir($itemPath); } else { - \unlink($item); + \unlink($itemPath); } } \rmdir($dir);