Skip to content

Commit

Permalink
add e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
fuyufjh committed Nov 20, 2024
1 parent 2c973ab commit 59b8c40
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ci/scripts/run-e2e-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ sqllogictest -p 4566 -d dev './e2e_test/ttl/ttl.slt'
sqllogictest -p 4566 -d dev './e2e_test/database/prepare.slt'
sqllogictest -p 4566 -d test './e2e_test/database/test.slt'

echo "--- e2e, $mode, python_client"
python3 -m pip install --break-system-packages psycopg
python3 ./e2e_test/python_client/main.py

echo "--- e2e, $mode, subscription"
python3 -m pip install --break-system-packages psycopg2-binary
sqllogictest -p 4566 -d dev './e2e_test/subscription/check_sql_statement.slt'
Expand Down
19 changes: 19 additions & 0 deletions e2e_test/python_client/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import psycopg

def test_psycopg_extended_mode():
conn = psycopg.connect(host='localhost', port='4566', dbname='dev', user='root')
with conn.cursor() as cur:
cur.execute("select Array[1::bigint, 2::bigint, 3::bigint]", binary=True)
assert cur.fetchone() == ([1, 2, 3],)

cur.execute("select Array['foo', null, 'bar']", binary=True)
assert cur.fetchone() == (['foo', None, 'bar'],)

cur.execute("select ROW('123 Main St', 'New York', '10001')", binary=True)
assert cur.fetchone() == (('123 Main St', 'New York', '10001'),)

cur.execute("select array[ROW('123 Main St', 'New York', '10001'), ROW('234 Main St', null, '10001')]", binary=True)
assert cur.fetchone() == ([('123 Main St', 'New York', '10001'), ('234 Main St', None, '10001')],)

if __name__ == '__main__':
test_psycopg_extended_mode()

0 comments on commit 59b8c40

Please sign in to comment.