From f5d50c91dae4208e969f83b47f84d1ee602d09b9 Mon Sep 17 00:00:00 2001 From: "Kali Kaneko (leap communications)" Date: Fri, 19 May 2017 13:56:32 +0200 Subject: [tests] get invite code from env variable the BITMASK_INVITE_CODE variable must be set from within the CI settings. --- tests/e2e/e2e-test.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/e2e/e2e-test.sh b/tests/e2e/e2e-test.sh index 6553bf00..8818147a 100755 --- a/tests/e2e/e2e-test.sh +++ b/tests/e2e/e2e-test.sh @@ -3,6 +3,7 @@ # Dependencies # - swaks and uuid-runtime debian packages # +# # Usage # # In order to send authenticated mail to the tmp_user you need to @@ -26,9 +27,22 @@ # - move away from cdev.bm # - remove test user on success +# exit if any commands returns non-zero status set -e +# Check if scipt is run in debug mode so we can hide secrets +if [[ "$-" =~ 'x' ]] +then + echo 'Running with xtrace enabled!' + xtrace=true +else + echo 'Running with xtrace disabled!' + xtrace=false +fi + PROVIDER='ci.leap.se' +INVITE_CODE=${BITMASK_INVITE_CODE:?"Need to set BITMASK_INVITE_CODE non-empty"} + BCTL='bitmaskctl' LEAP_HOME="$HOME/.config/leap" MAIL_UUID=$(uuidgen) @@ -47,7 +61,12 @@ SWAKS="swaks --h-Subject $MAIL_UUID --silent 2 --helo ci.leap.se -f ci@leap.se - "$BCTL" start # Register a new user -"$BCTL" user create "$user" --pass "$pw" + +# Disable xtrace +set +x +"$BCTL" user create "$user" --pass "$pw" --invite "$INVITE_CODE" +# Enable xtrace again only if it was set at beginning of script +[[ $xtrace == true ]] && set -x # Authenticate "$BCTL" user auth "$user" --pass "$pw" > /dev/null -- cgit v1.2.3