forked from nextcloud/richdocuments
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-integration.sh
executable file
·68 lines (51 loc) · 1.83 KB
/
run-integration.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env bash
#
# SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
set -e
OC_PATH=../../../
OCC=${OC_PATH}occ
SCENARIO_TO_RUN=$1
HIDE_OC_LOGS=$2
APP_NAME=richdocuments
PORT_SERVERA=8080
PORT_SERVERB=8081
PORT_COOL=9980
INSTALLED=$($OCC status | grep installed: | cut -d " " -f 5)
if [ "$INSTALLED" == "true" ]; then
$OCC app:enable $APP_NAME
else
if [ "$SCENARIO_TO_RUN" != "setup_features/setup.feature" ]; then
echo "Nextcloud instance needs to be installed" >&2
exit 1
fi
fi
composer install
composer dump-autoload
if curl --fail http://localhost:$PORT_COOL/hosting/capabilities; then
echo "Collabora server already running at port $PORT_COOL"
else
if ! docker info >/dev/null 2>&1; then
echo "Docker does not seem to be running, so start the docker daemon or run a collabora server manually"
exit 1
fi
COOL_CONTAINER=$(docker run -t -d -p 9980:9980 -e "domain=localhost" -e "extra_params=--o:ssl.enable=false" collabora/code)
fi;
curl --fail http://localhost:$PORT_COOL/hosting/capabilities
PHP_CLI_SERVER_WORKERS=10 php -S localhost:$PORT_SERVERA -t $OC_PATH &
PHPPIDA=$!
PHP_CLI_SERVER_WORKERS=10 php -S localhost:$PORT_SERVERB -t $OC_PATH &
PHPPIDB=$!
$OCC config:app:set richdocuments wopi_url --value="http://localhost:9980"
$OCC config:app:set richdocuments public_wopi_url --value="http://localhost:9980"
$OCC richdocuments:activate-config
$OCC config:system:set allow_local_remote_servers --value true --type bool
$OCC config:system:set gs.trustedHosts 0 --value="localhost:$PORT_SERVERA"
$OCC config:system:set gs.trustedHosts 1 --value="localhost:$PORT_SERVERB"
vendor/bin/behat $SCENARIO_TO_RUN
RESULT=$?
kill $PHPPIDA
kill $PHPPIDB
[[ -v COOL_CONTAINER ]] && docker stop $container_id
echo "runsh: Exit code: $RESULT"
exit $RESULT