Add option to acceptance test runner to set the Nextcloud server domain
By default "127.0.0.1" is used, so nothing needs to be set when the Selenium server and the Nextcloud test server share the same network (like when called by "run.sh"). Besides passing the domain to the acceptance tests the Nextcloud test server configuration must be modified to see the given domain as a trusted domain; otherwise the access would be forbidden. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
parent
9722291454
commit
140b23f85f
|
@ -25,6 +25,18 @@
|
||||||
|
|
||||||
set -o errexit
|
set -o errexit
|
||||||
|
|
||||||
|
NEXTCLOUD_SERVER_DOMAIN=""
|
||||||
|
if [ "$1" = "--nextcloud-server-domain" ]; then
|
||||||
|
NEXTCLOUD_SERVER_DOMAIN=$2
|
||||||
|
|
||||||
|
shift 2
|
||||||
|
fi
|
||||||
|
|
||||||
php occ maintenance:install --admin-pass=admin
|
php occ maintenance:install --admin-pass=admin
|
||||||
|
|
||||||
OC_PASS=123456acb php occ user:add --password-from-env user0
|
OC_PASS=123456acb php occ user:add --password-from-env user0
|
||||||
|
|
||||||
|
if [ "$NEXTCLOUD_SERVER_DOMAIN" != "" ]; then
|
||||||
|
# Default first trusted domain is "localhost"; replace it with given domain.
|
||||||
|
php occ config:system:set trusted_domains 0 --value="$NEXTCLOUD_SERVER_DOMAIN"
|
||||||
|
fi
|
||||||
|
|
|
@ -54,6 +54,16 @@ if [ "$1" = "--timeout-multiplier" ]; then
|
||||||
shift 2
|
shift 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# "--nextcloud-server-domain XXX" option can be provided to set the domain used
|
||||||
|
# by the Selenium server to access the Nextcloud server.
|
||||||
|
DEFAULT_NEXTCLOUD_SERVER_DOMAIN="127.0.0.1"
|
||||||
|
NEXTCLOUD_SERVER_DOMAIN="$DEFAULT_NEXTCLOUD_SERVER_DOMAIN"
|
||||||
|
if [ "$1" = "--nextcloud-server-domain" ]; then
|
||||||
|
NEXTCLOUD_SERVER_DOMAIN=$2
|
||||||
|
|
||||||
|
shift 2
|
||||||
|
fi
|
||||||
|
|
||||||
# Safety parameter to prevent executing this script by mistake and messing with
|
# Safety parameter to prevent executing this script by mistake and messing with
|
||||||
# the Git repository.
|
# the Git repository.
|
||||||
if [ "$1" != "allow-git-repository-modifications" ]; then
|
if [ "$1" != "allow-git-repository-modifications" ]; then
|
||||||
|
@ -80,12 +90,34 @@ if [ "$TIMEOUT_MULTIPLIER" != "" ]; then
|
||||||
sed --in-place "s/$ORIGINAL/$REPLACEMENT/" config/behat.yml
|
sed --in-place "s/$ORIGINAL/$REPLACEMENT/" config/behat.yml
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$NEXTCLOUD_SERVER_DOMAIN" != "$DEFAULT_NEXTCLOUD_SERVER_DOMAIN" ]; then
|
||||||
|
# Although Behat documentation states that using the BEHAT_PARAMS
|
||||||
|
# environment variable "You can set any value for any option that is
|
||||||
|
# available in a behat.yml file" this is currently not true for the
|
||||||
|
# constructor parameters of contexts (see
|
||||||
|
# https://github.com/Behat/Behat/issues/983). Thus, the default "behat.yml"
|
||||||
|
# configuration file has to be adjusted to provide the appropriate
|
||||||
|
# parameters for NextcloudTestServerContext.
|
||||||
|
ORIGINAL="\
|
||||||
|
- NextcloudTestServerContext"
|
||||||
|
REPLACEMENT="\
|
||||||
|
- NextcloudTestServerContext:\n\
|
||||||
|
nextcloudTestServerHelperParameters:\n\
|
||||||
|
- $NEXTCLOUD_SERVER_DOMAIN"
|
||||||
|
sed --in-place "s/$ORIGINAL/$REPLACEMENT/" config/behat.yml
|
||||||
|
fi
|
||||||
|
|
||||||
composer install
|
composer install
|
||||||
|
|
||||||
cd ../../
|
cd ../../
|
||||||
|
|
||||||
|
INSTALL_AND_CONFIGURE_SERVER_PARAMETERS=""
|
||||||
|
if [ "$NEXTCLOUD_SERVER_domain" != "$DEFAULT_NEXTCLOUD_SERVER_DOMAIN" ]; then
|
||||||
|
INSTALL_AND_CONFIGURE_SERVER_PARAMETERS+="--nextcloud-server-domain $NEXTCLOUD_SERVER_DOMAIN"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Installing and configuring Nextcloud server"
|
echo "Installing and configuring Nextcloud server"
|
||||||
tests/acceptance/installAndConfigureServer.sh
|
tests/acceptance/installAndConfigureServer.sh $INSTALL_AND_CONFIGURE_SERVER_PARAMETERS
|
||||||
|
|
||||||
echo "Saving the default state so acceptance tests can reset to it"
|
echo "Saving the default state so acceptance tests can reset to it"
|
||||||
find . -name ".gitignore" -exec rm --force {} \;
|
find . -name ".gitignore" -exec rm --force {} \;
|
||||||
|
|
Loading…
Reference in New Issue