From badbbdc043054816d63b96e239123dd67febfa5e Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Wed, 15 Apr 2020 14:19:12 -0300 Subject: [PATCH] 16029: Adds orquestration script. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- package.json | 1 + tools/arvados_config.yml | 14 ++++++ tools/run-integration-tests.sh | 63 +++++++++++++++++++++++ yarn.lock | 91 ++++++++++++++++++++++++++++++++-- 4 files changed, 166 insertions(+), 3 deletions(-) create mode 100644 tools/arvados_config.yml create mode 100755 tools/run-integration-tests.sh diff --git a/package.json b/package.json index 9a68f9e8f9..db7c410d32 100644 --- a/package.json +++ b/package.json @@ -99,6 +99,7 @@ "node-sass-chokidar": "1.3.4", "redux-devtools": "3.4.1", "typescript": "3.1.1", + "wait-on": "4.0.2", "yamljs": "0.3.0" }, "jest": { diff --git a/tools/arvados_config.yml b/tools/arvados_config.yml new file mode 100644 index 0000000000..cf97e6011f --- /dev/null +++ b/tools/arvados_config.yml @@ -0,0 +1,14 @@ +Clusters: + zzzzz: + ManagementToken: e687950a23c3a9bceec28c6223a06c79 + SystemRootToken: systemusertesttoken1234567890aoeuidhtnsqjkxbmwvzpy + API: + RequestTimeout: 30s + TLS: + Insecure: true + Collections: + BlobSigningKey: zfhgfenhffzltr9dixws36j1yhksjoll2grmku38mi7yxd66h5j4q9w4jzanezacp8s6q0ro3hxakfye02152hncy6zml2ed0uc + TrustAllContent: true + ForwardSlashNameSubstitution: / + Login: + PAM: true diff --git a/tools/run-integration-tests.sh b/tools/run-integration-tests.sh new file mode 100755 index 0000000000..399354cf8c --- /dev/null +++ b/tools/run-integration-tests.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + +random_free_port() { + while port=$(shuf -n1 -i $(cat /proc/sys/net/ipv4/ip_local_port_range | tr '\011' '-')) + netstat -atun | grep -q ":$port\s" ; do + continue + done + echo $port +} + +# Allow self-signed certs on 'wait-on' +export NODE_TLS_REJECT_UNAUTHORIZED=0 + +WORKDIR=`mktemp -d` +ARVADOS_LOG=${WORKDIR}/arvados.log +ARVADOS_CONF=`pwd`/tools/arvados_config.yml + +if [ ! -e "${WORKDIR}/lib" ]; then + echo "Downloading arvados..." + git clone https://git.arvados.org/arvados.git ${WORKDIR} || exit 1 +fi + +echo "Building & installing arvados-server..." +cd ${WORKDIR} +go mod download || exit 1 + +echo "Installing dev dependencies..." +sudo go run ./cmd/arvados-server install -type test || exit 1 + +echo "Running arvados in test mode..." +ARVADOS_PORT=`random_free_port` +go run ./cmd/arvados-server boot \ + -config ${ARVADOS_CONF} \ + -type test \ + -own-temporary-database \ + -controller-address :${ARVADOS_PORT} \ + -listen-host localhost > ${ARVADOS_LOG} 2>&1 & + +cd - +echo "Running workbench2..." +WB2_PORT=`random_free_port` +PORT=${WB2_PORT} REACT_APP_ARVADOS_API_HOST=localhost:${ARVADOS_PORT} \ + yarn start & + +# Wait for arvados & workbench2 to be up. +# Using https-get to avoid false positive 'ready' detection. +yarn run wait-on https-get://localhost:${ARVADOS_PORT}/discovery/v1/apis/arvados/v1/rest +yarn run wait-on https-get://localhost:${WB2_PORT} + +echo "Running tests..." +CYPRESS_system_token=systemusertesttoken1234567890aoeuidhtnsqjkxbmwvzpy \ + CYPRESS_controller_url=https://localhost:${ARVADOS_PORT} \ + CYPRESS_BASE_URL=https://localhost:${WB2_PORT} \ + yarn run cypress run +TEST_EXIT_CODE=$? + +# Cleanup +rm -rf ${WORKDIR} + +exit ${TEST_EXIT_CODE} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index b78ab876d2..e1a62b88ea 100644 --- a/yarn.lock +++ b/yarn.lock @@ -50,6 +50,46 @@ debug "^3.1.0" lodash.once "^4.1.1" +"@hapi/address@^4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@hapi/address/-/address-4.0.1.tgz#267301ddf7bc453718377a6fb3832a2f04a721dd" + integrity sha512-0oEP5UiyV4f3d6cBL8F3Z5S7iWSX39Knnl0lY8i+6gfmmIBj44JCBNtcMgwyS+5v7j3VYavNay0NFHDS+UGQcw== + dependencies: + "@hapi/hoek" "^9.0.0" + +"@hapi/formula@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@hapi/formula/-/formula-2.0.0.tgz#edade0619ed58c8e4f164f233cda70211e787128" + integrity sha512-V87P8fv7PI0LH7LiVi8Lkf3x+KCO7pQozXRssAHNXXL9L1K+uyu4XypLXwxqVDKgyQai6qj3/KteNlrqDx4W5A== + +"@hapi/hoek@^9.0.0": + version "9.0.4" + resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.0.4.tgz#e80ad4e8e8d2adc6c77d985f698447e8628b6010" + integrity sha512-EwaJS7RjoXUZ2cXXKZZxZqieGtc7RbvQhUy8FwDoMQtxWVi14tFjeFCYPZAM1mBCpOpiBpyaZbb9NeHc7eGKgw== + +"@hapi/joi@^17.1.1": + version "17.1.1" + resolved "https://registry.yarnpkg.com/@hapi/joi/-/joi-17.1.1.tgz#9cc8d7e2c2213d1e46708c6260184b447c661350" + integrity sha512-p4DKeZAoeZW4g3u7ZeRo+vCDuSDgSvtsB/NpfjXEHTUjSeINAi/RrVOWiVQ1isaoLzMvFEhe8n5065mQq1AdQg== + dependencies: + "@hapi/address" "^4.0.1" + "@hapi/formula" "^2.0.0" + "@hapi/hoek" "^9.0.0" + "@hapi/pinpoint" "^2.0.0" + "@hapi/topo" "^5.0.0" + +"@hapi/pinpoint@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@hapi/pinpoint/-/pinpoint-2.0.0.tgz#805b40d4dbec04fc116a73089494e00f073de8df" + integrity sha512-vzXR5MY7n4XeIvLpfl3HtE3coZYO4raKXW766R6DZw/6aLqR26iuZ109K7a0NtF2Db0jxqh7xz2AxkUwpUFybw== + +"@hapi/topo@^5.0.0": + version "5.0.0" + resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-5.0.0.tgz#c19af8577fa393a06e9c77b60995af959be721e7" + integrity sha512-tFJlT47db0kMqVm3H4nQYgn6Pwg10GTZHb1pwmSiv1K4ks6drQOtfEF5ZnPjkvC+y4/bUPHK+bc87QvLcL+WMw== + dependencies: + "@hapi/hoek" "^9.0.0" + "@material-ui/core@3.9.3": version "3.9.3" resolved "https://registry.yarnpkg.com/@material-ui/core/-/core-3.9.3.tgz#d378c1f4beb18df9a534ca7258c2c33fb8e0e51f" @@ -4829,7 +4869,7 @@ har-schema@^2.0.0: resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= -har-validator@~5.1.0: +har-validator@~5.1.0, har-validator@~5.1.3: version "5.1.3" resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.3.tgz#1ef89ebd3e4996557675eed9893110dc350fa080" integrity sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g== @@ -9394,7 +9434,7 @@ request-promise-core@1.1.3: dependencies: lodash "^4.17.15" -request-promise-native@^1.0.5: +request-promise-native@^1.0.5, request-promise-native@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.8.tgz#a455b960b826e44e2bf8999af64dff2bfe58cb36" integrity sha512-dapwLGqkHtwL5AEbfenuzjTYg35Jd6KPytsC2/TLkVMz8rm+tNt72MGUWT1RP/aYawMpN6HqbNGBQaRcBtjQMQ== @@ -9429,6 +9469,32 @@ request@2.88.0, request@^2.79.0, request@^2.87.0, request@^2.88.0: tunnel-agent "^0.6.0" uuid "^3.3.2" +request@^2.88.2: + version "2.88.2" + resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" + integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== + dependencies: + aws-sign2 "~0.7.0" + aws4 "^1.8.0" + caseless "~0.12.0" + combined-stream "~1.0.6" + extend "~3.0.2" + forever-agent "~0.6.1" + form-data "~2.3.2" + har-validator "~5.1.3" + http-signature "~1.2.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.19" + oauth-sign "~0.9.0" + performance-now "^2.1.0" + qs "~6.5.2" + safe-buffer "^5.1.2" + tough-cookie "~2.5.0" + tunnel-agent "^0.6.0" + uuid "^3.3.2" + require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" @@ -9592,6 +9658,13 @@ rxjs@^6.3.3: dependencies: tslib "^1.9.0" +rxjs@^6.5.5: + version "6.5.5" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.5.tgz#c5c884e3094c8cfee31bf27eb87e54ccfc87f9ec" + integrity sha512-WfQI+1gohdf0Dai/Bbmk5L5ItH5tYqm3ki2c5GdWhKjalzjg93N3avFjVStyZZz+A2Em+ZxKH5bNghw9UeylGQ== + dependencies: + tslib "^1.9.0" + safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" @@ -10609,7 +10682,7 @@ toposort@^1.0.0: resolved "https://registry.yarnpkg.com/toposort/-/toposort-1.0.7.tgz#2e68442d9f64ec720b8cc89e6443ac6caa950029" integrity sha1-LmhELZ9k7HILjMieZEOsbKqVACk= -tough-cookie@^2.3.2, tough-cookie@^2.3.3, tough-cookie@^2.3.4: +tough-cookie@^2.3.2, tough-cookie@^2.3.3, tough-cookie@^2.3.4, tough-cookie@~2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== @@ -11148,6 +11221,18 @@ w3c-hr-time@^1.0.1: dependencies: browser-process-hrtime "^0.1.2" +wait-on@4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/wait-on/-/wait-on-4.0.2.tgz#6ee9b5751b4e0329630abbb5fdba787802b32914" + integrity sha512-Qpmgm3Hw/sXm7xK68FBsYy5r+Uid94/QymwnEjn9GTpfiWTUVYm0bccivVwY/BXGYO2r+5Cd8S/DzrRZqHK/9w== + dependencies: + "@hapi/joi" "^17.1.1" + lodash "^4.17.15" + minimist "^1.2.5" + request "^2.88.2" + request-promise-native "^1.0.8" + rxjs "^6.5.5" + walker@~1.0.5: version "1.0.7" resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" -- 2.30.2