Skip to content

Commit 12f08b2

Browse files
test: add IAM test
1 parent 61379d8 commit 12f08b2

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/system/test_pg8000_iam_auth.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,19 @@ def test_lazy_pg8000_iam_authn_connection() -> None:
113113
curr_time = time[0]
114114
assert type(curr_time) is datetime
115115
connector.close()
116+
117+
118+
def test_MCP_pg8000_iam_authn_connection() -> None:
119+
"""Basic test to get time from database."""
120+
inst_conn_name = os.environ["POSTGRES_MCP_CONNECTION_NAME"]
121+
user = os.environ["POSTGRES_IAM_USER"]
122+
db = os.environ["POSTGRES_DB"]
123+
ip_type = os.environ.get("IP_TYPE", "public")
124+
125+
engine, connector = create_sqlalchemy_engine(inst_conn_name, user, db, ip_type)
126+
with engine.connect() as conn:
127+
time = conn.execute(sqlalchemy.text("SELECT NOW()")).fetchone()
128+
conn.commit()
129+
curr_time = time[0]
130+
assert type(curr_time) is datetime
131+
connector.close()

0 commit comments

Comments
 (0)