summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2016-06-13 09:28:28 -0300
committerdrebs <drebs@leap.se>2016-06-22 17:51:18 -0300
commita973e1ffcb4bce613693a0a3bdcade615cf0b1cb (patch)
tree4c7c7f7bb7d55e99c2386ec05e628ec222911c39
parente8d3f659fbd15f7024eba0a9316634fde31b6bdc (diff)
[test] use docker for gitlab-ci tests
-rw-r--r--.gitlab-ci.yml6
-rwxr-xr-xscripts/docker/files/bin/run-trial-from-gitlab-ci.sh50
2 files changed, 54 insertions, 2 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c6d1998c..1aab6d74 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,3 +1,5 @@
-run_tests:
+image: leap/soledad:1.0
+
+test:
script:
- - /home/gitlab-runner/soledad/scripts/gitlab/run_tests.sh
+ - /usr/local/soledad/run-trial-from-gitlab-ci.sh
diff --git a/scripts/docker/files/bin/run-trial-from-gitlab-ci.sh b/scripts/docker/files/bin/run-trial-from-gitlab-ci.sh
new file mode 100755
index 00000000..96436e26
--- /dev/null
+++ b/scripts/docker/files/bin/run-trial-from-gitlab-ci.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+# Run Soledad trial tests in a docker container created by gitlab-ci.
+#
+# Gitlab-ci will copy the current test code into /builds/leap/soledad, so this
+# script has to uninstall currently installed soledad packages and re-install
+# from that location instead.
+#
+# This script is meant to be copied to the docker container and run upon
+# container start.
+
+CMD="/usr/local/soledad/setup-test-env.py"
+BASEDIR="/builds/leap/soledad"
+
+
+install_deps() {
+ # ensure all dependencies are installed
+ for pkg in common client server; do
+ testing="--testing"
+ if [ "${pkg}" = "server" ]; then
+ # soledad server doesn't currently have a requirements-testing.pip file,
+ # so we don't pass the option when that is the case
+ testing=""
+ fi
+ pip uninstall leap.soledad.${pkg}
+ (cd ${BASEDIR}/${pkg} \
+ && ./pkg/pip_install_requirements.sh ${testing} --use-leap-wheels \
+ && python setup.py develop)
+ done
+}
+
+
+start_couch() {
+ # currently soledad trial tests need a running couch on environment
+ ${CMD} couch start
+}
+
+
+run_tests() {
+ trial leap.soledad.common
+}
+
+
+main() {
+ install_deps
+ start_couch
+ run_tests
+}
+
+main