From 04bce963c2314dc9b21bd86224e75c22aae39d70 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Mon, 28 Aug 2017 11:00:30 -0400 Subject: [tests] fix check-ip script --- Makefile | 2 +- src/leap/bitmask/vpn/fw/firewall.py | 2 ++ src/leap/bitmask/vpn/tunnel.py | 2 +- tests/e2e/check_ip | 9 +++++---- tests/e2e/e2e-test-vpn.sh | 12 +++++------- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 35da55c2..41b0b5c0 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ test_e2e: test_functional_setup: pip install -U behave selenium -test_functional: +test_functional: install_helpers xvfb-run --server-args="-screen 0 1280x1024x24" behave --tags ~@wip --tags @smoke tests/functional/features -k --no-capture -D host=localhost test_functional_graphical: diff --git a/src/leap/bitmask/vpn/fw/firewall.py b/src/leap/bitmask/vpn/fw/firewall.py index 71479718..f4325c77 100644 --- a/src/leap/bitmask/vpn/fw/firewall.py +++ b/src/leap/bitmask/vpn/fw/firewall.py @@ -114,6 +114,7 @@ class _LinuxFirewallManager(object): if restart: cmd.append("restart") + print "LAUNCHING FIREWALL..." result = '' try: retcode, result = commands.getstatusoutput( @@ -122,6 +123,7 @@ class _LinuxFirewallManager(object): log.failure('Error launching the firewall') finally: log.debug(result) + print "LAUNCHED FIREWALL" emit_async(catalog.VPN_STATUS_CHANGED) return True diff --git a/src/leap/bitmask/vpn/tunnel.py b/src/leap/bitmask/vpn/tunnel.py index 7dd1d25b..831f04d2 100644 --- a/src/leap/bitmask/vpn/tunnel.py +++ b/src/leap/bitmask/vpn/tunnel.py @@ -41,7 +41,7 @@ RESTART_WAIT = 2 # in secs class ConfiguredTunnel(object): """ - A ConfiguredTunne holds the configuration for a VPN connection, and allows + A ConfiguredTunnel holds the configuration for a VPN connection, and allows to control that connection. This is the high-level object that the service knows about. diff --git a/tests/e2e/check_ip b/tests/e2e/check_ip index 8a45f2c5..662ab2f0 100755 --- a/tests/e2e/check_ip +++ b/tests/e2e/check_ip @@ -4,7 +4,7 @@ import urllib.request import json import sys -DEMO_ISPS = ('Riseup Networks', '') +DEMO_ISPS = ('Riseup Networks',) url = 'https://wtfismyip.com/json' @@ -26,9 +26,9 @@ try: cmd = sys.argv[1] if cmd == 'vpn_on': - assert isp == DEMO_ISP + assert isp in DEMO_ISPS elif cmd == 'vpn_off': - assert isp != DEMO_ISP + assert isp not in DEMO_ISPS else: raise BadCmd() @@ -36,8 +36,9 @@ except BadCmd: print("Cannot parse that command. Valid commands: vpn_on, vpn_off") sys.exit(1) -except Exception: +except Exception as exc: print("IP *NOT* as expected") + print("%r" % exc) sys.exit(1) else: diff --git a/tests/e2e/e2e-test-vpn.sh b/tests/e2e/e2e-test-vpn.sh index 05c19138..750fef8e 100755 --- a/tests/e2e/e2e-test-vpn.sh +++ b/tests/e2e/e2e-test-vpn.sh @@ -35,9 +35,6 @@ pw="$(head -c 10 < /dev/urandom | base64)" [ -d "$LEAP_HOME" ] && rm -rf "$LEAP_HOME" -"$BCTL" start - - # Register a new user # Disable xtrace set +x @@ -53,11 +50,12 @@ set +x # Start VPN, wait a bit "$BCTL" vpn start --json -sleep 3 +sleep 5 "$BCTL" vpn status --json # XXX gateway does not get added to resolv.conf -echo "nameserver 10.42.0.1" > /etc/resolv.conf +# If we are running as root, as in the CI, we can do this directly +# echo "nameserver 10.42.0.1" > /etc/resolv.conf # cat /etc/resolv.conf sleep 5 @@ -67,10 +65,10 @@ sleep 5 tests/e2e/check_ip vpn_on "$BCTL" vpn stop -sleep 3 +sleep 5 # XXX debug do this only if no other entry in resolv.conf -echo "nameserver 77.109.148.136" > /etc/resolv.conf +# echo "nameserver 77.109.148.136" > /etc/resolv.conf # TEST that we're NOT going through the provider's VPN -- cgit v1.2.3