Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tests-only] adjust tests for EOS storage #37796

Merged
merged 2 commits into from
Oct 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 52 additions & 7 deletions tests/TestHelpers/OcisHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
* @package TestHelpers
*/
class OcisHelper {

/**
* @return bool
*/
Expand All @@ -46,10 +45,32 @@ public static function isTestingOnReva() {
}

/**
* @return bool
* @return bool|string false if no command given or the command as string
*/
public static function getDeleteUserDataCommand() {
return (\getenv("DELETE_USER_DATA_CMD"));
$cmd = \getenv("DELETE_USER_DATA_CMD");
if (\trim($cmd) === "") {
return false;
}
return $cmd;
}

/**
* @return string
* @throws \Exception
*/
public static function getStorageDriver() {
$storageDriver = (\getenv("STORAGE_DRIVER"));
if ($storageDriver === false) {
return "OWNCLOUD";
}
if ($storageDriver !== "OCIS" && $storageDriver !== "EOS" && $storageDriver !== "OWNCLOUD") {
throw new \Exception(
"Invalid storage driver. " .
"STORAGE_DRIVER must be OCIS|EOS|OWNCLOUD"
);
}
return $storageDriver;
}

/**
Expand All @@ -59,12 +80,18 @@ public static function getDeleteUserDataCommand() {
*/
public static function deleteRevaUserData($user = "") {
$deleteCmd = self::getDeleteUserDataCommand();
if ($deleteCmd !== false) {
$deleteCmd = \sprintf($deleteCmd, $user);
\exec($deleteCmd);
} else {
if ($deleteCmd === false) {
self::recurseRmdir(self::getOcisRevaDataRoot() . $user);
return;
}
if (self::getStorageDriver() === "EOS") {
$deleteCmd = \str_replace(
"%s", $user[0] . '/' . $user, $deleteCmd
);
} else {
$deleteCmd = \sprintf($deleteCmd, $user);
}
\exec($deleteCmd);
}

/**
Expand Down Expand Up @@ -219,4 +246,22 @@ private static function recurseRmdir($dir) {
}
return true;
}

/**
* On Eos storage backend when the user data is cleared after test run
* Running another test immediately fails. So Send this request to create user home directory
*
* @param string $baseUrl
* @param string $user
* @param string $password
*
* @return void
*/
public static function createEOSStorageHome($baseUrl, $user, $password) {
HttpRequestHelper::get(
$baseUrl . "/ocs/v2.php/apps/notifications/api/v1/notifications",
$user,
$password
);
}
}
8 changes: 4 additions & 4 deletions tests/acceptance/features/apiFavorites/favorites.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Feature: favorite
And user "Alice" has created folder "/PARENT"
And user "Alice" has uploaded file with content "some data" to "/PARENT/parent.txt"

@skipOnOcis-EOS-Storage @issue-ocis-reva-276
@issue-ocis-reva-276
Scenario Outline: Favorite a folder
Given using <dav_version> DAV path
When user "Alice" favorites element "/FOLDER" using the WebDAV API
Expand All @@ -28,7 +28,7 @@ Feature: favorite
| old |
| new |

@skipOnOcis-EOS-Storage @issue-ocis-reva-276
@issue-ocis-reva-276
Scenario Outline: Favorite and unfavorite a folder
Given using <dav_version> DAV path
When user "Alice" favorites element "/FOLDER" using the WebDAV API
Expand All @@ -44,7 +44,7 @@ Feature: favorite
| old |
| new |

@smokeTest @skipOnOcis-EOS-Storage @issue-ocis-reva-276
@smokeTest @issue-ocis-reva-276
Scenario Outline: Favorite a file
Given using <dav_version> DAV path
When user "Alice" favorites element "/textfile0.txt" using the WebDAV API
Expand All @@ -59,7 +59,7 @@ Feature: favorite
| old |
| new |

@smokeTest @skipOnOcis-EOS-Storage @issue-ocis-reva-276
@smokeTest @issue-ocis-reva-276
Scenario Outline: Favorite and unfavorite a file
Given using <dav_version> DAV path
When user "Alice" favorites element "/textfile0.txt" using the WebDAV API
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/features/apiMain/checksums.feature
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ Feature: checksums
Then the HTTP status code should be "400"
And the content of file "/textfile0.txt" for user "Brian" should be "ownCloud test text file 0" plus end-of-line

@issue-ocis-reva-214 @skipOnOcis-EOS-Storage
@issue-ocis-reva-214
Scenario Outline: Uploading a file with checksum should work for file with special characters
When user "Alice" uploads file "filesForUpload/textfile.txt" to <renamed_file> with checksum "MD5:d70b40f177b14b470d1756a3c12b963a" using the WebDAV API
Then the HTTP status code should be "201"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Feature: sharing
| 1 | 100 |
| 2 | 200 |

@skipOnOcis-EOS-Storage @issue-ocis-reva-301 @issue-ocis-reva-302
@issue-ocis-reva-301 @issue-ocis-reva-302
Scenario Outline: Creating a share of a file with a user and asking for various permission combinations
Given using OCS API version "<ocs_api_version>"
And user "Brian" has been created with default attributes and without skeleton files
Expand Down Expand Up @@ -130,7 +130,7 @@ Feature: sharing
| 1 | 200 |
| 2 | 400 |

@skipOnOcis-EOS-Storage @issue-ocis-reva-301
@issue-ocis-reva-301
Scenario Outline: Creating a share of a folder with a user, the default permissions are all permissions(31)
Given using OCS API version "<ocs_api_version>"
And user "Brian" has been created with default attributes and without skeleton files
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@api @files_sharing-app-required @public_link_share-feature-required @skipOnOcis-EOS-Storage @issue-ocis-reva-315 @issue-ocis-reva-316
@api @files_sharing-app-required @public_link_share-feature-required @issue-ocis-reva-315 @issue-ocis-reva-316

Feature: changing a public link share

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@api @files_sharing-app-required @public_link_share-feature-required @skipOnOcis-EOS-Storage @issue-ocis-reva-315 @issue-ocis-reva-316
@api @files_sharing-app-required @public_link_share-feature-required @issue-ocis-reva-315 @issue-ocis-reva-316

Feature: create a public link share

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@api @files_sharing-app-required @public_link_share-feature-required @skipOnOcis-EOS-Storage @issue-ocis-reva-315 @issue-ocis-reva-316
@api @files_sharing-app-required @public_link_share-feature-required @issue-ocis-reva-315 @issue-ocis-reva-316

Feature: upload to a public link share

Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/features/apiVersions/fileVersions.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@api @files_versions-app-required @skipOnOcis-EOS-Storage @issue-ocis-reva-275
@api @files_versions-app-required @issue-ocis-reva-275

Feature: dav-versions

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@api @files_versions-app-required @skipOnOcis-EOS-Storage @issue-ocis-reva-275 @notToImplementOnOCIS
@api @files_versions-app-required @issue-ocis-reva-275 @notToImplementOnOCIS

Feature: dav-versions

Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/features/apiWebdavMove2/moveFile.feature
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ Feature: move (rename) file
| *a@b#c$e%f&g* |
| 1 2 3##.## |

@skipOnOcis-EOS-Storage @issue-ocis-reva-265
@issue-ocis-reva-265
#after fixing the issues merge this Scenario into the one above
Scenario Outline: renaming to a file with special characters
When user "Alice" moves file "/textfile0.txt" to "/<renamed_file>" using the WebDAV API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Feature: delete folder
| old |
| new |

@skipOnOcis-EOS-Storage @issue-ocis-reva-269
@issue-ocis-reva-269
Scenario Outline: delete a folder when 2 folder exist with different case
Given using <dav_version> DAV path
And user "Alice" creates folder "/parent" using the WebDAV API
Expand All @@ -32,7 +32,7 @@ Feature: delete folder
| old |
| new |

@skipOnOcis-EOS-Storage @issue-ocis-reva-269
@issue-ocis-reva-269
Scenario Outline: delete a sub-folder
Given using <dav_version> DAV path
And user "Alice" creates folder "/PARENT/CHILD" using the WebDAV API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Feature: download file
Then the HTTP status code should be "207"
And the size of the file should be "19"

@skipOnOcis-EOS-Storage @issue-ocis-reva-98
@issue-ocis-reva-98
Scenario Outline: Get the content-length response header of a pdf file
Given using <dav_version> DAV path
And user "Alice" has uploaded file "filesForUpload/simple.pdf" to "/simple.pdf"
Expand All @@ -103,7 +103,7 @@ Feature: download file
| old |
| new |

@skipOnOcis-EOS-Storage @issue-ocis-reva-98
@issue-ocis-reva-98
Scenario Outline: Get the content-length response header of an image file
Given using <dav_version> DAV path
And user "Alice" has uploaded file "filesForUpload/testavatar.png" to "/testavatar.png"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Feature: create folder
Given using OCS API version "1"
And user "Alice" has been created with default attributes and without skeleton files

@skipOnOcis-EOS-Storage @issue-ocis-reva-269
@issue-ocis-reva-269
Scenario Outline: create a folder
Given using <dav_version> DAV path
When user "Alice" creates folder "<folder_name>" using the WebDAV API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Feature: set file properties
Given using OCS API version "1"
And user "Alice" has been created with default attributes and without skeleton files

@smokeTest @skipOnOcis-EOS-Storage @issue-ocis-reva-276
@smokeTest @issue-ocis-reva-276
Scenario Outline: Setting custom DAV property and reading it
Given using <dav_version> DAV path
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/testcustomprop.txt"
Expand All @@ -32,7 +32,7 @@ Feature: set file properties
| old |
| new |

@skipOnOcis-EOS-Storage @issue-ocis-reva-276
@issue-ocis-reva-276
Scenario Outline: Setting custom DAV property and reading it after the file is renamed
Given using <dav_version> DAV path
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/testcustompropwithmove.txt"
Expand Down Expand Up @@ -63,7 +63,7 @@ Feature: set file properties
| old |
| new |

@skipOnOcis-EOS-Storage @issue-ocis-reva-276
@issue-ocis-reva-276
Scenario Outline: Setting custom DAV property using one endpoint and reading it with other endpoint
Given using <action_dav_version> DAV path
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/testnewold.txt"
Expand All @@ -76,7 +76,7 @@ Feature: set file properties
| old | new |
| new | old |

@skipOnOcis-EOS-Storage @issue-ocis-reva-276
@issue-ocis-reva-276
Scenario: Setting custom DAV property using an old endpoint and reading it using a new endpoint
Given using old DAV path
Given user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/testoldnew.txt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Feature: get file properties
| new | /नेपाली | नेपाली |
| new | /folder #2.txt | file #2.txt |

@skipOnOcis-EOS-Storage @issue-ocis-reva-265
@issue-ocis-reva-265
#after fixing all issues delete this Scenario and merge with the one above
Scenario Outline: Do a PROPFIND of various files inside various folders
Given using <dav_version> DAV path
Expand Down
4 changes: 2 additions & 2 deletions tests/acceptance/features/apiWebdavUpload1/uploadFile.feature
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Feature: upload file
| new | "C++ file.cpp" |
| new | "file #2.txt" |

@skipOnOcis-EOS-Storage @issue-ocis-reva-265
@issue-ocis-reva-265
#after fixing all issues delete this Scenario and merge with the one above
Scenario Outline: upload a file and check download content
Given using <dav_version> DAV path
Expand Down Expand Up @@ -83,7 +83,7 @@ Feature: upload file
| new | /नेपाली | नेपाली |
| new | /folder #2.txt | file #2.txt |

@skipOnOcis-EOS-Storage @issue-ocis-reva-265
@issue-ocis-reva-265
#after fixing all issues delete this Scenario and merge with the one above
Scenario Outline: upload a file into a folder and check download content
Given using <dav_version> DAV path
Expand Down
Loading