|
| 1 | +#!/usr/bin/env bash |
| 2 | +## |
| 3 | +## Copyright (c) 2023 The Johns Hopkins University Applied Physics |
| 4 | +## Laboratory LLC. |
| 5 | +## |
| 6 | +## This file is part of the Asynchronous Network Management System (ANMS). |
| 7 | +## |
| 8 | +## Licensed under the Apache License, Version 2.0 (the "License"); |
| 9 | +## you may not use this file except in compliance with the License. |
| 10 | +## You may obtain a copy of the License at |
| 11 | +## http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +## Unless required by applicable law or agreed to in writing, software |
| 13 | +## distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +## See the License for the specific language governing permissions and |
| 16 | +## limitations under the License. |
| 17 | +## |
| 18 | +## This work was performed for the Jet Propulsion Laboratory, California |
| 19 | +## Institute of Technology, sponsored by the United States Government under |
| 20 | +## the prime contract 80NM0018D0004 between the Caltech and NASA under |
| 21 | +## subcontract 1658085. |
| 22 | +## |
| 23 | + |
| 24 | +# Run similar to: |
| 25 | +# COMPOSE_PROFILES=full CHECKOUT_BASE_URL=https://authnz/ ./entrypoint.sh |
| 26 | +set -e |
| 27 | + |
| 28 | +export COMPOSE_PROFILES |
| 29 | +export CHECKOUT_BASE_URL |
| 30 | + |
| 31 | +SELFDIR=$(realpath $(dirname "${BASH_SOURCE[0]}")) |
| 32 | +TIMELIMIT=30 |
| 33 | + |
| 34 | +CURLOPTS="" |
| 35 | +if [ -n "${SSL_CERT_FILE}" ] |
| 36 | +then |
| 37 | + echo "Using custom CA from ${SSL_CERT_FILE}" |
| 38 | + CURLOPTS="${CURLOPTS} --cacert ${SSL_CERT_FILE}" |
| 39 | +fi |
| 40 | + |
| 41 | +if [ -z "${CHECKOUT_BASE_URL}" ]; then |
| 42 | + echo "Must define CHECKOUT_BASE_URL environment" |
| 43 | + exit 1 |
| 44 | +fi |
| 45 | +echo "Waiting for ${CHECKOUT_BASE_URL} to be available..." |
| 46 | +for IX in $(seq ${TIMELIMIT}); do |
| 47 | + if curl -sSl $CURLOPTS "${CHECKOUT_BASE_URL}" >/dev/null; then |
| 48 | + break |
| 49 | + fi |
| 50 | + if [ ${IX} -eq ${TIMELIMIT} ]; then |
| 51 | + echo "No HTTP access after ${IX} seconds!" |
| 52 | + exit 1 |
| 53 | + fi |
| 54 | + sleep 1 |
| 55 | +done |
| 56 | +echo |
| 57 | + |
| 58 | +echo "Running tests..." |
| 59 | +TESTARGS="--verbose" |
| 60 | +if [ -n "${XUNIT_OUTFILE}" ]; then |
| 61 | + TESTARGS="${TESTARGS} --junitxml=${XUNIT_OUTFILE}" |
| 62 | +fi |
| 63 | +python3 -m pytest ${TESTARGS} "${SELFDIR}" "$@" |
0 commit comments