diff --git a/packages/fuel-indexer-tests/scripts/test-examples.bash b/packages/fuel-indexer-tests/scripts/test-examples.bash index 46efec4ca..501c8ee85 100644 --- a/packages/fuel-indexer-tests/scripts/test-examples.bash +++ b/packages/fuel-indexer-tests/scripts/test-examples.bash @@ -59,14 +59,24 @@ sleep 2 cd ../greetings-native -# Start the local Fuel node in the background (that we already previously built) -cargo run -p greetings-fuel-client --bin greetings-fuel-client & -sleep 2 +# Fuel client has already been started... # Start indexer in the background forc-index run-native --path ./greetings-native-indexer -- --run-migrations --postgres-password my-secret & sleep 5 +# Ensure service is up and running via health check +db_status=$(curl http://localhost:29987/api/health | json_pp | jq '.database_status') +sleep 1 +client_status=$(curl http://localhost:29987/api/health | json_pp | jq '.client_status') + +if [[ "$db_status" == "$client_status" ]] && [[ "$db_status" == '"OK"' ]]; then + echo "Database and client are up and running." +else + echo "Database and/or client are not up and running." + exit 1 +fi + # Trigger an indexable event cargo run -p greetings-data --bin greetings-data sleep 2