summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2017-08-16 11:28:21 -0400
committerKali Kaneko <kali@leap.se>2017-08-16 17:56:05 -0400
commit29250b7f94872035caaf8d6e1ac39983d09840e6 (patch)
tree3c07b6a39dcca182caa1fa325cde45370ccaecc8
parent9d1360c9fd5e3cb4d34ff6efac98bea92bf85c92 (diff)
WIP: [tests] run behave against bundle
-rwxr-xr-xpkg/build_bundle_with_venv.sh4
-rw-r--r--tests/functional/features/environment.py29
-rw-r--r--tests/functional/features/steps/bitmask.py14
3 files changed, 38 insertions, 9 deletions
diff --git a/pkg/build_bundle_with_venv.sh b/pkg/build_bundle_with_venv.sh
index 706f17e5..17fc0a2e 100755
--- a/pkg/build_bundle_with_venv.sh
+++ b/pkg/build_bundle_with_venv.sh
@@ -49,9 +49,7 @@ $VIRTUAL_ENV/bin/python setup.py sdist bdist_wheel --universal
echo "[+] Installing Bitmask from latest wheel..."
$VIRTUAL_ENV/bin/pip install `ls -ltr dist/*.whl | tail -n 1 | cut -d' ' -f 9`
-
# Get the bundled libzmq
-$VIRTUAL_ENV/bin/pip uninstall --yes pyzmq
-$VIRTUAL_ENV/bin/pip install pyzmq --install-option="--zmq=bundled"
+$VIRTUAL_ENV/bin/pip install -I pyzmq --install-option="--zmq=bundled"
make bundle_linux
diff --git a/tests/functional/features/environment.py b/tests/functional/features/environment.py
index ae72b496..8430d78e 100644
--- a/tests/functional/features/environment.py
+++ b/tests/functional/features/environment.py
@@ -12,9 +12,27 @@ from leap.common.config import get_path_prefix
DEFAULT_IMPLICIT_WAIT_TIMEOUT_IN_S = 10
HOME_PATH = os.path.abspath('./tmp/bitmask-test')
+VIRTUALENV = 'virtualenv'
+BUNDLE = 'bundle'
+BUNDLE_CI = 'bundle-ci'
+
+MODE = VIRTUALENV
+
+
+def set_mode(mode):
+ global MODE
+ if mode not in (VIRTUALENV, BUNDLE, BUNDLE_CI):
+ raise ValueError('Unknown test mode: %s' % mode)
+ MODE = mode
+ return mode
+
def before_all(context):
os.environ['HOME'] = HOME_PATH
+ mode = os.environ.get('TEST_MODE', 'virtualenv')
+ set_mode(mode)
+ context.mode = mode
+
_setup_webdriver(context)
userdata = context.config.userdata
context.host = userdata.get('host', 'http://localhost')
@@ -30,6 +48,14 @@ def before_all(context):
print('TEST_USERNAME or TEST_PASSWORD not set')
sys.exit(0)
+ if MODE == BUNDLE:
+ next_version = open('pkg/next-version').read().strip()
+ context.bundle_path = os.path.abspath(
+ os.path.join('dist', 'bitmask-' + next_version))
+ elif MODE == BUNDLE_CI:
+ # TODO set path to artifact XXX ---
+ context.bundle_path = None
+
def _setup_webdriver(context):
chrome_options = Options()
@@ -45,7 +71,8 @@ def _setup_webdriver(context):
def after_all(context):
context.browser.quit()
- commands.getoutput('bitmaskctl stop')
+ if MODE == VIRTUALENV:
+ commands.getoutput('bitmaskctl stop')
def after_step(context, step):
diff --git a/tests/functional/features/steps/bitmask.py b/tests/functional/features/steps/bitmask.py
index d9f90578..fbba75ba 100644
--- a/tests/functional/features/steps/bitmask.py
+++ b/tests/functional/features/steps/bitmask.py
@@ -9,11 +9,15 @@ from behave import given
@given('I start bitmask for the first time')
def initial_run(context):
- commands.getoutput('bitmaskctl stop')
- # TODO: fix bitmaskctl to only exit once bitmaskd has stopped
- time.sleep(2)
- _initialize_home_path()
- commands.getoutput('bitmaskctl start')
+ if context.MODE == 'virtualenv':
+ commands.getoutput('bitmaskctl stop')
+ # TODO: fix bitmaskctl to only exit once bitmaskd has stopped
+ time.sleep(2)
+ _initialize_home_path()
+ commands.getoutput('bitmaskctl start')
+ elif context.MODE == 'bundle':
+ commands.getoutput(context.bundle_path)
+ time.sleep(2)
tokenpath = os.path.join(get_path_prefix(), 'leap', 'authtoken')
token = open(tokenpath).read().strip()
context.login_url = "http://localhost:7070/#%s" % token