From c0ef26b6607b3dacd2d1c324f5c27ef41d86f1bd Mon Sep 17 00:00:00 2001 From: Hein Date: Sun, 28 Dec 2025 18:57:57 +0200 Subject: [PATCH] Try again, again, again... --- .github/workflows/integration-tests.yml | 27 +++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index a5624d6..9fa82c7 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -55,11 +55,25 @@ jobs: # Give it one more second to fully initialize sleep 2 - - name: Debug network connectivity + - name: Get PostgreSQL connection details + id: pg_connection run: | - echo "=== Checking port on host ===" - ss -tlnp | grep 5439 || netstat -tlnp | grep 5439 || lsof -i :5439 || echo "Checking with docker..." - docker port relspec-test-postgres + # Get container IP address + 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 + fi + echo "" echo "=== Testing connection from inside container ===" docker exec relspec-test-postgres psql -U relspec -d relspec_test -c "SELECT version();" @@ -81,9 +95,10 @@ jobs: - name: Test Go connection to PostgreSQL env: - RELSPEC_TEST_PG_CONN: postgres://relspec:relspec_test_password@localhost:5439/relspec_test + RELSPEC_TEST_PG_CONN: postgres://relspec:relspec_test_password@${{ steps.pg_connection.outputs.pg_host }}:${{ steps.pg_connection.outputs.pg_port }}/relspec_test run: | echo "Testing connection using Go (same as integration tests will use)..." + echo "Connection string: postgres://relspec:***@${{ steps.pg_connection.outputs.pg_host }}:${{ steps.pg_connection.outputs.pg_port }}/relspec_test" mkdir -p /tmp/testconn cat > /tmp/testconn/test_conn.go << 'EOF' package main @@ -113,7 +128,7 @@ jobs: - name: Run integration tests env: - RELSPEC_TEST_PG_CONN: postgres://relspec:relspec_test_password@localhost:5439/relspec_test + RELSPEC_TEST_PG_CONN: postgres://relspec:relspec_test_password@${{ steps.pg_connection.outputs.pg_host }}:${{ steps.pg_connection.outputs.pg_port }}/relspec_test run: make test-integration - name: Stop PostgreSQL container