From df5d3b4e5afd6717bf26a4264249c947c5379628 Mon Sep 17 00:00:00 2001 From: fauna-chase Date: Tue, 31 Oct 2023 19:11:34 -0500 Subject: [PATCH] wait for fauna to come up for integ tests --- concourse/scripts/wait-for-it.sh | 16 ++++++++++++++++ concourse/tasks/integration.yml | 32 ++++++++++++++++++++++++++++---- 2 files changed, 44 insertions(+), 4 deletions(-) create mode 100755 concourse/scripts/wait-for-it.sh diff --git a/concourse/scripts/wait-for-it.sh b/concourse/scripts/wait-for-it.sh new file mode 100755 index 00000000..c3ae7b31 --- /dev/null +++ b/concourse/scripts/wait-for-it.sh @@ -0,0 +1,16 @@ +attempt_counter=0 +max_attempts=100 + +echo "waiting for $1" +until $(curl -m 1 --output /dev/null --silent --head --fail $1); do + if [ ${attempt_counter} -eq ${max_attempts} ];then + echo "" + echo "Max attempts reached to $1" + exit 1 + fi + + printf '.' + attempt_counter=$(($attempt_counter+1)) + sleep 5 +done +echo "$1 is up and running!" diff --git a/concourse/tasks/integration.yml b/concourse/tasks/integration.yml index f41fbfaa..abaf3e4d 100644 --- a/concourse/tasks/integration.yml +++ b/concourse/tasks/integration.yml @@ -23,7 +23,13 @@ services: volumes: - "../../:/tmp/app" working_dir: "/tmp/app" - command: [sh, -c, "ls -la && sbt ++2.11.12 -Dsbt.supershell=false test"] + command: + - sh + - -c + - | + ls -la + concourse/scripts/wait-for-it.sh http://faunadb:8443/ping + sbt ++2.11.12 -Dsbt.supershell=false test tests-jdk-11-scala-2.12: environment: @@ -38,7 +44,13 @@ services: volumes: - "../../:/tmp/app" working_dir: "/tmp/app" - command: [sh, -c, "ls -la && sbt ++2.12.14 -Dsbt.supershell=false test"] + command: + - sh + - -c + - | + ls -la + concourse/scripts/wait-for-it.sh http://faunadb:8443/ping + sbt ++2.12.14 -Dsbt.supershell=false test tests-oracle-jdk-11-scala-2.11: environment: @@ -56,7 +68,13 @@ services: volumes: - "../../:/tmp/app" working_dir: "/tmp/app" - command: [sh, -c, "ls -la && sbt ++2.11.12 -Dsbt.supershell=false test"] + command: + - sh + - -c + - | + ls -la + concourse/scripts/wait-for-it.sh http://faunadb:8443/ping + sbt ++2.11.12 -Dsbt.supershell=false test tests-oracle-jdk-11-scala-2.12: environment: @@ -74,4 +92,10 @@ services: volumes: - "../../:/tmp/app" working_dir: "/tmp/app" - command: [sh, -c, "ls -la && sbt ++2.12.14 -Dsbt.supershell=false test"] + command: + - sh + - -c + - | + ls -la + concourse/scripts/wait-for-it.sh http://faunadb:8443/ping + sbt ++2.12.14 -Dsbt.supershell=false test