-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[full-ci] Test indirect resource existence leaks #40406
Conversation
💥 Acceptance tests pipeline cliManageApps-mariadb10.2-php7.4 failed. The build has been cancelled. |
@phil-davis so, I need to duplicate these, right?
|
If there are different results expected on oC10 and oCIS then you need to have That causes line numbers to change - a pain for expected failures! But I haven't been able to find a way to avoid that. Another approach is to make the test expectations more general, for example:
If the requirement of any implementation is just that, for example, a |
Example tables can be in this format:
That allows different particular examples for each implementation. |
You might want to add |
is ci flaky? I get tons of |
tests/acceptance/features/apiTrashbin/trashbinFilesFolders.feature
Outdated
Show resolved
Hide resolved
tests/acceptance/features/apiTrashbinRestore/trashbinRestore.feature
Outdated
Show resolved
Hide resolved
73bd8ec
to
6e4c28d
Compare
Fixed by #40409 - please rebase. |
60d1387
to
1d11b1d
Compare
@phil-davis hmmmm is there code in the testsute that can deal with the I only found: /**
* List a collection in the trashbin
*
* @param string|null $user user
* @param string|null $collectionPath the string of ids of the folder and sub-folders
* @param string $depth
* @param int $level
*
* @return array response
* @throws Exception
*/
public function listTrashbinFolderCollection(?string $user, ?string $collectionPath = "", string $depth = "1", int $level = 1):array {
// $collectionPath should be some list of file-ids like 2147497661/2147497662
// or the empty string, which will list the whole trashbin from the top.
$collectionPath = \trim($collectionPath, "/");
$password = $this->featureContext->getPasswordForUser($user);
$davPathVersion = $this->featureContext->getDavPathVersion();
$response = WebDavHelper::listFolder(
$this->featureContext->getBaseUrl(),
$user,
$password,
$collectionPath,
$depth,
$this->featureContext->getStepLineRef(),
[
'oc:trashbin-original-filename',
'oc:trashbin-original-location',
'oc:trashbin-delete-timestamp',
'd:resourcetype',
'd:getlastmodified'
],
'trash-bin',
$davPathVersion
);
$responseXml = HttpRequestHelper::getResponseXml(
$response,
__METHOD__ . " $collectionPath"
);
$files = $this->getTrashbinContentFromResponseXml($responseXml);
// filter out the collection itself, we only want to return the members
$files = \array_filter(
$files,
static function ($element) use ($user, $collectionPath) {
$path = $collectionPath;
if ($path !== "") {
$path = $path . "/";
}
return ($element['href'] !== "/remote.php/dav/trash-bin/$user/$path");
}
);
foreach ($files as $file) {
// check for unexpected/invalid href values and fail early in order to
// avoid "common" situations that could cause infinite recursion.
$trashbinRef = $file["href"];
$trimmedTrashbinRef = \trim($trashbinRef, "/");
$expectedStart = "remote.php/dav/trash-bin/$user";
$expectedStartLength = \strlen($expectedStart);
if ((\substr($trimmedTrashbinRef, 0, $expectedStartLength) !== $expectedStart)
|| (\strlen($trimmedTrashbinRef) === $expectedStartLength)
) {
// A top href (maybe without even the username) has been returned
// in the response. That should never happen, or have been filtered out
// by code above.
throw new Exception(
__METHOD__ . " Error: unexpected href in trashbin propfind at level $level: '$trashbinRef'"
);
}
if ($file["collection"]) {
$trimmedHref = \trim($trashbinRef, "/");
$explodedHref = \explode("/", $trimmedHref);
$trashbinId = $collectionPath . "/" . end($explodedHref);
$nextFiles = $this->listTrashbinFolderCollection(
$user,
$trashbinId,
$depth,
$level + 1
);
// filter the collection element. We only want the members.
$nextFiles = \array_filter(
$nextFiles,
static function ($element) use ($user, $trashbinRef) {
return ($element['href'] !== $trashbinRef);
}
);
\array_push($files, ...$nextFiles);
}
}
return $files;
} and in the webdavhelpers getDavPath if ($type === "trash-bin") {
return "/remote.php/dav/spaces/trash-bin/" . $spaceId . '/';
} but it does not seem to deal with the hrefs in the response |
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
a0eeed2
to
408fb23
Compare
Kudos, SonarCloud Quality Gate passed! |
@phil-davis @individual-it I also ran into owncloud/ocis#4820. The way the test is written right now can never work. Should we just leave out the |
We now expect a not found error instead of permission denied error for some trash interactions.
Needed for cs3org/reva#3300
Driven by owncloud/ocis#3561