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 remaining ocis related code #40632

Merged
merged 1 commit into from
Feb 10, 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
17 changes: 1 addition & 16 deletions tests/TestHelpers/WebDavHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class WebDavHelper {
public const DAV_VERSION_OLD = 1;
public const DAV_VERSION_NEW = 2;
public const DAV_VERSION_SPACES = 3;
public static $SPACE_ID_FROM_OCIS = '';

/**
* @var array of users with their different spaces ids
Expand Down Expand Up @@ -629,19 +628,7 @@ public static function makeDavRequest(
$path = "";
}

// get space id if testing with spaces dav
if (self::$SPACE_ID_FROM_OCIS === '' && $davPathVersionToUse === self::DAV_VERSION_SPACES) {
$spaceId = self::getPersonalSpaceIdForUserOrFakeIfNotFound(
$baseUrl,
$doDavRequestAsUser ?? $user,
$password,
$xRequestId
);
} else {
$spaceId = self::$SPACE_ID_FROM_OCIS;
}

$davPath = self::getDavPath($doDavRequestAsUser ?? $user, $davPathVersionToUse, $type, $spaceId);
$davPath = self::getDavPath($doDavRequestAsUser ?? $user, $davPathVersionToUse, $type);

//replace %, # and ? and in the path, Guzzle will not encode them
$urlSpecialChar = [['%', '#', '?'], ['%25', '%23', '%3F']];
Expand Down Expand Up @@ -684,8 +671,6 @@ public static function makeDavRequest(
}
}

//Clear the space ID from ocis after each request
self::$SPACE_ID_FROM_OCIS = '';
return HttpRequestHelper::sendRequest(
$fullUrl,
$xRequestId,
Expand Down
17 changes: 0 additions & 17 deletions tests/acceptance/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2806,23 +2806,6 @@ public function readFileInServerRootForCore(string $path):void {
$this->setResponse($response);
}

/**
* read a server file for ocis
*
* @param string $path
*
* @return string
* @throws Exception
*/
public function readFileInServerRootForOCIS(string $path):string {
$pathToOcis = \getenv("PATH_TO_OCIS");
$targetFile = \rtrim($pathToOcis, "/") . "/" . "services/web/assets" . "/" . ltrim($path, '/');
if (!\file_exists($targetFile)) {
throw new Exception('Target File ' . $targetFile . ' could not be found');
}
return \file_get_contents($targetFile);
}

/**
* send request to list a server file
*
Expand Down
53 changes: 0 additions & 53 deletions tests/acceptance/features/bootstrap/Provisioning.php
Original file line number Diff line number Diff line change
Expand Up @@ -914,59 +914,6 @@ public function resetOldLdapConfig():void {
}
}

/**
* Manually add skeleton files for a single user on OCIS and reva systems
*
* @param string $user
* @param string $password
*
* @return void
* @throws Exception
*/
public function manuallyAddSkeletonFilesForUser(string $user, string $password):void {
$settings = [];
$setting["userid"] = $user;
$setting["password"] = $password;
$settings[] = $setting;
$this->manuallyAddSkeletonFiles($settings);
}

/**
* Manually add skeleton files on OCIS and reva systems
*
* @param array $usersAttributes
*
* @return void
* @throws Exception
*/
public function manuallyAddSkeletonFiles(array $usersAttributes):void {
if ($this->isEmptySkeleton()) {
// The empty skeleton has no files. There is nothing to do so return early.
return;
}
$skeletonDir = \getenv("SKELETON_DIR");
$revaRoot = \getenv("OCIS_REVA_DATA_ROOT");
$skeletonStrategy = \getenv("OCIS_SKELETON_STRATEGY");
if (!$skeletonStrategy) {
$skeletonStrategy = 'upload'; //slower, but safer, so make it the default
}
if ($skeletonStrategy !== 'upload' && $skeletonStrategy !== 'copy') {
throw new Exception(
'Wrong OCIS_SKELETON_STRATEGY environment variable. ' .
'OCIS_SKELETON_STRATEGY has to be set to "upload" or "copy"'
);
}
if (!$skeletonDir) {
throw new Exception('Missing SKELETON_DIR environment variable, cannot copy skeleton files for OCIS');
}
if ($skeletonStrategy === 'copy' && !$revaRoot) {
throw new Exception(
'OCIS_SKELETON_STRATEGY is set to "copy" ' .
'but no "OCIS_REVA_DATA_ROOT" given'
);
}
}

/**
* This function will allow us to send user creation requests in parallel.
* This will be faster in comparison to waiting for each request to complete before sending another request.
Expand Down
4 changes: 1 addition & 3 deletions tests/acceptance/features/bootstrap/TUSContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ public function sendsAChunkToTUSLocationWithOffsetAndData(string $user, string $
$data
)
);
WebDavHelper::$SPACE_ID_FROM_OCIS = '';
}

/**
Expand Down Expand Up @@ -193,10 +192,9 @@ public function userUploadsUsingTusAFileTo(
$user,
$this->featureContext->getDavPathVersion(),
"files",
WebDavHelper::$SPACE_ID_FROM_OCIS ? WebDavHelper::$SPACE_ID_FROM_OCIS : $this->featureContext->getPersonalSpaceIdForUser($user)
$this->featureContext->getPersonalSpaceIdForUser($user)
)
);
WebDavHelper::$SPACE_ID_FROM_OCIS = '';
$client->setMetadata($uploadMetadata);
$sourceFile = $this->featureContext->acceptanceTestsDirLocation() . $source;
$client->setKey((string)rand())->file($sourceFile, $destination);
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ public function usingSpacesDavPath():void {
public function getFullDavFilesPath(string $user):string {
$spaceId = null;
if ($this->getDavPathVersion() === WebDavHelper::DAV_VERSION_SPACES) {
$spaceId = (WebDavHelper::$SPACE_ID_FROM_OCIS) ? WebDavHelper::$SPACE_ID_FROM_OCIS : WebDavHelper::getPersonalSpaceIdForUser(
$spaceId = WebDavHelper::getPersonalSpaceIdForUser(
$this->getBaseUrl(),
$user,
$this->getPasswordForUser($user),
Expand Down
10 changes: 0 additions & 10 deletions tests/acceptance/features/bootstrap/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,9 @@
*
*/

$pathToOcis = \getenv("PATH_TO_OCIS");

$classLoader = new \Composer\Autoload\ClassLoader();
$classLoader->addPsr4("Page\\", __DIR__ . "/../lib", true);
$classLoader->addPsr4("TestHelpers\\", __DIR__ . "/../../../TestHelpers", true);
if ($pathToOcis && \is_dir($pathToOcis)) {
$classLoader->addPsr4("TestHelpers\\", $pathToOcis . "/tests/TestHelpers", true);
$classLoader->addPsr4(
"",
$pathToOcis . "/tests/acceptance/features/bootstrap",
true
);
}
$classLoader->register();

// Sleep for 10 milliseconds
Expand Down