2 # Copyright (C) The Arvados Authors. All rights reserved.
4 # SPDX-License-Identifier: AGPL-3.0
10 kill ${arvboot_PID} ${consume_stdout_PID}
11 wait ${arvboot_PID} ${consume_stdout_PID} || true
16 while port=$(shuf -n1 -i $(cat /proc/sys/net/ipv4/ip_local_port_range | tr '\011' '-'))
17 netstat -atun | grep -q ":$port\s" ; do
23 # Allow self-signed certs on 'wait-on'
24 export NODE_TLS_REJECT_UNAUTHORIZED=0
27 WORKDIR=/tmp/arvboot # For script testing purposes...
28 ARVADOS_LOG=${WORKDIR}/arvados.log
29 ARVADOS_CONF=`pwd`/tools/arvados_config.yml
31 if [ ! -e "${WORKDIR}/lib" ]; then
32 echo "Downloading arvados..."
33 git clone https://git.arvados.org/arvados.git ${WORKDIR} || exit 1
36 echo "Building & installing arvados-server..."
38 go mod download || exit 1
43 echo "Installing dev dependencies..."
44 ~/go/bin/arvados-server install -type test || exit 1
46 echo "Running arvados in test mode..."
47 # ARVADOS_PORT=`random_free_port`
48 # go run ./cmd/arvados-server boot \
49 # -config ${ARVADOS_CONF} \
51 # -own-temporary-database \
52 # -controller-address :${ARVADOS_PORT} \
53 # -listen-host localhost > ${ARVADOS_LOG} 2>&1 &
54 coproc arvboot (~/go/bin/arvados-server boot \
56 -config ${ARVADOS_CONF} \
57 -own-temporary-database \
59 trap cleanup_arvboot ERR EXIT
61 read controllerURL <&"${arvboot[0]}"
63 # Copy coproc's stdout to stderr, to ensure `arvados-server boot`
64 # doesn't get blocked trying to write stdout.
65 exec 7<&"${arvbboot[0]}"; coproc consume_stdout (cat <&7 >&2)
68 echo "Running workbench2..."
69 WB2_PORT=`random_free_port`
70 PORT=${WB2_PORT} REACT_APP_ARVADOS_API_HOST=${controllerURL} \
73 # Wait for arvados & workbench2 to be up.
74 # Using https-get to avoid false positive 'ready' detection.
75 # yarn run wait-on --httpTimeout 300000 https-get://localhost:${ARVADOS_PORT}/discovery/v1/apis/arvados/v1/rest ||
76 yarn run wait-on --httpTimeout 300000 https-get://localhost:${WB2_PORT}
78 echo "Running tests..."
79 CYPRESS_system_token=systemusertesttoken1234567890aoeuidhtnsqjkxbmwvzpy \
80 CYPRESS_controller_url=${controllerURL} \
81 CYPRESS_BASE_URL=https://localhost:${WB2_PORT} \
88 exit ${TEST_EXIT_CODE}