keep is now called keepstore
[arvados.git] / jenkins / run-tests.sh
index 80a551ac808371a6085fbdb1c4ecbcfcecbb3e9a..e9241501f760dbe5c333c871d0ad5deebfdc5f40 100755 (executable)
@@ -13,6 +13,14 @@ title () {
 source /etc/profile.d/rvm.sh
 echo $WORKSPACE
 
+export GOPATH=$(mktemp -d)
+mkdir -p "$GOPATH/src/git.curoverse.com"
+ln -sfn "$WORKSPACE" "$GOPATH/src/git.curoverse.com/arvados.git"
+
+VENVDIR=$(mktemp -d)
+virtualenv --setuptools "$VENVDIR"
+PATH="$VENVDIR/bin:$PATH"
+
 # DOCS
 title "Starting DOC build"
 cd "$WORKSPACE"
@@ -22,13 +30,31 @@ rm -rf .site
 # Make sure python-epydoc is installed or the next line won't do much good!
 PYTHONPATH=$WORKSPACE/sdk/python/ bundle exec rake generate baseurl=file://$WORKSPACE/doc/.site/ arvados_workbench_host=workbench.$ARVADOS_API_HOST arvados_api_host=$ARVADOS_API_HOST
 
-ECODE=$?
+checkexit() {
+    ECODE=$?
+
+    if [[ "$ECODE" != "0" ]]; then
+        title "!!!!!! $1 FAILED !!!!!!"
+        EXITCODE=$(($EXITCODE + $ECODE))
+    fi
+}
+
+goget() {
+    go get -t "git.curoverse.com/arvados.git/$1"
+    checkexit "$1 install"
+}
+
+gotest() {
+    title "Starting $1 tests"
+    cd "$WORKSPACE"
 
-if [[ "$ECODE" != "0" ]]; then
-  title "!!!!!! DOC BUILD FAILED !!!!!!"
-  EXITCODE=$(($EXITCODE + $ECODE))
-fi
+    go test "git.curoverse.com/arvados.git/$1"
 
+    checkexit "$1 tests"
+    title "$1 tests complete"
+}
+
+checkexit "Doc build"
 title "DOC build complete"
 
 # DOC linkchecker
@@ -37,13 +63,7 @@ cd "$WORKSPACE"
 cd doc
 bundle exec rake linkchecker baseurl=file://$WORKSPACE/doc/.site/
 
-ECODE=$?
-
-if [[ "$ECODE" != "0" ]]; then
-  title "!!!!!! DOC LINKCHECKER FAILED !!!!!!"
-  EXITCODE=$(($EXITCODE + $ECODE))
-fi
-
+checkexit "Doc linkchecker"
 title "DOC linkchecker complete"
 
 # API SERVER
@@ -94,113 +114,95 @@ bundle exec rake db:create
 bundle exec rake db:setup
 bundle exec rake test
 
-ECODE=$?
-
-if [[ "$ECODE" != "0" ]]; then
-  title "!!!!!! API SERVER TESTS FAILED !!!!!!"
-  EXITCODE=$(($EXITCODE + $ECODE))
-fi
-
+checkexit "API server tests"
 title "API server tests complete"
 
-# Keep
-title "Starting Keep tests"
-cd "$WORKSPACE"
-cd services/keep/src/keep
-GOPATH=$HOME/gocode go test
-
-ECODE=$?
-
-if [[ "$ECODE" != "0" ]]; then
-  title "!!!!!! Keep TESTS FAILED !!!!!!"
-  EXITCODE=$(($EXITCODE + $ECODE))
-fi
+# Install CLI gem's dependencies.
 
-title "Keep tests complete"
+cd "$WORKSPACE/sdk/cli"
+bundle install --deployment
 
-# WORKBENCH
-title "Starting workbench tests"
 cd "$WORKSPACE"
-cd apps/workbench
-bundle install --deployment
+gostuff="services/keepstore services/keepproxy sdk/go/arvadosclient sdk/go/keepclient sdk/go/streamer"
+for dir in $gostuff
+do
+  goget "$dir"
+done
 
-echo $PATH
+# Install the Python SDK early. Various other test suites (like
+# keepproxy) bring up run_test_server.py, which imports the arvados
+# module. We can't actually *test* the Python SDK yet though, because
+# its own test suite brings up some of those other programs (like
+# keepproxy).
 
+cd "$WORKSPACE/sdk/python"
+python setup.py egg_info -b ".$(git log --format=format:%ct.%h -n1 .)" sdist rotate --keep=1 --match .tar.gz
+pip install dist/arvados-python-client-0.1.*.tar.gz
 
-bundle exec rake test
+checkexit "Python SDK install"
 
-ECODE=$?
+cd "$WORKSPACE/services/fuse"
+python setup.py egg_info -b ".$(git log --format=format:%ct.%h -n1 .)" sdist rotate --keep=1 --match .tar.gz
+pip install dist/arvados_fuse-0.1.*.tar.gz
 
-if [[ "$ECODE" != "0" ]]; then
-  title "!!!!!! WORKBENCH TESTS FAILED !!!!!!"
-  EXITCODE=$(($EXITCODE + $ECODE))
-fi
+checkexit "FUSE install"
 
-title "Workbench tests complete"
+# Python SDK. We test this before testing keepproxy: keepproxy runs
+# run_test_server.py, which depends on the yaml package, which is in
+# tests_require but not install_requires, and therefore does not get
+# installed by setuptools until we run "setup.py test" *and* install
+# the .egg files that setup.py downloads.
 
-# Python SDK
 title "Starting Python SDK tests"
-cd "$WORKSPACE"
-cd sdk/cli
-bundle install --deployment
-
-# Set up Python SDK and dependencies
-
-cd "$WORKSPACE"
-cd sdk/python
+cd "$WORKSPACE/sdk/python"
 
-VENVDIR=$(mktemp -d)
-virtualenv --setuptools "$VENVDIR"
-GOPATH="$HOME/gocode" "$VENVDIR/bin/python" setup.py test
+python setup.py test
+checkexit "Python SDK tests"
+easy_install *.egg
 
-ECODE=$?
+title "Python tests complete"
 
-if [[ "$ECODE" != "0" ]]; then
-  title "!!!!!! Python SDK TESTS FAILED !!!!!!"
-  EXITCODE=$(($EXITCODE + $ECODE))
-fi
+# FUSE driver
 
-"$VENVDIR/bin/python" setup.py egg_info -b ".$(git log --format=format:%ct.%h -n1 .)" sdist rotate --keep=1
-"$VENVDIR/bin/pip" install dist/arvados-python-client-0.1.*.tar.gz
+title "Starting FUSE tests"
+cd "$WORKSPACE/services/fuse"
 
-ECODE=$?
+python setup.py test
+checkexit "FUSE tests"
+easy_install *.egg
 
-if [[ "$ECODE" != "0" ]]; then
-  title "!!!!!! Python SDK install FAILED !!!!!!"
-  EXITCODE=$(($EXITCODE + $ECODE))
-fi
+title "FUSE tests complete"
 
-cd "$WORKSPACE"
-cd services/fuse
 
-# We reuse $VENVDIR from the Python SDK tests above
-GOPATH="$HOME/gocode" "$VENVDIR/bin/python" setup.py test
+# Go SDK packages
 
-ECODE=$?
+for dir in $gostuff
+do
+  gotest "$dir"
+done
 
-if [[ "$ECODE" != "0" ]]; then
-  title "!!!!!! Fuse TESTS FAILED !!!!!!"
-  EXITCODE=$(($EXITCODE + $ECODE))
-fi
-
-"$VENVDIR/bin/python" setup.py egg_info -b ".$(git log --format=format:%ct.%h -n1 .)" sdist rotate --keep=1
-"$VENVDIR/bin/pip" install dist/arvados_fuse-0.1.*.tar.gz
+# Workbench
+title "Starting workbench tests"
+cd "$WORKSPACE"
+cd apps/workbench
+bundle install --deployment
 
-ECODE=$?
+echo $PATH
 
-if [[ "$ECODE" != "0" ]]; then
-  title "!!!!!! Fuse install FAILED !!!!!!"
-  EXITCODE=$(($EXITCODE + $ECODE))
-fi
+bundle exec rake test
 
-title "Python SDK tests complete"
+checkexit "Workbench tests"
+title "Workbench tests complete"
 
-# Clean up $VENVDIR
+# Clean up temporary virtualenv and GOPATH
 rm -rf "$VENVDIR"
+rm -rf "$GOPATH"
 
 # The CLI SDK tests require a working API server, so let's skip those for now.
 exit $EXITCODE
 
+########################################################################
+
 # CLI SDK
 title "Starting SDK CLI tests"
 cd "$WORKSPACE"
@@ -219,13 +221,7 @@ mkdir -p /tmp/keep
 export KEEP_LOCAL_STORE=/tmp/keep
 PYTHONPATH="$HOME/lib/python" bundle exec rake test
 
-ECODE=$?
-
-if [[ "$ECODE" != "0" ]]; then
-  title "!!!!!! SDK CLI TESTS FAILED !!!!!!"
-  EXITCODE=$(($EXITCODE + $ECODE))
-fi
-
+checkexit "SDK CLI tests"
 title "SDK CLI tests complete"
 
 exit $EXITCODE