11453: Merge branch 'master' into 11453-federated-tokens
[arvados.git] / build / run-tests.sh
index 70ea0ef073ba4a8d726ebce8565f1a4e659ab525..6063779b306411038555604a209b741f78f1fbb6 100755 (executable)
@@ -75,6 +75,7 @@ services/arv-git-httpd
 services/crunchstat
 services/dockercleaner
 services/fuse
+services/health
 services/keep-web
 services/keepproxy
 services/keepstore
@@ -99,10 +100,11 @@ sdk/go/health
 sdk/go/httpserver
 sdk/go/manifest
 sdk/go/blockdigest
-sdk/go/streamer
+sdk/go/asyncbuf
 sdk/go/stats
 sdk/go/crunchrunner
 sdk/cwl
+tools/arv-sync-groups
 tools/crunchstat-summary
 tools/keep-exercise
 tools/keep-rsync
@@ -204,8 +206,35 @@ sanity_checks() {
     echo -n 'gitolite: '
     which gitolite \
         || fatal "No gitolite. Try: apt-get install gitolite3"
-    which npm \
-          || 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 '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"
+    echo -n 'graphviz: '
+    dot -V || fatal "No graphviz. Try: apt-get install graphviz"
 }
 
 rotate_logfile() {
@@ -277,6 +306,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" \
@@ -451,6 +487,7 @@ export PERLLIB="$PERLINSTALLBASE/lib/perl5:${PERLLIB:+$PERLLIB}"
 
 export GOPATH
 mkdir -p "$GOPATH/src/git.curoverse.com"
+rmdir --parents "$GOPATH/src/git.curoverse.com/arvados.git/tmp/GOPATH"
 ln -sfT "$WORKSPACE" "$GOPATH/src/git.curoverse.com/arvados.git" \
     || fatal "symlink failed"
 go get -v github.com/kardianos/govendor \
@@ -470,11 +507,21 @@ 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
@@ -764,6 +811,16 @@ install_apiserver() {
 
     mkdir -p "$WORKSPACE/services/api/tmp/pids"
 
+    cert="$WORKSPACE/services/api/tmp/self-signed"
+    if ! [[ -e "$cert.pem" ]]; then
+        (
+            dir="$WORKSPACE/services/api/tmp"
+            set -ex
+            openssl req -newkey rsa:2048 -nodes -subj '/C=US/ST=State/L=City/CN=0.0.0.0' -out "$cert.csr" -keyout "$cert.key" </dev/null
+            openssl x509 -req -in "$cert.csr" -signkey "$cert.key" -out "$cert.pem" -days 3650 -extfile <(printf 'subjectAltName=DNS:127.0.0.1,DNS:localhost,DNS:::1')
+        ) || return 1
+    fi
+
     cd "$WORKSPACE/services/api" \
         && RAILS_ENV=test bundle exec rake db:drop \
         && RAILS_ENV=test bundle exec rake db:setup \
@@ -783,12 +840,13 @@ gostuff=(
     sdk/go/health
     sdk/go/httpserver
     sdk/go/manifest
-    sdk/go/streamer
+    sdk/go/asyncbuf
     sdk/go/crunchrunner
     sdk/go/stats
     lib/crunchstat
     services/arv-git-httpd
     services/crunchstat
+    services/health
     services/keep-web
     services/keepstore
     sdk/go/keepclient
@@ -801,6 +859,7 @@ gostuff=(
     tools/keep-block-check
     tools/keep-exercise
     tools/keep-rsync
+    tools/arv-sync-groups
 )
 for g in "${gostuff[@]}"
 do