From bfe985cc18214bcf7476faf10c7c07d40c83cdb0 Mon Sep 17 00:00:00 2001 From: "Kali Kaneko (leap communications)" Date: Thu, 11 May 2017 15:53:24 +0200 Subject: [tests] improve vpn e2e test - add invite code --- tests/e2e/e2e-test-mail.sh | 4 ++++ tests/e2e/e2e-test-vpn.sh | 35 +++++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/e2e/e2e-test-mail.sh b/tests/e2e/e2e-test-mail.sh index 8818147a..7039e648 100755 --- a/tests/e2e/e2e-test-mail.sh +++ b/tests/e2e/e2e-test-mail.sh @@ -44,6 +44,7 @@ PROVIDER='ci.leap.se' INVITE_CODE=${BITMASK_INVITE_CODE:?"Need to set BITMASK_INVITE_CODE non-empty"} BCTL='bitmaskctl' +POLKIT='lxpolkit' LEAP_HOME="$HOME/.config/leap" MAIL_UUID=$(uuidgen) @@ -52,6 +53,9 @@ user="${username}@${PROVIDER}" pw="$(head -c 10 < /dev/urandom | base64)" SWAKS="swaks --h-Subject $MAIL_UUID --silent 2 --helo ci.leap.se -f ci@leap.se -t $user" +# Start the polkit authentication agent +"$POLKIT" & + # Stop any previously started bitmaskd # and start a new instance "$BCTL" stop diff --git a/tests/e2e/e2e-test-vpn.sh b/tests/e2e/e2e-test-vpn.sh index 90193bec..5a2cc1bd 100755 --- a/tests/e2e/e2e-test-vpn.sh +++ b/tests/e2e/e2e-test-vpn.sh @@ -1,10 +1,26 @@ #!/bin/bash # Usage +# ... +# exit if any commands returns non-zero status set -e +# XXX DEBUG +set -x + +# 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='demo.bitmask.net' +INVITE_CODE=${BITMASK_INVITE_CODE:?"Need to set BITMASK_INVITE_CODE non-empty"} BCTL='bitmaskctl' LEAP_HOME="$HOME/.config/leap" @@ -22,7 +38,11 @@ pw="$(head -c 10 < /dev/urandom | base64)" # 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 @@ -33,11 +53,18 @@ pw="$(head -c 10 < /dev/urandom | base64)" # Get VPN cert "$BCTL" vpn get_cert "$user" -"$BCTL" vpn start +"$BCTL" vpn start --json -sleep 10 +# XXX DEBUG --- +tail -n 200 ~/.config/leap/bitmaskd.log +which pkexec +ls -la /usr/sbin/openvpn +ls -la /usr/local/sbin/bitmask-root +# XXX DEBUG --- + +sleep 5 -"$BCTL" vpn status +"$BCTL" vpn status --json tests/e2e/check_ip vpn_on -- cgit v1.2.3