diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 9fa82c7..696e80e 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -58,22 +58,21 @@ jobs: - name: Get PostgreSQL connection details id: pg_connection run: | - # Get container IP address + # Get container IP address from Docker bridge network + # This is needed because the runner itself is in a Docker container CONTAINER_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' relspec-test-postgres) - echo "Container IP: $CONTAINER_IP" - # If container IP exists, use it with port 5432 (internal port) - # Otherwise fall back to localhost:5439 - if [ -n "$CONTAINER_IP" ]; then - echo "Using container IP: $CONTAINER_IP:5432" - echo "pg_host=$CONTAINER_IP" >> $GITHUB_OUTPUT - echo "pg_port=5432" >> $GITHUB_OUTPUT - else - echo "Using localhost:5439" - echo "pg_host=localhost" >> $GITHUB_OUTPUT - echo "pg_port=5439" >> $GITHUB_OUTPUT + if [ -z "$CONTAINER_IP" ]; then + echo "ERROR: Could not get container IP address" + docker inspect relspec-test-postgres + exit 1 fi + echo "Container IP: $CONTAINER_IP" + echo "Using container IP: $CONTAINER_IP:5432" + echo "pg_host=$CONTAINER_IP" >> $GITHUB_OUTPUT + echo "pg_port=5432" >> $GITHUB_OUTPUT + echo "" echo "=== Testing connection from inside container ===" docker exec relspec-test-postgres psql -U relspec -d relspec_test -c "SELECT version();"