summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2017-05-11 15:53:24 +0200
committerKali Kaneko (leap communications) <kali@leap.se>2017-06-07 12:31:21 +0200
commitbfe985cc18214bcf7476faf10c7c07d40c83cdb0 (patch)
tree83a7b01b21735da904e5e940688ca0b8099f7337 /tests
parentb13470128c8397c1c18ea58f5da66fd7045d35b0 (diff)
[tests] improve vpn e2e test
- add invite code
Diffstat (limited to 'tests')
-rwxr-xr-xtests/e2e/e2e-test-mail.sh4
-rwxr-xr-xtests/e2e/e2e-test-vpn.sh35
2 files changed, 35 insertions, 4 deletions
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