From b9fff80022e15560151f523015cb5bf73bd3cff1 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Mon, 28 Aug 2017 17:19:12 -0400 Subject: [tests] do not fail if helper installed in debian path --- Makefile | 11 +++++++++-- src/leap/bitmask/vpn/helpers/__init__.py | 5 ++++- tests/e2e/e2e-test-vpn.sh | 3 ++- tests/functional/features/steps/bitmask.py | 3 +++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 41b0b5c..49236ec 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,11 @@ DIST=dist/bitmask NEXT_VERSION = $(shell cat pkg/next-version) DIST_VERSION = dist/bitmask-$(NEXT_VERSION)/ + +BITMASK_ROOT = src/leap/bitmask/vpn/helpers/linux/bitmask-root +POLKIT_POLICY = src/leap/bitmask/vpn/helpers/linux/se.leap.bitmask.policy +SUDO = /usr/bin/sudo + include pkg/bundles/build.mk include pkg/thirdparty/openvpn/build.mk @@ -45,6 +50,7 @@ test_functional_setup: pip install -U behave selenium test_functional: install_helpers + test -f /usr/bin/lxpolkit && lkpolkit & xvfb-run --server-args="-screen 0 1280x1024x24" behave --tags ~@wip --tags @smoke tests/functional/features -k --no-capture -D host=localhost test_functional_graphical: @@ -54,8 +60,9 @@ test_functional_graphical_wip: behave --tags @wip tests/functional/features -k --no-capture -D host=localhost install_helpers: - sudo cp src/leap/bitmask/vpn/helpers/linux/bitmask-root /usr/local/sbin/ - sudo cp src/leap/bitmask/vpn/helpers/linux/se.leap.bitmask.policy /usr/share/polkit-1/actions/ + # if there's no sudo, assumming this is running as root by the CI + test -f $(SUDO) && sudo cp $(BITMASK_ROOT) /usr/local/sbin/ || cp $(BITMASK_ROOT) /usr/local/sbin/ + test -f $(SUDO) && sudo cp $(POLKIT_POLICY) /usr/share/polkit-1/actions/se.bitmask.bundle.policy || cp $(POLKIT_POLICY) /usr/share/polkit-1/actions/se.bitmask.bundle.policy install_pixelated: pip install leap.pixelated leap.pixelated-www diff --git a/src/leap/bitmask/vpn/helpers/__init__.py b/src/leap/bitmask/vpn/helpers/__init__.py index 719fc5e..42cff4a 100644 --- a/src/leap/bitmask/vpn/helpers/__init__.py +++ b/src/leap/bitmask/vpn/helpers/__init__.py @@ -12,6 +12,7 @@ if IS_LINUX: helper_to = '/usr/local/sbin/bitmask-root' polkit_to = '/usr/share/polkit-1/actions/se.bitmask.bundle.policy' + deb_polkit_to = '/usr/share/polkit-1/actions/se.bitmask.policy' openvpn_to = '/usr/local/sbin/leap-openvpn' def install(): @@ -34,7 +35,9 @@ if IS_LINUX: def check(): helper = os.path.exists(helper_to) - polkit = os.path.exists(polkit_to) + polkit = ( + os.path.exists(polkit_to) or + os.path.exists(deb_polkit_to)) return helper and polkit if IS_MAC: diff --git a/tests/e2e/e2e-test-vpn.sh b/tests/e2e/e2e-test-vpn.sh index 750fef8..593c118 100755 --- a/tests/e2e/e2e-test-vpn.sh +++ b/tests/e2e/e2e-test-vpn.sh @@ -59,7 +59,8 @@ sleep 5 # cat /etc/resolv.conf sleep 5 -#ip link show +ip link show +cat ~/.config/leap/bitmaskd.log # TEST that we're going through the provider's VPN tests/e2e/check_ip vpn_on diff --git a/tests/functional/features/steps/bitmask.py b/tests/functional/features/steps/bitmask.py index 7e1201f..f79cd41 100644 --- a/tests/functional/features/steps/bitmask.py +++ b/tests/functional/features/steps/bitmask.py @@ -10,11 +10,14 @@ from behave import given @given('I start bitmask for the first time') def initial_run(context): if context.mode == 'virtualenv': + cmd = commands.getoutput('which bitmaskctl') + # print("CMD PATH", cmd) commands.getoutput('bitmaskctl stop') # TODO: fix bitmaskctl to only exit once bitmaskd has stopped time.sleep(2) _initialize_home_path() commands.getoutput('bitmaskctl start') + time.sleep(1) elif context.mode in ('bundle', 'bundle-ci'): commands.getoutput(context.bundle_path) time.sleep(2) -- cgit v1.2.3