X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/39cfbff065282869d8dadab2474dfaae4ba0b86a..3a49dbda04d01ea83d6a3fde721c28cbebff58eb:/build/run-tests.sh diff --git a/build/run-tests.sh b/build/run-tests.sh index 67c54c98b0..0eb421454e 100755 --- a/build/run-tests.sh +++ b/build/run-tests.sh @@ -21,7 +21,8 @@ Options: --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. ---only FOO Do not test anything except the FOO component. +--only FOO Do not test anything except the FOO component. If given + more than once, all specified test suites are run. --temp DIR Install components and dependencies under DIR instead of making a new temporary directory. Implies --leave-temp. --leave-temp Do not remove GOPATH, virtualenv, and other temp dirs at exit. @@ -29,18 +30,17 @@ Options: 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. ---only-install Run specific install step +--only-install Run specific install step. If given more than once, + all but the last are ignored. --short Skip (or scale down) some slow tests. --interactive Set up, then prompt for test/install steps to perform. WORKSPACE=path Arvados source tree to test. CONFIGSRC=path Dir with config.yml file containing PostgreSQL section for use by tests. services/api_test="TEST=test/functional/arvados/v1/collections_controller_test.rb" Restrict apiserver tests to the given file -sdk/python_test="--test-suite tests.test_keep_locator" +sdk/python_test="tests/test_api.py::ArvadosApiTest" Restrict Python SDK tests to the given class -apps/workbench_test="TEST=test/integration/pipeline_instances_test.rb" - Restrict Workbench tests to the given file -services/arv-git-httpd_test="-check.vv" +lib/dispatchcloud_test="-check.vv" Show all log messages, even when tests pass (also works with services/keepstore_test etc.) ARVADOS_DEBUG=1 @@ -58,17 +58,12 @@ defaults to $HOME/arvados-api-server if that directory exists. More information and background: -https://arvados.org/projects/arvados/wiki/Running_tests +https://dev.arvados.org/projects/arvados/wiki/Running_tests Available tests: -apps/workbench (*) -apps/workbench_units (*) -apps/workbench_functionals (*) -apps/workbench_integration (*) -apps/workbench_benchmark -apps/workbench_profile cmd/arvados-client +cmd/arvados-package cmd/arvados-server doc lib/cli @@ -92,8 +87,6 @@ lib/mount lib/pam lib/service services/api -services/arv-git-httpd -services/crunchstat services/dockercleaner services/fuse services/fuse:py3 @@ -105,10 +98,13 @@ services/keep-balance services/login-sync services/crunch-dispatch-local services/crunch-dispatch-slurm +services/workbench2_units +services/workbench2_integration services/ws sdk/cli sdk/python sdk/python:py3 +sdk/ruby-google-api-client sdk/ruby sdk/go/arvados sdk/go/arvadosclient @@ -132,9 +128,6 @@ tools/keep-exercise tools/keep-rsync tools/keep-block-check -(*) apps/workbench is shorthand for apps/workbench_units + - apps/workbench_functionals + apps/workbench_integration - EOF # First make sure to remove any ARVADOS_ variables from the calling @@ -149,7 +142,6 @@ VENVDIR= VENV3DIR= PYTHONPATH= GEMHOME= -PERLINSTALLBASE= R_LIBS= export LANG=en_US.UTF-8 @@ -158,6 +150,8 @@ only_install= temp= temp_preserve= +ignore_sigint= + clear_temp() { if [[ -z "$temp" ]]; then # we did not even get as far as making a temp dir @@ -180,10 +174,6 @@ fatal() { exit_cleanly() { trap - INT - if which create-plot-data-from-log.sh >/dev/null; then - create-plot-data-from-log.sh $BUILD_NUMBER "$WORKSPACE/apps/workbench/log/test.log" "$WORKSPACE/apps/workbench/log/" - fi - rotate_logfile "$WORKSPACE/apps/workbench/log/" "test.log" stop_services rotate_logfile "$WORKSPACE/services/api/log/" "test.log" report_outcomes @@ -203,7 +193,7 @@ sanity_checks() { || fatal "Locale '${LANG}' is broken/missing. Try: echo ${LANG} | sudo tee -a /etc/locale.gen && sudo locale-gen" echo -n 'ruby: ' ruby -v \ - || fatal "No ruby. Install >=2.1.9 (using rbenv, rvm, or source)" + || fatal "No ruby. Install >=2.7 from package or source" echo -n 'go: ' go version \ || fatal "No go binary. See http://golang.org/doc/install" @@ -219,7 +209,8 @@ sanity_checks() { find /usr/include -path '*gnutls/gnutls.h' | egrep --max-count=1 . \ || fatal "No gnutls/gnutls.h. Try: apt-get install libgnutls28-dev" echo -n 'virtualenv: ' - python3 -m venv -h | egrep --max-count=1 . \ + python3 -m venv --help | grep -q '^usage: venv ' \ + && echo "venv module found" \ || fatal "No virtualenv. Try: apt-get install python3-venv" echo -n 'Python3 pyconfig.h: ' find /usr/include -path '*/python3*/pyconfig.h' | egrep --max-count=1 . \ @@ -229,20 +220,9 @@ sanity_checks() { echo -n 'nginx: ' PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin" nginx -v \ || fatal "No nginx. Try: apt-get install nginx" - echo -n 'perl: ' - perl -v | grep version \ - || fatal "No perl. Try: apt-get install perl" - for mod in ExtUtils::MakeMaker JSON LWP Net::SSL; do - echo -n "perl $mod: " - perl -e "use $mod; print \"\$$mod::VERSION\\n\"" \ - || fatal "No $mod. Try: apt-get install perl-modules libcrypt-ssleay-perl libjson-perl libwww-perl" - done - 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/v10.23.1/node-v10.23.1-linux-x64.tar.xz | sudo tar -C /usr/local -xJf - && sudo ln -s ../node-v10.23.1-linux-x64/bin/{node,npm} /usr/local/bin/" + || fatal "No npm. Try: wget -O- https://nodejs.org/dist/v12.22.12/node-v12.22.12-linux-x64.tar.xz | sudo tar -C /usr/local -xJf - && sudo ln -s ../node-v12.22.12-linux-x64/bin/{node,npm} /usr/local/bin/" echo -n 'cadaver: ' cadaver --version | grep -w cadaver \ || fatal "No cadaver. Try: apt-get install cadaver" @@ -260,14 +240,16 @@ sanity_checks() { || fatal "No libpam pam_appl.h. Try: apt-get install libpam0g-dev" 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" echo -n 'graphviz: ' dot -V || fatal "No graphviz. Try: apt-get install graphviz" - echo -n 'geckodriver: ' - geckodriver --version | grep ^geckodriver || echo "No geckodriver. Try: wget -O- https://github.com/mozilla/geckodriver/releases/download/v0.23.0/geckodriver-v0.23.0-linux64.tar.gz | sudo tar -C /usr/local/bin -xzf - geckodriver" + echo -n 'singularity: ' + singularity --version || fatal "No singularity. Try: arvados-server install" + echo -n 'docker client: ' + docker --version || echo "No docker client. Try: arvados-server install" + echo -n 'docker server: ' + docker info --format='{{.ServerVersion}}' || echo "No docker server. Try: arvados-server install" if [[ "$NEED_SDK_R" = true ]]; then # R SDK stuff @@ -287,7 +269,7 @@ sanity_checks() { } rotate_logfile() { - # i.e. rotate_logfile "$WORKSPACE/apps/workbench/log/" "test.log" + # i.e. rotate_logfile "$WORKSPACE/services/api/log/" "test.log" # $BUILD_NUMBER is set by Jenkins if this script is being called as part of a Jenkins run if [[ -f "$1/$2" ]]; then THEDATE=`date +%Y%m%d%H%M%S` @@ -300,7 +282,6 @@ declare -a failures declare -A skip declare -A only declare -A testargs -skip[apps/workbench_profile]=1 while [[ -n "$1" ]] do @@ -410,7 +391,7 @@ start_services() { return 0 fi . "$VENV3DIR/bin/activate" - echo 'Starting API, controller, keepproxy, keep-web, arv-git-httpd, ws, and nginx ssl proxy...' + echo 'Starting API, controller, keepproxy, keep-web, ws, and nginx ssl proxy...' if [[ ! -d "$WORKSPACE/services/api/log" ]]; then mkdir -p "$WORKSPACE/services/api/log" fi @@ -438,9 +419,6 @@ start_services() { && python3 sdk/python/tests/run_test_server.py start_keep-web \ && checkpidfile keep-web \ && checkhealth WebDAV \ - && python3 sdk/python/tests/run_test_server.py start_arv-git-httpd \ - && checkpidfile arv-git-httpd \ - && checkhealth GitHTTP \ && python3 sdk/python/tests/run_test_server.py start_ws \ && checkpidfile ws \ && export ARVADOS_TEST_PROXY_SERVICES=1 \ @@ -461,7 +439,6 @@ stop_services() { . "$VENV3DIR/bin/activate" || return cd "$WORKSPACE" \ && python3 sdk/python/tests/run_test_server.py stop_nginx \ - && python3 sdk/python/tests/run_test_server.py stop_arv-git-httpd \ && python3 sdk/python/tests/run_test_server.py stop_ws \ && python3 sdk/python/tests/run_test_server.py stop_keep-web \ && python3 sdk/python/tests/run_test_server.py stop_keep_proxy \ @@ -473,104 +450,46 @@ stop_services() { } interrupt() { + if [[ -n "$ignore_sigint" ]]; then + echo >&2 "ignored SIGINT" + return + fi failures+=("($(basename $0) interrupted)") exit_cleanly } trap interrupt INT setup_ruby_environment() { - if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then - 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 - else - using_rvm=false - fi - - if [[ "$using_rvm" == true ]]; then - # If rvm is in use, we can't just put separate "dependencies" - # and "gems-under-test" paths to GEM_PATH: passenger resets - # the environment to the "current gemset", which would lose - # our GEM_PATH and prevent our test suites from running ruby - # programs (for example, the Workbench test suite could not - # boot an API server or run arv). Instead, we have to make an - # rvm gemset and use it for everything. - - [[ `type rvm | head -n1` == "rvm is a function" ]] \ - || fatal 'rvm check' - - # Put rvm's favorite path back in first place (overriding - # virtualenv, which just put itself there). Ignore rvm's - # complaint about not being in first place already. - rvm use @default 2>/dev/null - - # Create (if needed) and switch to an @arvados-tests-* gemset, - # salting the gemset name so it doesn't interfere with - # concurrent builds in other workspaces. Leave the choice of - # ruby to the caller. - gemset="arvados-tests-$(echo -n "${WORKSPACE}" | md5sum | head -c16)" - rvm use "@${gemset}" --create \ - || fatal 'rvm gemset setup' - - rvm env - (bundle version | grep -q 2.2.19) || gem install --no-document bundler -v 2.2.19 - bundle="$(which bundle)" - echo "$bundle" - "$bundle" version | grep 2.2.19 || fatal 'install bundler' - else - # When our "bundle install"s need to install new gems to - # satisfy dependencies, we want them to go where "gem install - # --user-install" would put them. (However, if the caller has - # already set GEM_HOME, we assume that's where dependencies - # should be installed, and we should leave it alone.) - - if [ -z "$GEM_HOME" ]; then - user_gempath="$(gem env gempath)" - export GEM_HOME="${user_gempath%%:*}" - fi - PATH="$(gem env gemdir)/bin:$PATH" - - # When we build and install our own gems, we install them in our - # $GEMHOME tmpdir, and we want them to be at the front of GEM_PATH and - # PATH so integration tests prefer them over other versions that - # happen to be installed in $user_gempath, system dirs, etc. - - 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)" - - echo "Will install dependencies to $(gem env gemdir)" - echo "Will install bundler and arvados gems to $tmpdir_gem_home" - echo "Gem search path is GEM_PATH=$GEM_PATH" - bundle="bundle" - ( - export HOME=$GEMHOME - versions=(2.2.19) - for v in ${versions[@]}; do - if ! gem list --installed --version "${v}" bundler >/dev/null; then - gem install --no-document --user $(for v in ${versions[@]}; do echo bundler:${v}; done) - break - fi - done - "$bundle" version | tee /dev/stderr | grep -q 'version 2' - ) || fatal 'install bundler' - if test -d /var/lib/arvados-arvbox/ ; then - # Inside arvbox, use bundler-installed binstubs. The - # system bundler and rail's own bin/bundle refuse to work. - # I don't know why. - bundle=binstubs/bundle - fi + # When our "bundle install"s need to install new gems to + # satisfy dependencies, we want them to go where "gem install + # --user-install" would put them. (However, if the caller has + # already set GEM_HOME, we assume that's where dependencies + # should be installed, and we should leave it alone.) + + if [ -z "$GEM_HOME" ]; then + user_gempath="$(gem env gempath)" + export GEM_HOME="${user_gempath%%:*}" fi + PATH="$(gem env gemdir)/bin:$PATH" + + # When we build and install our own gems, we install them in our + # $GEMHOME tmpdir, and we want them to be at the front of GEM_PATH and + # PATH so integration tests prefer them over other versions that + # happen to be installed in $user_gempath, system dirs, etc. + + 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)" + + echo "Will install dependencies to $(gem env gemdir)" + echo "Will install bundler and arvados gems to $tmpdir_gem_home" + echo "Gem search path is GEM_PATH=$GEM_PATH" + gem install --user --no-document --conservative --version '~> 2.4.0' bundler \ + || fatal 'install bundler' } with_test_gemset() { - if [[ "$using_rvm" == true ]]; then - "$@" - else - GEM_HOME="$tmpdir_gem_home" GEM_PATH="$tmpdir_gem_home" "$@" - fi + GEM_HOME="$tmpdir_gem_home" GEM_PATH="$tmpdir_gem_home" "$@" } gem_uninstall_if_exists() { @@ -586,7 +505,7 @@ setup_virtualenv() { elif [[ -n "$short" ]]; then return fi - "$venvdest/bin/pip3" install --no-cache-dir 'setuptools>=18.5' 'pip>=7' + "$venvdest/bin/pip3" install --no-cache-dir 'setuptools>=68' 'pip>=20' } initialize() { @@ -608,7 +527,7 @@ initialize() { fi # Set up temporary install dirs (unless existing dirs were supplied) - for tmpdir in VENV3DIR GOPATH GEMHOME PERLINSTALLBASE R_LIBS + for tmpdir in VENV3DIR GOPATH GEMHOME R_LIBS do if [[ -z "${!tmpdir}" ]]; then eval "$tmpdir"="$temp/$tmpdir" @@ -620,9 +539,6 @@ initialize() { rm -vf "${WORKSPACE}/tmp/*.log" - export PERLINSTALLBASE - export PERL5LIB="$PERLINSTALLBASE/lib/perl5${PERL5LIB:+:$PERL5LIB}" - export R_LIBS export GOPATH @@ -638,8 +554,6 @@ initialize() { unset http_proxy https_proxy no_proxy - # Note: this must be the last time we change PATH, otherwise rvm will - # whine a lot. setup_ruby_environment echo "PATH is $PATH" @@ -652,22 +566,17 @@ install_env() { setup_virtualenv "$VENV3DIR" . "$VENV3DIR/bin/activate" - # Needed for run_test_server.py which is used by certain (non-Python) tests. - # pdoc3 needed to generate the Python SDK documentation. - ( - set -e - "${VENV3DIR}/bin/pip3" install wheel - "${VENV3DIR}/bin/pip3" install PyYAML - "${VENV3DIR}/bin/pip3" install httplib2 - "${VENV3DIR}/bin/pip3" install future - "${VENV3DIR}/bin/pip3" install google-api-python-client - "${VENV3DIR}/bin/pip3" install ciso8601 - "${VENV3DIR}/bin/pip3" install pycurl - "${VENV3DIR}/bin/pip3" install ws4py - "${VENV3DIR}/bin/pip3" install pdoc3 - cd "$WORKSPACE/sdk/python" - python3 setup.py install - ) || fatal "installing PyYAML and sdk/python failed" + # parameterized and pytest are direct dependencies of Python tests. + # PyYAML is a test requirement used by run_test_server.py and needed for + # other, non-Python tests. + # pdoc is needed to build PySDK documentation. + # wheel modernizes the venv (as of early 2024) and makes it more closely + # match our package build environment. + # We run `setup.py build` first to generate _version.py. + pip install parameterized pytest PyYAML pdoc wheel \ + && env -C "$WORKSPACE/sdk/python" python3 setup.py build \ + && pip install "$WORKSPACE/sdk/python" \ + || fatal "installing Python SDK and related dependencies failed" } retry() { @@ -695,8 +604,8 @@ retry() { do_test() { case "${1}" in - apps/workbench_units | apps/workbench_functionals | apps/workbench_integration) - suite=apps/workbench + services/workbench2_units | services/workbench2_integration) + suite=services/workbench2 ;; *) suite="${1}" @@ -712,7 +621,22 @@ do_test() { stop_services check_arvados_config "$1" ;; - gofmt | doc | lib/cli | lib/cloud/azure | lib/cloud/ec2 | lib/cloud/cloudtest | lib/cmd | lib/dispatchcloud/sshexecutor | lib/dispatchcloud/worker) + gofmt \ + | arvados_version.py \ + | cmd/arvados-package \ + | doc \ + | lib/boot \ + | lib/cli \ + | lib/cloud/azure \ + | lib/cloud/cloudtest \ + | lib/cloud/ec2 \ + | lib/cmd \ + | lib/dispatchcloud/sshexecutor \ + | lib/dispatchcloud/worker \ + | lib/install \ + | services/workbench2_integration \ + | services/workbench2_units \ + ) check_arvados_config "$1" # don't care whether services are running ;; @@ -730,7 +654,7 @@ do_test() { go_ldflags() { version=${ARVADOS_VERSION:-$(git log -n1 --format=%H)-dev} - echo "-X git.arvados.org/arvados.git/lib/cmd.version=${version} -X main.version=${version}" + echo "-X git.arvados.org/arvados.git/lib/cmd.version=${version} -X main.version=${version} -s -w" } do_test_once() { @@ -748,6 +672,10 @@ do_test_once() { then covername="coverage-$(echo "$1" | sed -e 's/\//_/g')" coverflags=("-covermode=count" "-coverprofile=$WORKSPACE/tmp/.$covername.tmp") + testflags=() + if [[ "$1" == "cmd/arvados-package" ]]; then + testflags+=("-timeout" "20m") + fi # We do "go install" here to catch compilation errors # before trying "go test". Otherwise, coverage-reporting # mode makes Go show the wrong line numbers when reporting @@ -758,11 +686,11 @@ do_test_once() { then # "go test -check.vv giturl" doesn't work, but this # does: - go test ${short:+-short} ${testargs[$1]} + go test ${short:+-short} ${testflags[@]} ${testargs[$1]} else # The above form gets verbose even when testargs is # empty, so use this form in such cases: - go test ${short:+-short} ${coverflags[@]} "git.arvados.org/arvados.git/$1" + go test ${short:+-short} ${testflags[@]} ${coverflags[@]} "git.arvados.org/arvados.git/$1" fi result=${result:-$?} if [[ -f "$WORKSPACE/tmp/.$covername.tmp" ]] @@ -774,7 +702,7 @@ do_test_once() { elif [[ "$2" == "pip" ]] then tries=0 - cd "$WORKSPACE/$1" && while : + cd "$WORKSPACE/$1" && pip install . && while : do tries=$((${tries}+1)) # $3 can name a path directory for us to use, including trailing @@ -782,11 +710,13 @@ do_test_once() { if [[ -e "${3}activate" ]]; then . "${3}activate" fi - python setup.py ${short:+--short-tests-only} test ${testargs[$1]} + python3 -m pytest ${testargs[$1]} result=$? - if [[ ${tries} < 3 && ${result} == 137 ]] + # pytest uses exit code 2 to mean "test collection failed." + # See discussion in FUSE's IntegrationTest and MountTestBase. + if [[ ${tries} < 3 && ${result} == 2 ]] then - printf '\n*****\n%s tests killed -- retrying\n*****\n\n' "$1" + printf '\n*****\n%s tests exited with code 2 -- retrying\n*****\n\n' "$1" continue else break @@ -823,7 +753,7 @@ check_arvados_config() { } do_install() { - if [[ -n "${skip[install]}" || ( -n "${only_install}" && "${only_install}" != "${1}" && "${only_install}" != "${2}" ) ]]; then + if [[ -n ${skip["install_$1"]} || -n "${skip[install]}" || ( -n "${only_install}" && "${only_install}" != "${1}" && "${only_install}" != "${2}" ) ]]; then return 0 fi check_arvados_config "$1" @@ -876,11 +806,11 @@ bundle_install_trylocal() { ( set -e echo "(Running bundle install --local. 'could not find package' messages are OK.)" - if ! "$bundle" install --local --no-deployment; then + if ! bundle install --local --no-deployment; then echo "(Running bundle install again, without --local.)" - "$bundle" install --no-deployment + bundle install --no-deployment fi - "$bundle" package + bundle package ) } @@ -904,6 +834,10 @@ install_sdk/ruby() { install_gem arvados sdk/ruby } +install_sdk/ruby-google-api-client() { + install_gem arvados-google-api-client sdk/ruby-google-api-client +} + install_sdk/R() { if [[ "$NEED_SDK_R" = true ]]; then cd "$WORKSPACE/sdk/R" \ @@ -911,17 +845,13 @@ install_sdk/R() { fi } -install_sdk/perl() { - cd "$WORKSPACE/sdk/perl" \ - && perl Makefile.PL INSTALL_BASE="$PERLINSTALLBASE" \ - && make install INSTALLDIRS=perl -} - install_sdk/cli() { install_gem arvados-cli sdk/cli } install_services/login-sync() { + install_gem arvados-google-api-client sdk/ruby-google-api-client + install_gem arvados sdk/ruby install_gem arvados-login-sync services/login-sync } @@ -954,15 +884,6 @@ install_services/api() { ) || return 1 fi - cd "$WORKSPACE/services/api" \ - && rm -rf tmp/git \ - && mkdir -p tmp/git \ - && cd tmp/git \ - && tar xf ../../test/test.git.tar \ - && mkdir -p internal.git \ - && git --git-dir internal.git init \ - || return 1 - ( set -ex cd "$WORKSPACE/services/api" @@ -977,49 +898,72 @@ install_services/api() { declare -a pythonstuff pythonstuff=( + # The ordering of sdk/python, tools/crunchstat-summary, and + # sdk/cwl here is significant. See + # https://dev.arvados.org/issues/19744#note-26 sdk/python:py3 + tools/crunchstat-summary:py3 sdk/cwl:py3 services/dockercleaner:py3 services/fuse:py3 - tools/crunchstat-summary:py3 ) declare -a gostuff -gostuff=($(cd "$WORKSPACE" && git grep -lw func | grep \\.go | sed -e 's/\/[^\/]*$//' | sort -u)) +gostuff=($(cd "$WORKSPACE" && git ls-files | grep '\.go$' | sed -e 's/\/[^\/]*$//' | sort -u)) -install_apps/workbench() { - cd "$WORKSPACE/apps/workbench" \ - && mkdir -p tmp/cache \ - && RAILS_ENV=test bundle_install_trylocal \ - && RAILS_ENV=test RAILS_GROUPS=assets "$bundle" exec rake npm:install +install_services/workbench2() { + cd "$WORKSPACE/services/workbench2" \ + && make yarn-install ARVADOS_DIRECTORY="${WORKSPACE}" } test_doc() { - ( - set -e - cd "$WORKSPACE/doc" - ARVADOS_API_HOST=pirca.arvadosapi.com - # Make sure python-epydoc is installed or the next line won't - # do much good! - PYTHONPATH=$WORKSPACE/sdk/python/ "$bundle" exec rake linkchecker baseurl=file://$WORKSPACE/doc/.site/ arvados_workbench_host=https://workbench.$ARVADOS_API_HOST arvados_api_host=$ARVADOS_API_HOST - ) + local arvados_api_host=pirca.arvadosapi.com && \ + env -C "$WORKSPACE/doc" \ + bundle exec rake linkchecker \ + arvados_api_host="$arvados_api_host" \ + arvados_workbench_host="https://workbench.$arvados_api_host" \ + baseurl="file://$WORKSPACE/doc/.site/" \ + ${testargs[doc]} } test_gofmt() { cd "$WORKSPACE" || return 1 dirs=$(ls -d */ | egrep -v 'vendor|tmp') [[ -z "$(gofmt -e -d $dirs | tee -a /dev/stderr)" ]] + go vet -composites=false ./... +} + +test_arvados_version.py() { + local orig_fn="" + local fail_count=0 + while read -d "" fn; do + if [[ -z "$orig_fn" ]]; then + orig_fn="$fn" + elif ! cmp "$orig_fn" "$fn"; then + fail_count=$(( $fail_count + 1 )) + printf "FAIL: %s and %s are not identical\n" "$orig_fn" "$fn" + fi + done < <(git -C "$WORKSPACE" ls-files -z | grep -z '/arvados_version\.py$') + case "$orig_fn" in + "") return 66 ;; # EX_NOINPUT + *) return "$fail_count" ;; + esac } test_services/api() { rm -f "$WORKSPACE/services/api/git-commit.version" cd "$WORKSPACE/services/api" \ - && eval env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} "$bundle" exec rake test TESTOPTS=\'-v -d\' ${testargs[services/api]} + && eval env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} bundle exec rake test TESTOPTS=\'-v -d\' ${testargs[services/api]} } test_sdk/ruby() { cd "$WORKSPACE/sdk/ruby" \ - && "$bundle" exec rake test TESTOPTS=-v ${testargs[sdk/ruby]} + && bundle exec rake test TESTOPTS=-v ${testargs[sdk/ruby]} +} + +test_sdk/ruby-google-api-client() { + echo "*** note \`test sdk/ruby-google-api-client\` does not actually run any tests, see https://dev.arvados.org/issues/20993 ***" + true } test_sdk/R() { @@ -1032,7 +976,7 @@ test_sdk/R() { test_sdk/cli() { cd "$WORKSPACE/sdk/cli" \ && mkdir -p /tmp/keep \ - && KEEP_LOCAL_STORE=/tmp/keep "$bundle" exec rake test TESTOPTS=-v ${testargs[sdk/cli]} + && KEEP_LOCAL_STORE=/tmp/keep bundle exec rake test TESTOPTS=-v ${testargs[sdk/cli]} } test_sdk/java-v2() { @@ -1041,49 +985,29 @@ test_sdk/java-v2() { test_services/login-sync() { cd "$WORKSPACE/services/login-sync" \ - && "$bundle" exec rake test TESTOPTS=-v ${testargs[services/login-sync]} -} - -test_apps/workbench_units() { - local TASK="test:units" - cd "$WORKSPACE/apps/workbench" \ - && eval env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} "$bundle" exec rake ${TASK} TESTOPTS=\'-v -d\' ${testargs[apps/workbench]} ${testargs[apps/workbench_units]} + && bundle exec rake test TESTOPTS=-v ${testargs[services/login-sync]} } -test_apps/workbench_functionals() { - local TASK="test:functionals" - cd "$WORKSPACE/apps/workbench" \ - && eval env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} "$bundle" exec rake ${TASK} TESTOPTS=\'-v -d\' ${testargs[apps/workbench]} ${testargs[apps/workbench_functionals]} +test_services/workbench2_units() { + cd "$WORKSPACE/services/workbench2" && make unit-tests ARVADOS_DIRECTORY="${WORKSPACE}" WORKSPACE="$(pwd)" ${testargs[services/workbench2]} } -test_apps/workbench_integration() { - local TASK="test:integration" - cd "$WORKSPACE/apps/workbench" \ - && eval env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} "$bundle" exec rake ${TASK} TESTOPTS=\'-v -d\' ${testargs[apps/workbench]} ${testargs[apps/workbench_integration]} -} - -test_apps/workbench_benchmark() { - local TASK="test:benchmark" - cd "$WORKSPACE/apps/workbench" \ - && eval env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} "$bundle" exec rake ${TASK} ${testargs[apps/workbench_benchmark]} -} - -test_apps/workbench_profile() { - local TASK="test:profile" - cd "$WORKSPACE/apps/workbench" \ - && eval env RAILS_ENV=test ${short:+RAILS_TEST_SHORT=1} "$bundle" exec rake ${TASK} ${testargs[apps/workbench_profile]} +test_services/workbench2_integration() { + cd "$WORKSPACE/services/workbench2" && make integration-tests ARVADOS_DIRECTORY="${WORKSPACE}" WORKSPACE="$(pwd)" ${testargs[services/workbench2]} } install_deps() { # Install parts needed by test suites do_install env do_install cmd/arvados-server go - do_install sdk/cli - do_install sdk/perl - do_install sdk/python pip "${VENV3DIR}/bin/" + do_install tools/crunchstat-summary pip "${VENV3DIR}/bin/" + do_install sdk/ruby-google-api-client do_install sdk/ruby + do_install sdk/cli do_install services/api - do_install services/arv-git-httpd go + # lib/controller integration tests depend on arv-mount to run + # containers. + do_install services/fuse pip "${VENV3DIR}/bin/" do_install services/keepproxy go do_install services/keep-web go } @@ -1091,9 +1015,9 @@ install_deps() { install_all() { do_install env do_install doc + do_install sdk/ruby-google-api-client do_install sdk/ruby do_install sdk/R - do_install sdk/perl do_install sdk/cli do_install services/login-sync for p in "${pythonstuff[@]}" @@ -1108,22 +1032,16 @@ install_all() { do_install "$g" go done do_install services/api - do_install apps/workbench + do_install services/workbench2 } test_all() { stop_services do_test services/api - - # Shortcut for when we're only running apiserver tests. This saves a bit of time, - # because we don't need to start up the api server for subsequent tests. - if [ ! -z "$only" ] && [ "$only" == "services/api" ]; then - rotate_logfile "$WORKSPACE/services/api/log/" "test.log" - exit_cleanly - fi - do_test gofmt + do_test arvados_version.py do_test doc + do_test sdk/ruby-google-api-client do_test sdk/ruby do_test sdk/R do_test sdk/cli @@ -1141,11 +1059,8 @@ test_all() { do do_test "$g" go done - do_test apps/workbench_units - do_test apps/workbench_functionals - do_test apps/workbench_integration - do_test apps/workbench_benchmark - do_test apps/workbench_profile + do_test services/workbench2_units + do_test services/workbench2_integration } test_go() { @@ -1186,11 +1101,6 @@ done testfuncargs["sdk/cli"]="sdk/cli" testfuncargs["sdk/R"]="sdk/R" testfuncargs["sdk/java-v2"]="sdk/java-v2" -testfuncargs["apps/workbench_units"]="apps/workbench_units" -testfuncargs["apps/workbench_functionals"]="apps/workbench_functionals" -testfuncargs["apps/workbench_integration"]="apps/workbench_integration" -testfuncargs["apps/workbench_benchmark"]="apps/workbench_benchmark" -testfuncargs["apps/workbench_profile"]="apps/workbench_profile" if [[ -z ${interactive} ]]; then install_all @@ -1198,7 +1108,7 @@ if [[ -z ${interactive} ]]; then else skip=() only=() - only_install=() + only_install="" if [[ -e "$VENV3DIR/bin/activate" ]]; then stop_services; fi setnextcmd() { if [[ "$TERM" = dumb ]]; then @@ -1217,6 +1127,7 @@ else setnextcmd HISTFILE="$WORKSPACE/tmp/.history" history -r + ignore_sigint=1 while read -p 'What next? ' -e -i "$nextcmd" nextcmd; do history -s "$nextcmd" history -w