Add TCP port wait to benchmark job template to fix service race condition
Summary
Adds a TCP port wait to .jmeter_benchmark_with_haf_job template to eliminate race conditions with GitLab CI service containers.
Problem
Benchmark jobs (e.g., postgrest_block_api_benchmark_tests) were failing intermittently with DNS resolution errors:
Failed to resolve 'app' ([Errno -3] Try again)
This happens because:
- GitLab CI services start in undefined order
- The
appservice depends onhaf-instanceandapp-setup - DNS registration can lag behind container startup
- Tests start before the service is fully ready
Solution
Added before_script to .jmeter_benchmark_with_haf_job that:
- Waits for TCP port to be available using
nc -z - Has configurable timeout via
SERVICE_WAIT_TIMEOUT(default: 120s) - Logs progress every 2 seconds for debugging
- Fails explicitly if timeout is reached
Testing
This fix works alongside retry logic being added to benchmark.py (tests_api MR) for defense-in-depth.