Skip to content

Commit

Permalink
Fix test suite for eos tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dpakach committed Aug 13, 2020
1 parent 7da9d03 commit 92423bd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion tests/TestHelpers/OcisHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public static function getDeleteUserDataCommand() {
public static function deleteRevaUserData($user = "") {
$deleteCmd = self::getDeleteUserDataCommand();
if ($deleteCmd !== false) {
$deleteCmd = \sprintf($deleteCmd, $user);
$deleteCmd = \sprintf($deleteCmd, $user[0] . '/' . $user);
// var_dump($deleteCmd);
\exec($deleteCmd);
} else {
self::recurseRmdir(self::getOcisRevaDataRoot() . "/data/" . $user);
Expand Down
10 changes: 8 additions & 2 deletions tests/acceptance/features/bootstrap/Provisioning.php
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ public function usersHaveBeenCreated(
if (OcisHelper::isTestingOnOcis()) {
$attributesToCreateUser['username'] = $userAttributes['userid'];
if ($userAttributes['email'] === null) {
$attributesToCreateUser['email'] = $userAttributes['username'] . '@owncloud.org';
$attributesToCreateUser['email'] = $userAttributes['username'] ?? $userAttributes['userid'] . '@owncloud.org';
} else {
$attributesToCreateUser['email'] = $userAttributes['email'];
}
Expand Down Expand Up @@ -895,6 +895,10 @@ public function usersHaveBeenCreated(
$users = [];
$editData = [];
foreach ($usersAttributes as $userAttributes) {
// 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
HttpRequestHelper::get($this->getBaseUrl() . "/ocs/v2.php/apps/notifications/api/v1/notifications?format=json", $userAttributes['userid'], $userAttributes['password']);

\array_push($users, $userAttributes['userid']);
$this->addUserToCreatedUsersList($userAttributes['userid'], $userAttributes['password'], $userAttributes['displayName'], $userAttributes['email']);
if (isset($userAttributes['displayName'])) {
Expand Down Expand Up @@ -4129,7 +4133,9 @@ public function afterScenario() {
$this->cleanupDatabaseGroups();

if (OcisHelper::isTestingOnOcis()) {
OcisHelper::deleteRevaUserData("");
foreach ($this->getCreatedUsers() as $user) {
OcisHelper::deleteRevaUserData($user["actualUsername"]);
}
} else {
$this->resetAdminUserAttributes();
}
Expand Down

0 comments on commit 92423bd

Please sign in to comment.