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 !!!!!!"
76 if [[ -z "${skip[$1]}" ]] && ( [[ -z "$only" ]] || [[ "$only" == "$1" ]] )
78 title "Running $1 tests"
81 go test "git.curoverse.com/arvados.git/$1"
86 title "End of $1 tests"
88 title "Skipping $1 tests"
93 title "Running $1 install"
96 go get -t "git.curoverse.com/arvados.git/$1"
100 checkexit "$1 install"
101 title "End of $1 install"
105 txt="********** $1 **********"
106 printf "\n%*s%s\n\n" $((($COLUMNS-${#txt})/2)) "" "$txt"
110 for t in "$VENVDIR" "$GOPATH"
121 bundle install --deployment
123 # Make sure python-epydoc is installed or the next line won't do much good!
124 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
128 test_doclinkchecker() {
130 bundle exec rake linkchecker baseurl=file://$WORKSPACE/doc/.site/
132 do_test doclinkchecker
134 install_apiserver() {
135 cd "$WORKSPACE/services/api"
136 bundle install --deployment
138 rm -f config/environments/test.rb
139 cp config/environments/test.rb.example config/environments/test.rb
141 cp $HOME/arvados-api-server/database.yml config/ || fatal "database.yml"
142 cp $HOME/arvados-api-server/application.yml config/ || fatal "application.yml"
144 # Fill in a random secret_token and blob_signing_key for testing
145 SECRET_TOKEN=`echo 'puts rand(2**512).to_s(36)' |ruby`
146 BLOB_SIGNING_KEY=`echo 'puts rand(2**512).to_s(36)' |ruby`
148 sed -i'' -e "s:SECRET_TOKEN:$SECRET_TOKEN:" config/application.yml
149 sed -i'' -e "s:BLOB_SIGNING_KEY:$BLOB_SIGNING_KEY:" config/application.yml
151 export RAILS_ENV=test
153 # Set up empty git repo (for git tests)
154 GITDIR="$WORKSPACE/tmpgit"
155 sed -i'' -e "s:/var/cache/git:$GITDIR:" config/application.default.yml
158 mkdir -p $GITDIR/test
161 && git config user.email "jenkins@ci.curoverse.com" \
162 && git config user.name "Jenkins, CI" \
165 && git commit -m 'initial commit'
167 cd "$WORKSPACE/services/api" \
168 && bundle exec rake db:drop \
169 && bundle exec rake db:create \
170 && bundle exec rake db:setup
175 cd "$WORKSPACE/services/api"
176 bundle exec rake test
181 cd "$WORKSPACE/sdk/cli"
182 bundle install --deployment
194 for g in "${gostuff[@]}"
199 install_python_sdk() {
200 # Install the Python SDK early. Various other test suites (like
201 # keepproxy) bring up run_test_server.py, which imports the arvados
202 # module. We can't actually *test* the Python SDK yet though, because
203 # its own test suite brings up some of those other programs (like
206 cd "$WORKSPACE/sdk/python" \
207 && python setup.py egg_info -b ".$(git log --format=format:%ct.%h -n1 .)" sdist rotate --keep=1 --match .tar.gz \
208 && pip install dist/arvados-python-client-0.1.*.tar.gz
210 do_install python_sdk
213 cd "$WORKSPACE/services/fuse" \
214 && python setup.py egg_info -b ".$(git log --format=format:%ct.%h -n1 .)" sdist rotate --keep=1 --match .tar.gz \
215 && pip install dist/arvados_fuse-0.1.*.tar.gz
220 # Python SDK. We test this before testing keepproxy: keepproxy runs
221 # run_test_server.py, which depends on the yaml package, which is in
222 # tests_require but not install_requires, and therefore does not get
223 # installed by setuptools until we run "setup.py test" *and* install
224 # the .egg files that setup.py downloads.
226 cd "$WORKSPACE/sdk/python" \
227 && python setup.py test \
228 && easy_install *.egg
233 # Install test dependencies here too, in case run_test_server needs them.
234 cd "$WORKSPACE/services/fuse" \
235 && python setup.py test \
236 && easy_install *.egg
239 for g in "${gostuff[@]}"
244 install_workbench() {
245 cd "$WORKSPACE/apps/workbench" \
246 && bundle install --deployment \
247 && bundle exec rake test
251 title "Starting SDK CLI tests"
252 cd "$WORKSPACE/sdk/cli" \
253 && bundle install --deployment \
254 && mkdir -p /tmp/keep \
255 && KEEP_LOCAL_STORE=/tmp/keep bundle exec rake test
261 for x in "${successes[@]}"
266 if [[ ${#failures[@]} == 0 ]]
268 echo "All test suites passed."
270 echo "Failures (${#failures[@]}):"
271 for x in "${failures[@]}"