From cccbd028a6974ed8d26f23d266a5ee5f545bf0e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Wed, 19 Apr 2017 08:15:51 +0200 Subject: [PATCH] Add safety parameter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As the script modifies the Git repository a safety parameter was added to prevent running it by mistake and messing with the local copy of the repository. Signed-off-by: Daniel Calviño Sánchez --- .drone.yml | 4 ++-- build/acceptance/run-local.sh | 10 +++++++++- build/acceptance/run.sh | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index b768fd3f1ea..60194f482c4 100644 --- a/.drone.yml +++ b/.drone.yml @@ -481,14 +481,14 @@ pipeline: acceptance-access-levels: image: nextcloudci/php7.0:php7.0-7 commands: - - build/acceptance/run-local.sh features/access-levels.feature + - build/acceptance/run-local.sh allow-git-repository-modifications features/access-levels.feature when: matrix: TESTS-ACCEPTANCE: access-levels acceptance-login: image: nextcloudci/php7.0:php7.0-7 commands: - - build/acceptance/run-local.sh features/login.feature + - build/acceptance/run-local.sh allow-git-repository-modifications features/login.feature when: matrix: TESTS-ACCEPTANCE: login diff --git a/build/acceptance/run-local.sh b/build/acceptance/run-local.sh index a235871624e..bd5d6b09be1 100755 --- a/build/acceptance/run-local.sh +++ b/build/acceptance/run-local.sh @@ -39,7 +39,15 @@ set -o errexit # Behat through Composer or running Behat) expect that. cd "$(dirname $0)" -SCENARIO_TO_RUN=$1 +# Safety parameter to prevent executing this script by mistake and messing with +# the Git repository. +if [ "$1" != "allow-git-repository-modifications" ]; then + echo "To run the acceptance tests use \"run.sh\" instead" + + exit 1 +fi + +SCENARIO_TO_RUN=$2 composer install diff --git a/build/acceptance/run.sh b/build/acceptance/run.sh index 7a394883d81..2a6efde74f3 100755 --- a/build/acceptance/run.sh +++ b/build/acceptance/run.sh @@ -174,4 +174,4 @@ prepareSelenium prepareDocker echo "Running tests" -docker exec $NEXTCLOUD_LOCAL_CONTAINER bash -c "cd nextcloud && build/acceptance/run-local.sh $SCENARIO_TO_RUN" +docker exec $NEXTCLOUD_LOCAL_CONTAINER bash -c "cd nextcloud && build/acceptance/run-local.sh allow-git-repository-modifications $SCENARIO_TO_RUN"