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:

  1. GitLab CI services start in undefined order
  2. The app service depends on haf-instance and app-setup
  3. DNS registration can lag behind container startup
  4. 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.

Merge request reports

Loading