summaryrefslogtreecommitdiff
path: root/scripts/docker/files
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2016-06-10 22:07:35 -0300
committerdrebs <drebs@leap.se>2016-06-22 17:51:18 -0300
commit78d61dfaadf9bcac7258a33738c660b238b7bf27 (patch)
tree9cb2797e0cf0b09335be32d4f54b1e6d583a9558 /scripts/docker/files
parente14f17247ce03f1c49cab3c944039ff9aba84f64 (diff)
[test] refactor of docker scripts
Diffstat (limited to 'scripts/docker/files')
-rw-r--r--scripts/docker/files/apt/leap.list (renamed from scripts/docker/files/leap.list)0
-rw-r--r--scripts/docker/files/bin/client_side_db.py (renamed from scripts/docker/files/client_side_db.py)0
-rw-r--r--scripts/docker/files/bin/conf/cert_default.conf (renamed from scripts/docker/files/conf/cert_default.conf)0
-rw-r--r--scripts/docker/files/bin/conf/couchdb_default.ini (renamed from scripts/docker/files/conf/couchdb_default.ini)0
-rw-r--r--scripts/docker/files/bin/conf/soledad-server_default.conf (renamed from scripts/docker/files/conf/soledad-server_default.conf)0
-rwxr-xr-xscripts/docker/files/bin/run-client-bootstrap.sh (renamed from scripts/docker/files/start-client-test.sh)2
-rwxr-xr-xscripts/docker/files/bin/run-client-perf.sh (renamed from scripts/docker/files/run-perf-test.sh)10
-rwxr-xr-xscripts/docker/files/bin/run-server.sh (renamed from scripts/docker/files/start-server.sh)7
-rwxr-xr-xscripts/docker/files/bin/run-trial.sh (renamed from scripts/docker/files/start-trial-test.sh)2
-rwxr-xr-xscripts/docker/files/bin/setup-test-env.py (renamed from scripts/docker/files/test-env.py)0
-rw-r--r--scripts/docker/files/bin/util.py (renamed from scripts/docker/files/util.py)0
-rw-r--r--scripts/docker/files/bin/util.sh12
-rwxr-xr-xscripts/docker/files/build/install-deps-from-repos.sh30
-rwxr-xr-xscripts/docker/files/setup-env.sh55
14 files changed, 57 insertions, 61 deletions
diff --git a/scripts/docker/files/leap.list b/scripts/docker/files/apt/leap.list
index 7eb474d8..7eb474d8 100644
--- a/scripts/docker/files/leap.list
+++ b/scripts/docker/files/apt/leap.list
diff --git a/scripts/docker/files/client_side_db.py b/scripts/docker/files/bin/client_side_db.py
index 4be33d13..4be33d13 100644
--- a/scripts/docker/files/client_side_db.py
+++ b/scripts/docker/files/bin/client_side_db.py
diff --git a/scripts/docker/files/conf/cert_default.conf b/scripts/docker/files/bin/conf/cert_default.conf
index 8043cea3..8043cea3 100644
--- a/scripts/docker/files/conf/cert_default.conf
+++ b/scripts/docker/files/bin/conf/cert_default.conf
diff --git a/scripts/docker/files/conf/couchdb_default.ini b/scripts/docker/files/bin/conf/couchdb_default.ini
index 5ab72d7b..5ab72d7b 100644
--- a/scripts/docker/files/conf/couchdb_default.ini
+++ b/scripts/docker/files/bin/conf/couchdb_default.ini
diff --git a/scripts/docker/files/conf/soledad-server_default.conf b/scripts/docker/files/bin/conf/soledad-server_default.conf
index 5e286374..5e286374 100644
--- a/scripts/docker/files/conf/soledad-server_default.conf
+++ b/scripts/docker/files/bin/conf/soledad-server_default.conf
diff --git a/scripts/docker/files/start-client-test.sh b/scripts/docker/files/bin/run-client-bootstrap.sh
index 9dec3371..fbbb42e8 100755
--- a/scripts/docker/files/start-client-test.sh
+++ b/scripts/docker/files/bin/run-client-bootstrap.sh
@@ -5,7 +5,7 @@
# This script is meant to be copied to the docker container and run upon
# container start.
-CMD="/usr/local/soledad/test-env.py"
+CMD="/usr/local/soledad/setup-test-env.py"
REPO="/var/local/soledad"
if [ ! -z "${SOLEDAD_REMOTE}" ]; then
diff --git a/scripts/docker/files/run-perf-test.sh b/scripts/docker/files/bin/run-client-perf.sh
index ebd54d23..01b27b98 100755
--- a/scripts/docker/files/run-perf-test.sh
+++ b/scripts/docker/files/bin/run-client-perf.sh
@@ -23,7 +23,7 @@
# This script is meant to be copied to the docker container and run upon
# container start.
-CMD="/usr/local/soledad/test-env.py"
+CMD="/usr/local/soledad/setup-test-env.py"
REPO="/var/local/soledad"
TIMEOUT=20
@@ -74,6 +74,11 @@ auth_token = an-auth-token
stats_file = ./out/stats.json
EOF
+if [ "${1}" = "--drop-to-shell" ]; then
+ /bin/bash
+ exit 0
+fi
+
#-----------------------------------------------------------------------------
# start the local server and wait for it to come up
#-----------------------------------------------------------------------------
@@ -109,7 +114,7 @@ fi
# create docs and run test
#-----------------------------------------------------------------------------
-#set -e
+set -e
# create documents in client
make trigger-create-docs
@@ -121,4 +126,3 @@ sleep 5 # wait a bit for some data points
# run a sync and generate a graph
make trigger-sync
make trigger-stop
-make graph-image
diff --git a/scripts/docker/files/start-server.sh b/scripts/docker/files/bin/run-server.sh
index 0980d352..feedee7e 100755
--- a/scripts/docker/files/start-server.sh
+++ b/scripts/docker/files/bin/run-server.sh
@@ -18,7 +18,7 @@
# This script is meant to be copied to the docker container and run upon
# container start.
-CMD="/usr/local/soledad/test-env.py"
+CMD="/usr/local/soledad/setup-test-env.py"
#---------------------------------------------------------------------------
# eventually checkout a specific branch from a specific remote
@@ -80,5 +80,10 @@ fi
# actually run the server
#---------------------------------------------------------------------------
+if [ "${1}" = "--drop-to-shell" ]; then
+ /bin/bash
+ exit 0
+fi
+
echo "Starting soledad server..."
${CMD} soledad-server start --no-daemonize
diff --git a/scripts/docker/files/start-trial-test.sh b/scripts/docker/files/bin/run-trial.sh
index ad139288..f38f3124 100755
--- a/scripts/docker/files/start-trial-test.sh
+++ b/scripts/docker/files/bin/run-trial.sh
@@ -5,7 +5,7 @@
# This script is meant to be copied to the docker container and run upon
# container start.
-CMD="/usr/local/soledad/test-env.py"
+CMD="/usr/local/soledad/setup-test-env.py"
REPO="/var/local/soledad"
if [ ! -z "${SOLEDAD_REMOTE}" ]; then
diff --git a/scripts/docker/files/test-env.py b/scripts/docker/files/bin/setup-test-env.py
index 0569b65d..0569b65d 100755
--- a/scripts/docker/files/test-env.py
+++ b/scripts/docker/files/bin/setup-test-env.py
diff --git a/scripts/docker/files/util.py b/scripts/docker/files/bin/util.py
index e7e2ef9a..e7e2ef9a 100644
--- a/scripts/docker/files/util.py
+++ b/scripts/docker/files/bin/util.py
diff --git a/scripts/docker/files/bin/util.sh b/scripts/docker/files/bin/util.sh
new file mode 100644
index 00000000..77287d0d
--- /dev/null
+++ b/scripts/docker/files/bin/util.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+configure_soledad_repos() {
+ if [ ! -z "${SOLEDAD_REMOTE}" ]; then
+ git -C ${REPO} remote set-url origin ${SOLEDAD_REMOTE}
+ git -C ${REPO} fetch origin
+ fi
+
+ if [ ! -z "${SOLEDAD_BRANCH}" ]; then
+ git -C ${REPO} checkout ${SOLEDAD_BRANCH}
+ fi
+}
diff --git a/scripts/docker/files/build/install-deps-from-repos.sh b/scripts/docker/files/build/install-deps-from-repos.sh
new file mode 100755
index 00000000..46530c86
--- /dev/null
+++ b/scripts/docker/files/build/install-deps-from-repos.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+# Install dependencies needed to run client and server in a test environment.
+#
+# In details, this script does the following:
+#
+# - install dependencies for packages in /var/local from their requirements
+# files in each of the repositories, using python wheels when possible.
+#
+# - install the python packages in development mode
+#
+# This script is meant to be copied to the docker container during container
+# build and run after system dependencies have been installed.
+
+BASEDIR="/var/local"
+
+# install dependencies and packages
+install_script="pkg/pip_install_requirements.sh"
+opts="--use-leap-wheels"
+pkgs="leap_pycommon soledad/common soledad/client soledad/server"
+
+for pkg in ${pkgs}; do
+ pkgdir=${BASEDIR}/${pkg}
+ testing=""
+ if [ -f ${pkgdir}/pkg/requirements-testing.pip ]; then
+ testing="--testing"
+ fi
+ (cd ${pkgdir} && ${install_script} ${testing} ${opts})
+ (cd ${pkgdir} && python setup.py develop)
+done
diff --git a/scripts/docker/files/setup-env.sh b/scripts/docker/files/setup-env.sh
deleted file mode 100755
index d5aeab7d..00000000
--- a/scripts/docker/files/setup-env.sh
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/bin/bash
-
-# Clone soledad repository and install soledad dependencies needed to run
-# client and server in a test environment.
-#
-# In details, this script does the following:
-#
-# - clone a series of python package repositories into /var/local/soledad.
-# - install dependencies for those packages from the requirements files in
-# each of the repositories, using python wheels when possible.
-# - install the python packages in development mode
-#
-# The cloned git repositories might have a remote configured and a branch
-# checked out on runtime, before a server, client or test instance is actually
-# run. Check the other scripts in this directory.
-#
-# This script is meant to be copied to the docker container and run after
-# system dependencies have been installed.
-
-BASEDIR="/var/local"
-BASEURL="https://github.com/leapcode"
-
-mkdir -p ${BASEDIR}
-
-# clone repositories
-repos="soledad leap_pycommon soledad-perf"
-
-for repo in ${repos}; do
- repodir=${BASEDIR}/${repo}
- if [ ! -d ${repodir} ]; then
- git clone ${BASEURL}/${repo} ${repodir}
- git -C ${repodir} fetch origin
- fi
-done
-
-# use latest pip because the version available in debian jessie doesn't
-# support wheels
-pip install -U pip
-
-pip install psutil
-
-# install dependencies and packages
-install_script="pkg/pip_install_requirements.sh"
-opts="--use-leap-wheels"
-pkgs="leap_pycommon soledad/common soledad/client soledad/server"
-
-for pkg in ${pkgs}; do
- pkgdir=${BASEDIR}/${pkg}
- testing=""
- if [ -f ${pkgdir}/pkg/requirements-testing.pip ]; then
- testing="--testing"
- fi
- (cd ${pkgdir} && ${install_script} ${testing} ${opts})
- (cd ${pkgdir} && python setup.py develop)
-done