Skip to content

Commit 36fafd1

Browse files
author
chenyunliang520
committed
Update client certificate subject to root and add SSL mode check in test_pgconn
1 parent 3c10f68 commit 36fafd1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ Steps to Run OpenGauss(SSL) with Python GaussDB Driver Testing (Assuming Docker
225225

226226
# Optional: client certificate (for mutual TLS)
227227
openssl genrsa -out client.key 2048
228-
openssl req -new -key client.key -subj "/CN=dbclient" -out client.csr
228+
openssl req -new -key client.key -subj "/CN=root" -out client.csr
229229
openssl x509 -req -in client.csr -CA ca.crt -CAkey ca.key -CAcreateserial \
230230
-out client.crt -days 730 -sha256
231231

tests/pq/test_pgconn.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,12 @@ def test_used_password(pgconn, dsn, monkeypatch):
301301
"PGPASSWORD" in os.environ
302302
or [i for i in info if i.keyword == b"password"][0].val is not None
303303
)
304+
305+
kv = {i.keyword.decode(): (i.val.decode() if i.val else None) for i in info}
306+
sslmode = (kv.get("sslmode") or "").lower()
307+
if sslmode in ("require", "verify-ca", "verify-full"):
308+
pytest.skip(f"Skipping password usage check under sslmode={sslmode}")
309+
304310
if has_password:
305311
assert pgconn.used_password
306312

0 commit comments

Comments
 (0)