summaryrefslogtreecommitdiff
path: root/tests/functional
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2017-08-29 10:52:26 -0400
committerKali Kaneko <kali@leap.se>2017-08-30 16:20:41 -0400
commitbaf14c76a3cc083283e2fc7d981b02d38e4569c2 (patch)
treea6f547f3e061a8f4020ea346f38e19bfc01bf8c2 /tests/functional
parent356a8263653b2bc2dd2f1c0b7b4d800f0c536b74 (diff)
[tests] apply dns workaround
Diffstat (limited to 'tests/functional')
-rw-r--r--tests/functional/features/steps/vpn.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/functional/features/steps/vpn.py b/tests/functional/features/steps/vpn.py
index 4b83edb5..020ac7cb 100644
--- a/tests/functional/features/steps/vpn.py
+++ b/tests/functional/features/steps/vpn.py
@@ -1,3 +1,6 @@
+import commands
+import os
+
from behave import given, when, then
from common import (
click_button,
@@ -7,6 +10,26 @@ from selenium.common.exceptions import TimeoutException
# For checking IP
import requests
+resolv = None
+
+
+def apply_dns_workaround():
+ # we need this until we can get proper iptables execution
+ # because of the dns rewrite hacks in the firewall
+ print("CURRENT UID %s" % os.getuid())
+ if os.getuid() == 0:
+ global resolv
+ resolv = commands.getoutput('cat /etc/resolv.conf')
+ print("original resolv.conf: %s" % resolv)
+ commands.getoutput('echo nameserver 10.42.0.1 > /etc/ressolv.conf')
+ resolv2 = commands.getoutput('cat /etc/resolv.conf')
+ print("changed resolv.conf: %s" % resolv2)
+
+
+def deapply_dns_workaround():
+ if os.getuid() == 0:
+ commands.getoutput('echo nameserver 85.214.20.141 > /etc/resolv.conf')
+
@given('An initial network configuration')
def record_ip(context):
@@ -40,6 +63,7 @@ def activate_vpn(context):
@then('I should have my ass covered')
def assert_vpn(context):
wait_until_button_is_visible(context, 'Turn OFF')
+ apply_dns_workaround()
assert _current_ip() != context.initial_ip
@@ -51,5 +75,6 @@ def deactivate_vpn(context):
@then('My network should be configured as before')
def network_as_before(context):
+ deapply_dns_workaround()
ip = _current_ip()
assert ip == context.initial_ip