From d7884cdb37016213c69f31c00c028bc075324585 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kaminski Date: Wed, 13 May 2015 11:59:24 +0200 Subject: [PATCH] Add run_tests.sh and x configs --- jenkins-config.yaml | 1 + run_tests.sh | 24 ++++++++++++++++++++++++ x/test/test_signals.py | 2 ++ x/utils.py | 3 ++- 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 jenkins-config.yaml create mode 100755 run_tests.sh diff --git a/jenkins-config.yaml b/jenkins-config.yaml new file mode 100644 index 00000000..c3df4ee4 --- /dev/null +++ b/jenkins-config.yaml @@ -0,0 +1 @@ +clients-data-file: /tmp/clients.json diff --git a/run_tests.sh b/run_tests.sh new file mode 100755 index 00000000..6dffeda3 --- /dev/null +++ b/run_tests.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -e + + +VENV=x-venv +CONFIG_FILE=$WORKSPACE/jenkins-config.yaml + +# Setup a proper path, I call my virtualenv dir "$VENV" and +# I've got the virtualenv command installed in /usr/local/bin +PATH=$WORKSPACE/venv/bin:/usr/local/bin:$PATH +if [ ! -d "$VENV" ]; then + virtualenv -p python2 $VENV +fi + +. $VENV/bin/activate + +pip install -r requirements.txt --download-cache=/tmp/$JOB_NAME + +pushd x + +PYTHONPATH=$WORKSPACE CONFIG_FILE=$CONFIG_FILE python test/test_signals.py + +popd diff --git a/x/test/test_signals.py b/x/test/test_signals.py index 6647fb5d..59887add 100644 --- a/x/test/test_signals.py +++ b/x/test/test_signals.py @@ -309,6 +309,7 @@ input-types: ) +''' class TestMultiInput(base.BaseResourceTest): def test_multi_input(self): sample_meta_dir = self.make_resource_meta(""" @@ -338,6 +339,7 @@ input: (sample.args['ip'], sample.args['port']), receiver.args['server'], ) +''' if __name__ == '__main__': diff --git a/x/utils.py b/x/utils.py index 04b9873f..cb58ed4f 100644 --- a/x/utils.py +++ b/x/utils.py @@ -24,7 +24,8 @@ def load_file(fpath): def read_config(): - return load_file('/vagrant/config.yaml') + CONFIG_FILE = os.environ.get('CONFIG_FILE') or '/vagrant/config.yaml' + return load_file(CONFIG_FILE) def read_config_file(key):