X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/bfe7a62407aa0a6bc078659f259468f9b4105581..7209d0ade292bebbc8d92f8200778b3250e4130a:/build/run-tests.sh diff --git a/build/run-tests.sh b/build/run-tests.sh index 2831cf932e..8369632921 100755 --- a/build/run-tests.sh +++ b/build/run-tests.sh @@ -1,6 +1,9 @@ #!/bin/bash +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 -. `dirname "$(readlink -f "$0")"`/libcloud-pin +. `dirname "$(readlink -f "$0")"`/libcloud-pin.sh COLUMNS=80 . `dirname "$(readlink -f "$0")"`/run-library.sh @@ -22,6 +25,8 @@ Options: --leave-temp Do not remove GOPATH, virtualenv, and other temp dirs at exit. Instead, show the path to give as --temp to reuse them in subsequent invocations. +--repeat N Repeat each install/test step until it succeeds N times. +--retry Prompt to retry if an install or test suite fails. --skip-install Do not run any install steps. Just run tests. You should provide GOPATH, GEMHOME, and VENVDIR options from a previous invocation if you use this option. @@ -70,12 +75,14 @@ services/arv-git-httpd services/crunchstat services/dockercleaner services/fuse +services/health services/keep-web services/keepproxy services/keepstore services/keep-balance services/login-sync services/nodemanager +services/nodemanager_integration services/crunch-run services/crunch-dispatch-local services/crunch-dispatch-slurm @@ -83,17 +90,22 @@ services/ws sdk/cli sdk/pam sdk/python +sdk/python:py3 sdk/ruby sdk/go/arvados sdk/go/arvadosclient +sdk/go/dispatch sdk/go/keepclient +sdk/go/health sdk/go/httpserver sdk/go/manifest sdk/go/blockdigest sdk/go/streamer sdk/go/stats +sdk/go/version sdk/go/crunchrunner sdk/cwl +tools/arv-sync-groups tools/crunchstat-summary tools/keep-exercise tools/keep-rsync @@ -119,7 +131,7 @@ GEMHOME= PERLINSTALLBASE= short= -skip_install= +only_install= temp= temp_preserve= @@ -161,23 +173,26 @@ sanity_checks() { echo -n 'ruby: ' ruby -v \ || fatal "No ruby. Install >=2.1.9 (using rbenv, rvm, or source)" - echo -n 'bundler: ' - bundle version \ - || fatal "No bundler. Try: gem install bundler" echo -n 'go: ' go version \ || fatal "No go binary. See http://golang.org/doc/install" - [[ $(go version) =~ go1.([0-9]+) ]] && [[ ${BASH_REMATCH[1]} -ge 7 ]] \ - || fatal "Go >= 1.7 required. See http://golang.org/doc/install" + [[ $(go version) =~ go1.([0-9]+) ]] && [[ ${BASH_REMATCH[1]} -ge 8 ]] \ + || fatal "Go >= 1.8 required. See http://golang.org/doc/install" echo -n 'gcc: ' gcc --version | egrep ^gcc \ || fatal "No gcc. Try: apt-get install build-essential" echo -n 'fuse.h: ' - find /usr/include -wholename '*fuse/fuse.h' \ + find /usr/include -path '*fuse/fuse.h' | egrep --max-count=1 . \ || fatal "No fuse/fuse.h. Try: apt-get install libfuse-dev" - echo -n 'pyconfig.h: ' - find /usr/include -name pyconfig.h | egrep --max-count=1 . \ - || fatal "No pyconfig.h. Try: apt-get install python-dev" + echo -n 'gnutls.h: ' + find /usr/include -path '*gnutls/gnutls.h' | egrep --max-count=1 . \ + || fatal "No gnutls/gnutls.h. Try: apt-get install libgnutls28-dev" + echo -n 'Python2 pyconfig.h: ' + find /usr/include -path '*/python2*/pyconfig.h' | egrep --max-count=1 . \ + || fatal "No Python2 pyconfig.h. Try: apt-get install python2.7-dev" + echo -n 'Python3 pyconfig.h: ' + find /usr/include -path '*/python3*/pyconfig.h' | egrep --max-count=1 . \ + || fatal "No Python3 pyconfig.h. Try: apt-get install python3-dev" echo -n 'nginx: ' PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin" nginx -v \ || fatal "No nginx. Try: apt-get install nginx" @@ -192,6 +207,33 @@ sanity_checks() { echo -n 'gitolite: ' which gitolite \ || fatal "No gitolite. Try: apt-get install gitolite3" + echo -n 'npm: ' + npm --version \ + || fatal "No npm. Try: wget -O- https://nodejs.org/dist/v6.11.2/node-v6.11.2-linux-x64.tar.xz | sudo tar -C /usr/local -xJf - && sudo ln -s ../node-v6.11.2-linux-x64/bin/{node,npm} /usr/local/bin/" + echo -n 'cadaver: ' + cadaver --version | grep -w cadaver \ + || fatal "No cadaver. Try: apt-get install cadaver" + echo -n 'libattr1 xattr.h: ' + find /usr/include -path '*/attr/xattr.h' | egrep --max-count=1 . \ + || fatal "No libattr1 xattr.h. Try: apt-get install libattr1-dev" + echo -n 'libcurl curl.h: ' + find /usr/include -path '*/curl/curl.h' | egrep --max-count=1 . \ + || fatal "No libcurl curl.h. Try: apt-get install libcurl4-gnutls-dev" + echo -n 'libpq libpq-fe.h: ' + find /usr/include -path '*/postgresql/libpq-fe.h' | egrep --max-count=1 . \ + || fatal "No libpq libpq-fe.h. Try: apt-get install libpq-dev" + echo -n 'services/api/config/database.yml: ' + if [[ ! -f "$WORKSPACE/services/api/config/database.yml" ]]; then + fatal "Please provide a database.yml file for the test suite" + else + echo "OK" + fi + echo -n 'postgresql: ' + psql --version || fatal "No postgresql. Try: apt-get install postgresql postgresql-client-common" + echo -n 'phantomjs: ' + phantomjs --version || fatal "No phantomjs. Try: apt-get install phantomjs" + echo -n 'xvfb: ' + which Xvfb || fatal "No xvfb. Try: apt-get install xvfb" } rotate_logfile() { @@ -219,14 +261,7 @@ do exit 1 ;; --skip) - skipwhat="$1"; shift - if [[ "$skipwhat" == "apps/workbench" ]]; then - skip["apps/workbench_units"]=1 - skip["apps/workbench_functionals"]=1 - skip["apps/workbench_integration"]=1 - else - skip[$skipwhat]=1 - fi + skip[$1]=1; shift ;; --only) only="$1"; skip[$1]=""; shift @@ -235,10 +270,9 @@ do short=1 ;; --skip-install) - skip_install=1 + only_install=nothing ;; --only-install) - skip_install=1 only_install="$1"; shift ;; --temp) @@ -248,6 +282,9 @@ do --leave-temp) temp_preserve=1 ;; + --repeat) + repeat=$((${1}+0)); shift + ;; --retry) retry=1 ;; @@ -268,6 +305,13 @@ done start_api() { echo 'Starting API server...' + if [[ ! -d "$WORKSPACE/services/api/log" ]]; then + mkdir -p "$WORKSPACE/services/api/log" + fi + # Remove empty api.pid file if it exists + if [[ -f "$WORKSPACE/tmp/api.pid" && ! -s "$WORKSPACE/tmp/api.pid" ]]; then + rm -f "$WORKSPACE/tmp/api.pid" + fi cd "$WORKSPACE" \ && eval $(python sdk/python/tests/run_test_server.py start --auth admin) \ && export ARVADOS_TEST_API_HOST="$ARVADOS_API_HOST" \ @@ -343,13 +387,13 @@ done setup_ruby_environment() { if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then - source "$HOME/.rvm/scripts/rvm" - using_rvm=true + source "$HOME/.rvm/scripts/rvm" + using_rvm=true elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then - source "/usr/local/rvm/scripts/rvm" - using_rvm=true + source "/usr/local/rvm/scripts/rvm" + using_rvm=true else - using_rvm=false + using_rvm=false fi if [[ "$using_rvm" == true ]]; then @@ -398,12 +442,14 @@ setup_ruby_environment() { tmpdir_gem_home="$(env - PATH="$PATH" HOME="$GEMHOME" gem env gempath | cut -f1 -d:)" PATH="$tmpdir_gem_home/bin:$PATH" - export GEM_PATH="$tmpdir_gem_home:$(gem env gempath)" + export GEM_PATH="$tmpdir_gem_home" echo "Will install dependencies to $(gem env gemdir)" echo "Will install arvados gems to $tmpdir_gem_home" echo "Gem search path is GEM_PATH=$GEM_PATH" fi + bundle config || gem install bundler \ + || fatal 'install bundler' } with_test_gemset() { @@ -440,8 +486,10 @@ export PERLLIB="$PERLINSTALLBASE/lib/perl5:${PERLLIB:+$PERLLIB}" export GOPATH mkdir -p "$GOPATH/src/git.curoverse.com" -ln -sfn "$WORKSPACE" "$GOPATH/src/git.curoverse.com/arvados.git" \ +ln -sfT "$WORKSPACE" "$GOPATH/src/git.curoverse.com/arvados.git" \ || fatal "symlink failed" +go get -v github.com/kardianos/govendor \ + || fatal "govendor install failed" setup_virtualenv "$VENVDIR" --python python2.7 . "$VENVDIR/bin/activate" @@ -457,27 +505,47 @@ pip freeze 2>/dev/null | egrep ^apache-libcloud==$LIBCLOUD_PIN \ || pip install --pre --ignore-installed https://github.com/curoverse/libcloud/archive/apache-libcloud-$LIBCLOUD_PIN.zip >/dev/null \ || fatal "pip install apache-libcloud failed" -# Uninstall old llfuse (<1.0), because services/fuse "pip install" -# won't upgrade it by default. -if pip freeze | egrep '^llfuse==0'; then - yes | pip uninstall 'llfuse<1.0' -fi +# We need an unreleased (as of 2017-08-17) llfuse bugfix, otherwise our fuse test suite deadlocks. +pip freeze | grep -x llfuse==1.2.0 || ( + set -e + yes | pip uninstall llfuse || true + cython --version || fatal "no cython; try sudo apt-get install cython" + cd "$temp" + (cd python-llfuse 2>/dev/null || git clone https://github.com/curoverse/python-llfuse) + cd python-llfuse + git checkout 620722fd990ea642ddb8e7412676af482c090c0c + git checkout setup.py + sed -i -e "s:'1\\.2':'1.2.0':" setup.py + python setup.py build_cython + python setup.py install --force +) || fatal "llfuse fork failed" +pip freeze | grep -x llfuse==1.2.0 || fatal "error: installed llfuse 1.2.0 but '$(pip freeze | grep llfuse)' ???" # Deactivate Python 2 virtualenv deactivate +declare -a pythonstuff +pythonstuff=( + sdk/pam + sdk/python + sdk/python:py3 + sdk/cwl + services/dockercleaner:py3 + services/fuse + services/nodemanager + tools/crunchstat-summary + ) + # If Python 3 is available, set up its virtualenv in $VENV3DIR. # Otherwise, skip dependent tests. PYTHON3=$(which python3) -if [ "0" = "$?" ]; then +if [[ ${?} = 0 ]]; then setup_virtualenv "$VENV3DIR" --python python3 else PYTHON3= - skip[services/dockercleaner]=1 cat >&2 </dev/null + mkdir -p "$WORKSPACE/services/api/tmp/pids" + cd "$WORKSPACE/services/api" \ && RAILS_ENV=test bundle exec rake db:drop \ && RAILS_ENV=test bundle exec rake db:setup \ @@ -752,19 +816,26 @@ install_apiserver() { } do_install services/api apiserver +cd "$GOPATH/src/git.curoverse.com/arvados.git" && \ + "$GOPATH/bin/govendor" sync -v || \ + fatal "govendor sync failed" declare -a gostuff gostuff=( sdk/go/arvados sdk/go/arvadosclient sdk/go/blockdigest + sdk/go/dispatch + sdk/go/health sdk/go/httpserver sdk/go/manifest sdk/go/streamer sdk/go/crunchrunner sdk/go/stats + sdk/go/version lib/crunchstat services/arv-git-httpd services/crunchstat + services/health services/keep-web services/keepstore sdk/go/keepclient @@ -777,7 +848,8 @@ gostuff=( tools/keep-block-check tools/keep-exercise tools/keep-rsync - ) + tools/arv-sync-groups +) for g in "${gostuff[@]}" do do_install "$g" go @@ -786,10 +858,13 @@ done install_workbench() { cd "$WORKSPACE/apps/workbench" \ && mkdir -p tmp/cache \ - && RAILS_ENV=test bundle_install_trylocal + && RAILS_ENV=test bundle_install_trylocal \ + && RAILS_ENV=test RAILS_GROUPS=assets bundle exec rake npm:install } do_install apps/workbench workbench +unset http_proxy https_proxy no_proxy + test_doclinkchecker() { ( set -e @@ -818,7 +893,7 @@ if [ ! -z "$only" ] && [ "$only" == "services/api" ]; then exit_cleanly fi -start_api +start_api || { stop_services; fatal "start_api"; } test_ruby_sdk() { cd "$WORKSPACE/sdk/ruby" \ @@ -839,11 +914,25 @@ test_login-sync() { } do_test services/login-sync login-sync +test_nodemanager_integration() { + cd "$WORKSPACE/services/nodemanager" \ + && tests/integration_test.py ${testargs[services/nodemanager_integration]} +} +do_test services/nodemanager_integration nodemanager_integration + for p in "${pythonstuff[@]}" do - do_test "$p" pip + dir=${p%:py3} + if [[ ${dir} = ${p} ]]; then + if [[ -z ${skip[python2]} ]]; then + do_test ${dir} pip + fi + elif [[ -n ${PYTHON3} ]]; then + if [[ -z ${skip[python3]} ]]; then + do_test ${dir} pip "$VENV3DIR/bin/" + fi + fi done -do_test services/dockercleaner pip "$VENV3DIR/bin/" for g in "${gostuff[@]}" do