Skip to content

Commit 81ffe97

Browse files
authored
test: adjust acceptance tests for running GitHub workflows (#41533)
* test: handle trashbin restore test when installed in subfolder When owncloud core is installed in a subfolder, then the href for items in the trashbin has a path that includes the subfolder. For example: /server/remote.php/dav/trash-bin/Alice/... Handle the possible presence of the subfolder at the start of the path. * test: log messages confirming servers are up when starting acceptance tests * test: fix TEST_SERVER_FED_URL use in acceptance test run.sh * chore(ci): add Apache site configs for acceptance testing These Apache site config templates can be used to set up Apache for single-server or dual-server (federated) testing environments with each server in a separate subdirectory of the Apache server root. Or, in the single-server case, installing ownCloud core directly into the Apache root folder /var/www/html
1 parent b9a156a commit 81ffe97

4 files changed

Lines changed: 43 additions & 4 deletions

File tree

tests/acceptance/features/bootstrap/TrashbinContext.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,16 +236,24 @@ public function listTrashbinFolderCollection(?string $user, ?string $collectionP
236236
__METHOD__ . " $collectionPath"
237237
);
238238

239+
$subfolder = parse_url($this->featureContext->getBaseUrl(), PHP_URL_PATH);
240+
if ($subfolder === null) {
241+
$subfolder = "";
242+
$subfolderWithSlashAtEnd = "";
243+
} else {
244+
$subfolderWithSlashAtEnd = \trim($subfolder, "/") . "/";
245+
}
246+
239247
$files = $this->getTrashbinContentFromResponseXml($responseXml);
240248
// filter out the collection itself, we only want to return the members
241249
$files = \array_filter(
242250
$files,
243-
static function ($element) use ($user, $collectionPath) {
251+
static function ($element) use ($user, $collectionPath, $subfolder) {
244252
$path = $collectionPath;
245253
if ($path !== "") {
246254
$path = $path . "/";
247255
}
248-
return ($element['href'] !== "/remote.php/dav/trash-bin/$user/$path");
256+
return ($element['href'] !== "$subfolder/remote.php/dav/trash-bin/$user/$path");
249257
}
250258
);
251259

@@ -254,7 +262,7 @@ static function ($element) use ($user, $collectionPath) {
254262
// avoid "common" situations that could cause infinite recursion.
255263
$trashbinRef = $file["href"];
256264
$trimmedTrashbinRef = \trim($trashbinRef, "/");
257-
$expectedStart = "remote.php/dav/trash-bin/$user";
265+
$expectedStart = "{$subfolderWithSlashAtEnd}remote.php/dav/trash-bin/$user";
258266
$expectedStartLength = \strlen($expectedStart);
259267
if ((\substr($trimmedTrashbinRef, 0, $expectedStartLength) !== $expectedStart)
260268
|| (\strlen($trimmedTrashbinRef) === $expectedStartLength)

tests/acceptance/run.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ function assert_server_up() {
298298
curl -k -sSf -L $1/status.php -o /dev/null
299299
if [[ $? -eq 0 ]]
300300
then
301+
echo "Server on $1 is responding to status request"
301302
return
302303
else
303304
echo >&2 "Server on $1 is down or not working correctly."
@@ -319,6 +320,7 @@ function assert_testing_app_enabled() {
319320
echo >&2 "Please install and enable it to run the tests."
320321
exit 98
321322
else
323+
echo "Testing app is enabled on the server on $1."
322324
return
323325
fi
324326
}
@@ -788,7 +790,7 @@ then
788790
OCC_FED_URL="${TESTING_APP_FED_URL}occ"
789791
# test that fed server is up and running, and testing app is enabled.
790792
assert_server_up ${TEST_SERVER_FED_URL}
791-
assert_testing_app_enabled ${TEST_SERVER_URL}
793+
assert_testing_app_enabled ${TEST_SERVER_FED_URL}
792794
fi
793795

794796
echo "Not using php inbuilt server for running scenario ..."
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<VirtualHost *:80>
2+
ServerAdmin webmaster@localhost
3+
DocumentRoot /var/www/html
4+
ErrorLog ${APACHE_LOG_DIR}/error.log
5+
CustomLog ${APACHE_LOG_DIR}/access.log combined
6+
7+
<Directory /var/www/html${SERVER_SUBDIR}>
8+
Options Indexes FollowSymLinks MultiViews
9+
AllowOverride All
10+
Require all granted
11+
</Directory>
12+
<Directory /var/www/html${FEDERATED_SUBDIR}>
13+
Options Indexes FollowSymLinks MultiViews
14+
AllowOverride All
15+
Require all granted
16+
</Directory>
17+
</VirtualHost>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<VirtualHost *:80>
2+
ServerAdmin webmaster@localhost
3+
DocumentRoot /var/www/html
4+
ErrorLog ${APACHE_LOG_DIR}/error.log
5+
CustomLog ${APACHE_LOG_DIR}/access.log combined
6+
7+
<Directory /var/www/html${SERVER_SUBDIR}>
8+
Options Indexes FollowSymLinks MultiViews
9+
AllowOverride All
10+
Require all granted
11+
</Directory>
12+
</VirtualHost>

0 commit comments

Comments
 (0)