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
16 # First make sure to remove any ARVADOS_ variables from the calling environment
17 # that could interfer with the tests.
18 unset $(env | cut -d= -f1 | grep \^ARVADOS_)
22 export GOPATH=$(mktemp -d)
25 source /etc/profile.d/rvm.sh
29 echo >&2 "Fatal: $* in ${FUNCNAME[1]} at ${BASH_SOURCE[1]} line ${BASH_LINENO[0]}"
34 echo "WORKSPACE=$WORKSPACE"
35 [[ -n "$WORKSPACE" ]] || fatal "WORKSPACE not set"
37 # Set up temporary install dirs
38 mkdir -p "$GOPATH/src/git.curoverse.com"
39 ln -sfn "$WORKSPACE" "$GOPATH/src/git.curoverse.com/arvados.git" \
40 || fatal "symlink failed"
42 virtualenv --setuptools "$VENVDIR" || fatal "virtualenv $VENVDIR failed"
43 PATH="$VENVDIR/bin:$PATH"
48 # Always skip CLI tests. They don't know how to use run_test_server.py.
63 echo >&2 "$0: Unrecognized option: '$arg'"
70 if [[ "$?" != "0" ]]; then
71 title "!!!!!! $1 FAILED !!!!!!"
72 failures+=("$1 (`timer`)")
74 successes+=("$1 (`timer`)")
83 echo -n "$(($SECONDS - $t0))s"
87 if [[ -z "${skip[$1]}" ]] && ( [[ -z "$only" ]] || [[ "$only" == "$1" ]] )
89 title "Running $1 tests"
93 go test "git.curoverse.com/arvados.git/$1"
98 title "End of $1 tests (`timer`)"
100 title "Skipping $1 tests"
105 title "Running $1 install"
107 if [[ "$2" == "go" ]]
109 go get -t "git.curoverse.com/arvados.git/$1"
113 checkexit "$1 install"
114 title "End of $1 install (`timer`)"
118 txt="********** $1 **********"
119 printf "\n%*s%s\n\n" $((($COLUMNS-${#txt})/2)) "" "$txt"
123 for t in "$VENVDIR" "$GOPATH"
134 bundle install --deployment
136 # Make sure python-epydoc is installed or the next line won't do much good!
137 ARVADOS_API_HOST=qr1hi.arvadosapi.com
138 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
139 unset ARVADOS_API_HOST
143 test_doclinkchecker() {
145 bundle exec rake linkchecker baseurl=file://$WORKSPACE/doc/.site/
147 do_test doclinkchecker
149 install_apiserver() {
150 cd "$WORKSPACE/services/api"
151 bundle install --deployment
153 rm -f config/environments/test.rb
154 cp config/environments/test.rb.example config/environments/test.rb
156 cp $HOME/arvados-api-server/database.yml config/ || fatal "database.yml"
157 cp $HOME/arvados-api-server/application.yml config/ || fatal "application.yml"
159 # Fill in a random secret_token and blob_signing_key for testing
160 SECRET_TOKEN=`echo 'puts rand(2**512).to_s(36)' |ruby`
161 BLOB_SIGNING_KEY=`echo 'puts rand(2**512).to_s(36)' |ruby`
163 sed -i'' -e "s:SECRET_TOKEN:$SECRET_TOKEN:" config/application.yml
164 sed -i'' -e "s:BLOB_SIGNING_KEY:$BLOB_SIGNING_KEY:" config/application.yml
166 export RAILS_ENV=test
168 # Set up empty git repo (for git tests)
169 GITDIR="$WORKSPACE/tmpgit"
170 sed -i'' -e "s:/var/cache/git:$GITDIR:" config/application.default.yml
173 mkdir -p $GITDIR/test
176 && git config user.email "jenkins@ci.curoverse.com" \
177 && git config user.name "Jenkins, CI" \
180 && git commit -m 'initial commit'
182 cd "$WORKSPACE/services/api" \
183 && bundle exec rake db:drop \
184 && bundle exec rake db:create \
185 && bundle exec rake db:setup
190 cd "$WORKSPACE/services/api"
191 bundle exec rake test
196 cd "$WORKSPACE/sdk/cli"
197 bundle install --deployment
209 for g in "${gostuff[@]}"
214 install_python_sdk() {
215 # Install the Python SDK early. Various other test suites (like
216 # keepproxy) bring up run_test_server.py, which imports the arvados
217 # module. We can't actually *test* the Python SDK yet though, because
218 # its own test suite brings up some of those other programs (like
221 cd "$WORKSPACE/sdk/python" \
222 && python setup.py egg_info -b ".$(git log --format=format:%ct.%h -n1 .)" sdist rotate --keep=1 --match .tar.gz \
223 && pip install dist/arvados-python-client-0.1.*.tar.gz
225 do_install python_sdk
228 cd "$WORKSPACE/services/fuse" \
229 && python setup.py egg_info -b ".$(git log --format=format:%ct.%h -n1 .)" sdist rotate --keep=1 --match .tar.gz \
230 && pip install dist/arvados_fuse-0.1.*.tar.gz
235 # Python SDK. We test this before testing keepproxy: keepproxy runs
236 # run_test_server.py, which depends on the yaml package, which is in
237 # tests_require but not install_requires, and therefore does not get
238 # installed by setuptools until we run "setup.py test" *and* install
239 # the .egg files that setup.py downloads.
241 cd "$WORKSPACE/sdk/python" \
242 && python setup.py test
250 # Install test dependencies here too, in case run_test_server needs them.
251 cd "$WORKSPACE/services/fuse" \
252 && python setup.py test
259 for g in "${gostuff[@]}"
265 cd "$WORKSPACE/apps/workbench" \
266 && bundle install --deployment \
267 && bundle exec rake test
272 title "Starting SDK CLI tests"
273 cd "$WORKSPACE/sdk/cli" \
274 && bundle install --deployment \
275 && mkdir -p /tmp/keep \
276 && KEEP_LOCAL_STORE=/tmp/keep bundle exec rake test
282 for x in "${successes[@]}"
287 if [[ ${#failures[@]} == 0 ]]
289 echo "All test suites passed."
291 echo "Failures (${#failures[@]}):"
292 for x in "${failures[@]}"