Try again, again, again...
This commit is contained in:
27
.github/workflows/integration-tests.yml
vendored
27
.github/workflows/integration-tests.yml
vendored
@@ -55,11 +55,25 @@ jobs:
|
|||||||
# Give it one more second to fully initialize
|
# Give it one more second to fully initialize
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
- name: Debug network connectivity
|
- name: Get PostgreSQL connection details
|
||||||
|
id: pg_connection
|
||||||
run: |
|
run: |
|
||||||
echo "=== Checking port on host ==="
|
# Get container IP address
|
||||||
ss -tlnp | grep 5439 || netstat -tlnp | grep 5439 || lsof -i :5439 || echo "Checking with docker..."
|
CONTAINER_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' relspec-test-postgres)
|
||||||
docker port 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 ""
|
||||||
echo "=== Testing connection from inside container ==="
|
echo "=== Testing connection from inside container ==="
|
||||||
docker exec relspec-test-postgres psql -U relspec -d relspec_test -c "SELECT version();"
|
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
|
- name: Test Go connection to PostgreSQL
|
||||||
env:
|
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: |
|
run: |
|
||||||
echo "Testing connection using Go (same as integration tests will use)..."
|
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
|
mkdir -p /tmp/testconn
|
||||||
cat > /tmp/testconn/test_conn.go << 'EOF'
|
cat > /tmp/testconn/test_conn.go << 'EOF'
|
||||||
package main
|
package main
|
||||||
@@ -113,7 +128,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Run integration tests
|
- name: Run integration tests
|
||||||
env:
|
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
|
run: make test-integration
|
||||||
|
|
||||||
- name: Stop PostgreSQL container
|
- name: Stop PostgreSQL container
|
||||||
|
|||||||
Reference in New Issue
Block a user