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] edit users only when running with oc10 backend #38138

Merged
merged 1 commit into from
Nov 24, 2020
Merged
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
11 changes: 8 additions & 3 deletions tests/acceptance/features/bootstrap/Provisioning.php
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,7 @@ public function usersHaveBeenCreated(
} else {
$attributesToCreateUser['userid'] = $userAttributes['userid'];
$attributesToCreateUser['password'] = $userAttributes['password'];
$attributesToCreateUser['displayname'] = $userAttributes['displayName'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything that calls usersHaveBeenCreated is passing in $userAttributes['displayName'] - so it is always set, but possibly sometimes to null. I guess that is OK. The request to the "add user" endpoint might go out asking for displayname = null - probable it will be requesting the empty string, or guzzle will ignore that item in the body and not send it at all. On oC10 it does not matter - it ignores a displayname in the "add user" request. On OCIS we might find out what happens if the request explicitly asks for an empty displayname

if (OcisHelper::isTestingOnOcisOrReva()) {
$attributesToCreateUser['username'] = $userAttributes['userid'];
if ($userAttributes['email'] === null) {
Expand Down Expand Up @@ -972,15 +973,19 @@ public function usersHaveBeenCreated(
$users = [];
$editData = [];
foreach ($usersAttributes as $userAttributes) {
\array_push($users, $userAttributes['userid']);
$this->addUserToCreatedUsersList($userAttributes['userid'], $userAttributes['password'], $userAttributes['displayName'], $userAttributes['email']);

if (OcisHelper::isTestingOnOcisOrReva()) {
OcisHelper::createEOSStorageHome(
$this->getBaseUrl(),
$userAttributes['userid'],
$userAttributes['password']
);
// We don't need to set displayName and email while running in oCIS
// As they are set when creating the user
continue;
}
\array_push($users, $userAttributes['userid']);
$this->addUserToCreatedUsersList($userAttributes['userid'], $userAttributes['password'], $userAttributes['displayName'], $userAttributes['email']);
if (isset($userAttributes['displayName'])) {
\array_push($editData, ['user' => $userAttributes['userid'], 'key' => 'displayname', 'value' => $userAttributes['displayName']]);
}
Expand All @@ -989,7 +994,7 @@ public function usersHaveBeenCreated(
}
}
// Edit the users in parallel to make the process faster.
if (!$useLdap && \count($editData) > 0) {
if (!OcisHelper::isTestingOnOcisOrReva() && !$useLdap && \count($editData) > 0) {
UserHelper::editUserBatch(
$this->getBaseUrl(),
$editData,
Expand Down