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][full-ci] Remove isTestingOnReva() and isTestingOnOcis() and their references #40625

Merged
merged 3 commits into from
Feb 8, 2023
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
16 changes: 1 addition & 15 deletions tests/TestHelpers/OcisHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,11 @@
* @package TestHelpers
*/
class OcisHelper {
/**
* @return bool
*/
public static function isTestingOnOcis():bool {
return (\getenv("TEST_OCIS") === "true");
}

/**
* @return bool
*/
public static function isTestingOnReva():bool {
return (\getenv("TEST_REVA") === "true");
}

/**
* @return bool
*/
public static function isTestingOnOcisOrReva():bool {
return (self::isTestingOnOcis() || self::isTestingOnReva());
return false;
}
Comment on lines 39 to 41
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: we can also remove this whole function. But that can be done in the next PR.


/**
Expand Down
15 changes: 1 addition & 14 deletions tests/acceptance/features/bootstrap/AppConfigurationContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,20 +192,7 @@ public function theUserGetsCapabilitiesCheckResponse():void {
* @throws Exception
*/
public function getAdminUsernameForCapabilitiesCheck():string {
if (\TestHelpers\OcisHelper::isTestingOnReva()) {
// When testing on reva we don't have a user called "admin" to use
// to access the capabilities. So create an ordinary user on-the-fly
// with a default password. That user should be able to get a
// capabilities response that the test can process.
$adminUsername = "PseudoAdminForRevaTest";
$createdUsers = $this->featureContext->getCreatedUsers();
if (!\array_key_exists($adminUsername, $createdUsers)) {
$this->featureContext->createUser($adminUsername);
}
} else {
$adminUsername = $this->featureContext->getAdminUsername();
}
return $adminUsername;
return $this->featureContext->getAdminUsername();
}

/**
Expand Down
25 changes: 9 additions & 16 deletions tests/acceptance/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -1581,14 +1581,10 @@ public function sendingToWithDirectUrl(?string $user, ?string $verb, ?string $ur
* @return bool
*/
public function isAPublicLinkUrl(string $url):bool {
if (OcisHelper::isTestingOnReva()) {
$urlEnding = \ltrim($url, '/');
} else {
if (\substr($url, 0, 4) !== "http") {
return false;
}
$urlEnding = \substr($url, \strlen($this->getBaseUrl() . '/'));
if (\substr($url, 0, 4) !== "http") {
return false;
}
$urlEnding = \substr($url, \strlen($this->getBaseUrl() . '/'));

if (OcisHelper::isTestingOnOcisOrReva()) {
SwikritiT marked this conversation as resolved.
Show resolved Hide resolved
$matchResult = \preg_match("%^(#/)?s/([a-zA-Z0-9]{15})$%", $urlEnding);
Expand Down Expand Up @@ -2932,15 +2928,12 @@ public function theLocalStorageMountForIsRenamedTo(string $mount, string $target
* @throws Exception
*/
public function theFileWithContentShouldExistInTheServerRoot(string $path, string $content):void {
if (OcisHelper::isTestingOnOcis()) {
$fileContent = $this->readFileInServerRootForOCIS($path);
} else {
$this->readFileInServerRootForCore($path);
$this->theHTTPStatusCodeShouldBe(200, 'Failed to read the file $path');
$fileContent = $this->getResponseXml();
$fileContent = (string) $fileContent->data->element->contentUrlEncoded;
$fileContent = \urldecode($fileContent);
}
$this->readFileInServerRootForCore($path);
$this->theHTTPStatusCodeShouldBe(200, 'Failed to read the file $path');
$fileContent = $this->getResponseXml();
$fileContent = (string) $fileContent->data->element->contentUrlEncoded;
$fileContent = \urldecode($fileContent);

Assert::assertSame(
$content,
$fileContent,
Expand Down
15 changes: 1 addition & 14 deletions tests/acceptance/features/bootstrap/Provisioning.php
Original file line number Diff line number Diff line change
Expand Up @@ -788,16 +788,10 @@ public function createLdapUser(array $setting):void {
}
if (isset($setting["email"])) {
$entry['mail'] = $setting["email"];
} elseif (OcisHelper::isTestingOnOcis()) {
$entry['mail'] = $userId . '@owncloud.com';
}
$entry['gidNumber'] = 5000;
$entry['uidNumber'] = $uidNumber;

if (OcisHelper::isTestingOnOcis()) {
$entry['objectclass'][] = 'ownCloud';
$entry['ownCloudUUID'] = WebDavHelper::generateUUIDv4();
}
if (OcisHelper::isTestingParallelDeployment()) {
$entry['ownCloudSelector'] = $this->getOCSelector();
}
Expand Down Expand Up @@ -834,10 +828,6 @@ public function createLdapGroup(string $group):void {
$entry['objectclass'][] = 'groupOfNames';
$entry['member'] = "";
}
if (OcisHelper::isTestingOnOcis()) {
$entry['objectclass'][] = 'ownCloud';
$entry['ownCloudUUID'] = WebDavHelper::generateUUIDv4();
}
$this->ldap->add($newDN, $entry);
$this->ldapCreatedGroups[] = $group;
// For syncing the ldap groups
Expand Down Expand Up @@ -1223,7 +1213,7 @@ public function usersHaveBeenCreated(
$this->manuallyAddSkeletonFiles($usersAttributes);
}

if ($initialize && ($this->isEmptySkeleton() || !OcisHelper::isTestingOnOcis())) {
if ($initialize) {
// We need to initialize each user using the individual authentication of each user.
// That is not possible in Guzzle6 batch mode. So we do it with normal requests in serial.
$this->initializeUsers($users);
Expand Down Expand Up @@ -3448,9 +3438,6 @@ public function userExists(?string $user):bool {
} elseif (OcisHelper::isTestingWithGraphApi()) {
$requestingUser = $this->getAdminUsername();
$requestingPassword = $this->getAdminPassword();
} elseif (OcisHelper::isTestingOnOcis()) {
SwikritiT marked this conversation as resolved.
Show resolved Hide resolved
$requestingUser = 'moss';
$requestingPassword = 'vista';
} else {
$requestingUser = $this->getActualUsername($user);
$requestingPassword = $this->getPasswordForUser($requestingUser);
Expand Down
4 changes: 0 additions & 4 deletions tests/acceptance/features/bootstrap/SearchContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ public function userSearchesUsingWebDavAPI(
?string $limit = null,
TableNode $properties = null
):void {
// Because indexing of newly uploaded files or directories with ocis is decoupled and occurs asynchronously, a short wait is necessary before searching files or folders.
if (OcisHelper::isTestingOnOcis()) {
sleep(4);
}
$user = $this->featureContext->getActualUsername($user);
$baseUrl = $this->featureContext->getBaseUrl();
$password = $this->featureContext->getPasswordForUser($user);
Expand Down
13 changes: 0 additions & 13 deletions tests/acceptance/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -5350,19 +5350,6 @@ public function findEntryFromPropfindResponse(
if ($multistatusResults !== null) {
foreach ($multistatusResults as $multistatusResult) {
$entryPath = $multistatusResult['value'][0]['value'];
if (OcisHelper::isTestingOnOcis() && $method === "REPORT") {
if ($entryNameToSearch !== null && str_ends_with($entryPath, $entryNameToSearch)) {
return $multistatusResult;
} else {
$spaceId = (WebDavHelper::$SPACE_ID_FROM_OCIS) ? WebDavHelper::$SPACE_ID_FROM_OCIS : WebDavHelper::getPersonalSpaceIdForUser(
$this->getBaseUrl(),
$user,
$this->getPasswordForUser($user),
$this->getStepLineRef()
);
$topWebDavPath = "/remote.php/dav/spaces/" . $spaceId . "/" . $folderPath;
}
}
$entryName = \str_replace($topWebDavPath, "", $entryPath);
$entryName = \rawurldecode($entryName);
$entryName = \trim($entryName, "/");
Expand Down