diff --git a/devcontainer/nix-entrypoint.sh b/devcontainer/nix-entrypoint.sh index 63fd59c4e..7665b9e13 100644 --- a/devcontainer/nix-entrypoint.sh +++ b/devcontainer/nix-entrypoint.sh @@ -4,6 +4,7 @@ set +e if ! pidof nix-daemon > /dev/null 2>&1; then start_ok=false if [ "$(id -u)" = "0" ]; then + # shellcheck disable=SC1091 # shellcheck source=/dev/null ( . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh; /nix/var/nix/profiles/default/bin/nix-daemon > /tmp/nix-daemon.log 2>&1 ) & # shellcheck disable=SC2181 diff --git a/examples/clickhouse/.test.sh b/examples/clickhouse/.test.sh index 723bab881..4fb1ced15 100755 --- a/examples/clickhouse/.test.sh +++ b/examples/clickhouse/.test.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash set -xe timeout 20 bash -c 'until echo > /dev/tcp/localhost/9000; do sleep 0.5; done' sleep 2 diff --git a/examples/dotenv/.test.sh b/examples/dotenv/.test.sh index d4cb543c4..a7e1d576a 100755 --- a/examples/dotenv/.test.sh +++ b/examples/dotenv/.test.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash - env | grep FOO=1 env | grep BAR=1 env | grep BAZ=5 diff --git a/examples/fly.io/.test.sh b/examples/fly.io/.test.sh index db0f6a31c..b85301004 100755 --- a/examples/fly.io/.test.sh +++ b/examples/fly.io/.test.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash - if [ "$(uname -s)" == "Linux" ]; then devenv container shell devenv container processes diff --git a/examples/imports/.test.sh b/examples/imports/.test.sh index 6f8d16c29..10cb4a879 100755 --- a/examples/imports/.test.sh +++ b/examples/imports/.test.sh @@ -1,4 +1,3 @@ #!/usr/bin/env bash - env | grep "FILE=1" env | grep "FOLDER=1" \ No newline at end of file diff --git a/examples/mysql/.test.sh b/examples/mysql/.test.sh index 7bdadcb31..e16683de7 100755 --- a/examples/mysql/.test.sh +++ b/examples/mysql/.test.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash set -ex timeout 60 bash -c 'until MYSQL_PWD="" mysql -u root test_database < /dev/null; do sleep 0.5; done' \ No newline at end of file diff --git a/examples/postgres/.test.sh b/examples/postgres/.test.sh index 56081a2af..36f49e3d8 100755 --- a/examples/postgres/.test.sh +++ b/examples/postgres/.test.sh @@ -1,2 +1,3 @@ +#!/usr/bin/env bash set -ex timeout 20 bash -c 'until psql -h /tmp -c "SELECT 1" mydb 2>/dev/null; do sleep 0.5; done' diff --git a/examples/temporal/.test.sh b/examples/temporal/.test.sh index 3c27ee2f7..86f7ffeb2 100755 --- a/examples/temporal/.test.sh +++ b/examples/temporal/.test.sh @@ -5,7 +5,17 @@ export TEMPORAL_ADDRESS=127.0.0.1:17233 timeout 20 bash -c 'until echo > /dev/tcp/localhost/17233; do sleep 0.5; done' -sleep 1 +# Continuously check temporal status until it returns successfully (up to a maximum of 20 times) +# shellcheck disable=SC2034 +for i in $(seq 1 20); do + check_temporal_status + if [ $TEMPORAL_EXIT_STATUS -eq 0 ]; then + echo "Service is up..." + break + else + sleep 1 + fi +done if ! temporal operator cluster health; then echo "Temporal not started" @@ -21,4 +31,4 @@ temporal operator cluster system echo "$TEMPORAL_OUTPUT" # Exit the script -exit $TEMPORAL_EXIT_STATUS \ No newline at end of file +exit "$TEMPORAL_EXIT_STATUS" \ No newline at end of file diff --git a/examples/vault/.test.sh b/examples/vault/.test.sh index e511bd6ce..408a4ecf1 100755 --- a/examples/vault/.test.sh +++ b/examples/vault/.test.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -ex +set -x # vault status and store its exit status check_vault_status() { @@ -8,9 +8,19 @@ check_vault_status() { VAULT_EXIT_STATUS=$? } -trap devenv_stop EXIT +# Continuously check vault status until it returns successfully (up to a maximum of 100 times) +# shellcheck disable=SC2034 +for i in $(seq 1 20); do + check_vault_status + if [ $VAULT_EXIT_STATUS -eq 0 ]; then + echo "Service is up..." + break + else + sleep 1 + fi +done timeout 20 bash -c 'until echo > /dev/tcp/localhost/8200; do sleep 0.5; done' # Exit the script -exit $VAULT_EXIT_STATUS \ No newline at end of file +exit "$VAULT_EXIT_STATUS" \ No newline at end of file diff --git a/tests/cli/.test.sh b/tests/cli/.test.sh index d9cdf6e3c..40a01a3ed 100755 --- a/tests/cli/.test.sh +++ b/tests/cli/.test.sh @@ -1,2 +1,3 @@ +#!/usr/bin/env bash set -xe devenv build languages.python.package \ No newline at end of file