summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2018-01-23 23:07:07 +0100
committerKali Kaneko <kali@leap.se>2018-01-25 01:19:22 +0100
commitcbfd0dc8873fbfb604782faded94fc77a7ab9430 (patch)
tree79e31adeed20f9a316fa36104b3acf2dd35f8f3c
parent26d3badc31655e2258f54dbcaf0bdca5f8623e69 (diff)
[tests] workaround for functional tests in docker
polkit doesn't work inside docker.
-rw-r--r--src/leap/bitmask/vpn/_checks.py3
-rw-r--r--src/leap/bitmask/vpn/helpers/__init__.py1
-rw-r--r--src/leap/bitmask/vpn/privilege.py3
-rw-r--r--tests/functional/features/steps/vpn.py2
4 files changed, 7 insertions, 2 deletions
diff --git a/src/leap/bitmask/vpn/_checks.py b/src/leap/bitmask/vpn/_checks.py
index 681f7428..2549e366 100644
--- a/src/leap/bitmask/vpn/_checks.py
+++ b/src/leap/bitmask/vpn/_checks.py
@@ -27,6 +27,9 @@ def get_failure_for(provider):
def is_service_ready(provider):
if not _has_valid_cert(provider):
return False
+ if os.getuid() == 0:
+ # it's your problem if you run as root, not mine.
+ return True
if IS_LINUX and not is_pkexec_in_system():
log.warn('System has no pkexec')
return False
diff --git a/src/leap/bitmask/vpn/helpers/__init__.py b/src/leap/bitmask/vpn/helpers/__init__.py
index 69b34e00..b0f6990f 100644
--- a/src/leap/bitmask/vpn/helpers/__init__.py
+++ b/src/leap/bitmask/vpn/helpers/__init__.py
@@ -62,7 +62,6 @@ if IS_LINUX:
openvpn = (os.path.exists(OPENVPN_SYSTEM) or
_is_up_to_date(_config.get_bitmask_openvpn_path(),
OPENVPN_LOCAL, ""))
-
return helper and polkit and openvpn
def _is_up_to_date(src, local, system):
diff --git a/src/leap/bitmask/vpn/privilege.py b/src/leap/bitmask/vpn/privilege.py
index 1856ec8c..9c9ce130 100644
--- a/src/leap/bitmask/vpn/privilege.py
+++ b/src/leap/bitmask/vpn/privilege.py
@@ -147,6 +147,9 @@ class LinuxPolicyChecker(object):
# Note that gnome-shell does not uses a separate process for the
# polkit-agent, it uses a polkit-agent within its own process so we
# can't ps-grep a polkit process, we can ps-grep gnome-shell itself.
+ if os.getuid() == 0:
+ # if you're running as root, it's your problem, not mine.
+ return True
running = False
for proc in psutil.process_iter():
diff --git a/tests/functional/features/steps/vpn.py b/tests/functional/features/steps/vpn.py
index 489d4234..be50175d 100644
--- a/tests/functional/features/steps/vpn.py
+++ b/tests/functional/features/steps/vpn.py
@@ -22,7 +22,7 @@ def apply_dns_workaround():
resolv = commands.getoutput('cat /etc/resolv.conf')
print("original resolv.conf: %s" % resolv)
result = commands.getoutput(
- 'echo "nameserver 10.42.0.1" > /etc/resolv.conf')
+ 'echo "nameserver 10.41.0.1" > /etc/resolv.conf')
resolv2 = commands.getoutput('cat /etc/resolv.conf')
print("changed resolv.conf: %s" % resolv2)
print("Workaround OK")