Skip to content

Commit bb0347a

Browse files
Update test workflow to match new example
1 parent 7d0ce6c commit bb0347a

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

.github/workflows/python-psycopg3-integ-tests.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,21 @@ jobs:
5353
role-to-assume: ${{ secrets.PYTHON_IAM_ROLE }}
5454
aws-region: us-east-1
5555

56-
- name: Configure and run integration for psycopg3
56+
- name: Configure and run integration for psycopg3 - admin
5757
working-directory: ./python/psycopg
5858
env:
59+
CLUSTER_USER: "admin"
5960
CLUSTER_ENDPOINT: ${{ secrets.PYTHON_PSYCOPG3_CLUSTER_ENDPOINT }}
6061
REGION: ${{ secrets.PYTHON_PSYCOPG3_CLUSTER_REGION }}
62+
FORCE_IPV4: "true"
6163
run: |
62-
python3 -m venv psycopg3-integ
63-
source psycopg3-integ/bin/activate
64+
python3 -m venv .venv
65+
source .venv/bin/activate
6466
pip install --upgrade pip
6567
pip install --force-reinstall -r requirements.txt
6668
python3 -c "import boto3; print(boto3.__version__)"
67-
pip install pytest pytest-cov
6869
pip list
6970
echo "$GITHUB_WORKSPACE" >> $GITHUB_PATH
70-
pytest -v test/
71+
wget https://www.amazontrust.com/repository/AmazonRootCA1.pem -O root.pem
72+
python src/example.py
7173

python/psycopg/src/example.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import boto3
1515
import psycopg
1616
import os
17+
import socket
1718
import sys
1819

1920

@@ -37,6 +38,15 @@ def create_connection(cluster_user, cluster_endpoint, region):
3738
"password": password_token
3839
}
3940

41+
42+
if os.environ.get("FORCE_IPV4", False):
43+
try:
44+
# Get the IPv4 address for the host
45+
conn_params["hostaddr"] = socket.gethostbyname(cluster_endpoint)
46+
except socket.gaierror:
47+
# If DNS resolution fails, continue without hostaddr
48+
pass
49+
4050
# Make a connection to the cluster
4151
conn = psycopg.connect(**conn_params)
4252

0 commit comments

Comments
 (0)