3 # Install and test Arvados components.
5 # Exit non-zero if any tests fail.
8 # --skip FOO Do not test the FOO component.
9 # --only FOO Do not test anything except the FOO component.
11 # Regardless of which components are tested, install all components in
12 # the usual sequence. (Many test suites depend on other components
17 ARVADOS_API_HOST=qr1hi.arvadosapi.com
19 export GOPATH=$(mktemp -d)
22 source /etc/profile.d/rvm.sh
26 echo >&2 "Fatal: $* in ${FUNCNAME[1]} at ${BASH_SOURCE[1]} line ${BASH_LINENO[0]}"
31 echo "WORKSPACE=$WORKSPACE"
32 [[ -n "$WORKSPACE" ]] || fatal "WORKSPACE not set"
34 # Set up temporary install dirs
35 mkdir -p "$GOPATH/src/git.curoverse.com"
36 ln -sfn "$WORKSPACE" "$GOPATH/src/git.curoverse.com/arvados.git" \
37 || fatal "symlink failed"
39 virtualenv --setuptools "$VENVDIR" || fatal "virtualenv $VENVDIR failed"
40 PATH="$VENVDIR/bin:$PATH"
45 # Always skip CLI tests. They don't know how to use run_test_server.py.
60 echo >&2 "$0: Unrecognized option: '$arg'"
67 if [[ "$?" != "0" ]]; then
68 title "!!!!!! $1 FAILED !!!!!!"
69 failures+=("$1 (`timer`)")
71 successes+=("$1 (`timer`)")
80 echo -n "$(($SECONDS - $t0))s"
84 if [[ -z "${skip[$1]}" ]] && ( [[ -z "$only" ]] || [[ "$only" == "$1" ]] )
86 title "Running $1 tests"
90 go test "git.curoverse.com/arvados.git/$1"
95 title "End of $1 tests (`timer`)"
97 title "Skipping $1 tests"
102 title "Running $1 install"
104 if [[ "$2" == "go" ]]
106 go get -t "git.curoverse.com/arvados.git/$1"
110 checkexit "$1 install"
111 title "End of $1 install (`timer`)"
115 txt="********** $1 **********"
116 printf "\n%*s%s\n\n" $((($COLUMNS-${#txt})/2)) "" "$txt"
120 for t in "$VENVDIR" "$GOPATH"
131 bundle install --deployment
133 # Make sure python-epydoc is installed or the next line won't do much good!
134 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
138 test_doclinkchecker() {
140 bundle exec rake linkchecker baseurl=file://$WORKSPACE/doc/.site/
142 do_test doclinkchecker
144 install_apiserver() {
145 cd "$WORKSPACE/services/api"
146 bundle install --deployment
148 rm -f config/environments/test.rb
149 cp config/environments/test.rb.example config/environments/test.rb
151 cp $HOME/arvados-api-server/database.yml config/ || fatal "database.yml"
152 cp $HOME/arvados-api-server/application.yml config/ || fatal "application.yml"
154 # Fill in a random secret_token and blob_signing_key for testing
155 SECRET_TOKEN=`echo 'puts rand(2**512).to_s(36)' |ruby`
156 BLOB_SIGNING_KEY=`echo 'puts rand(2**512).to_s(36)' |ruby`
158 sed -i'' -e "s:SECRET_TOKEN:$SECRET_TOKEN:" config/application.yml
159 sed -i'' -e "s:BLOB_SIGNING_KEY:$BLOB_SIGNING_KEY:" config/application.yml
161 export RAILS_ENV=test
163 # Set up empty git repo (for git tests)
164 GITDIR="$WORKSPACE/tmpgit"
165 sed -i'' -e "s:/var/cache/git:$GITDIR:" config/application.default.yml
168 mkdir -p $GITDIR/test
171 && git config user.email "jenkins@ci.curoverse.com" \
172 && git config user.name "Jenkins, CI" \
175 && git commit -m 'initial commit'
177 cd "$WORKSPACE/services/api" \
178 && bundle exec rake db:drop \
179 && bundle exec rake db:create \
180 && bundle exec rake db:setup
185 cd "$WORKSPACE/services/api"
186 bundle exec rake test
191 cd "$WORKSPACE/sdk/cli"
192 bundle install --deployment
204 for g in "${gostuff[@]}"
209 install_python_sdk() {
210 # Install the Python SDK early. Various other test suites (like
211 # keepproxy) bring up run_test_server.py, which imports the arvados
212 # module. We can't actually *test* the Python SDK yet though, because
213 # its own test suite brings up some of those other programs (like
216 cd "$WORKSPACE/sdk/python" \
217 && python setup.py egg_info -b ".$(git log --format=format:%ct.%h -n1 .)" sdist rotate --keep=1 --match .tar.gz \
218 && pip install dist/arvados-python-client-0.1.*.tar.gz
220 do_install python_sdk
223 cd "$WORKSPACE/services/fuse" \
224 && python setup.py egg_info -b ".$(git log --format=format:%ct.%h -n1 .)" sdist rotate --keep=1 --match .tar.gz \
225 && pip install dist/arvados_fuse-0.1.*.tar.gz
230 # Python SDK. We test this before testing keepproxy: keepproxy runs
231 # run_test_server.py, which depends on the yaml package, which is in
232 # tests_require but not install_requires, and therefore does not get
233 # installed by setuptools until we run "setup.py test" *and* install
234 # the .egg files that setup.py downloads.
236 cd "$WORKSPACE/sdk/python" \
237 && python setup.py test \
238 && easy_install *.egg
243 # Install test dependencies here too, in case run_test_server needs them.
244 cd "$WORKSPACE/services/fuse" \
245 && python setup.py test \
246 && easy_install *.egg
250 for g in "${gostuff[@]}"
256 cd "$WORKSPACE/apps/workbench" \
257 && bundle install --deployment \
258 && bundle exec rake test
263 title "Starting SDK CLI tests"
264 cd "$WORKSPACE/sdk/cli" \
265 && bundle install --deployment \
266 && mkdir -p /tmp/keep \
267 && KEEP_LOCAL_STORE=/tmp/keep bundle exec rake test
273 for x in "${successes[@]}"
278 if [[ ${#failures[@]} == 0 ]]
280 echo "All test suites passed."
282 echo "Failures (${#failures[@]}):"
283 for x in "${failures[@]}"