summaryrefslogtreecommitdiff
path: root/tests/e2e/e2e-test.sh
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2017-05-19 13:56:32 +0200
committerKali Kaneko (leap communications) <kali@leap.se>2017-05-19 14:20:43 +0200
commitf5d50c91dae4208e969f83b47f84d1ee602d09b9 (patch)
treefb1f7824fa0cd9d24102c0995adf4db0d64f6272 /tests/e2e/e2e-test.sh
parentee18bba52be78cebf1e34362aafe87f5746587ca (diff)
[tests] get invite code from env variable
the BITMASK_INVITE_CODE variable must be set from within the CI settings.
Diffstat (limited to 'tests/e2e/e2e-test.sh')
-rwxr-xr-xtests/e2e/e2e-test.sh21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/e2e/e2e-test.sh b/tests/e2e/e2e-test.sh
index 6553bf0..8818147 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