-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_requests.py
More file actions
95 lines (77 loc) · 3.37 KB
/
test_requests.py
File metadata and controls
95 lines (77 loc) · 3.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
"""Execute test requests against the Psycopg Flask app."""
from drift.instrumentation.e2e_common.test_utils import make_request, print_request_summary
if __name__ == "__main__":
print("Starting Psycopg test request sequence...\n")
# Execute test sequence
make_request("GET", "/health")
# Query operations
make_request("GET", "/db/query")
# Insert operations
resp1 = make_request("POST", "/db/insert", json={"name": "Alice", "email": "alice@example.com"})
resp2 = make_request("POST", "/db/insert", json={"name": "Bob", "email": "bob@example.com"})
# Batch insert
make_request(
"POST",
"/db/batch-insert",
json={
"users": [
{"name": "Charlie", "email": "charlie@example.com"},
{"name": "David", "email": "david@example.com"},
{"name": "Eve", "email": "eve@example.com"},
]
},
)
# Update operation
if resp1.status_code == 201:
user_id = resp1.json().get("id")
if user_id:
make_request("PUT", f"/db/update/{user_id}", json={"name": "Alice Updated"})
# Transaction test
make_request("POST", "/db/transaction")
# Query again to see all users
make_request("GET", "/db/query")
# Delete operation
if resp2.status_code == 201:
user_id = resp2.json().get("id")
if user_id:
make_request("DELETE", f"/db/delete/{user_id}")
make_request("GET", "/test/cursor-stream")
make_request("GET", "/test/server-cursor")
make_request("GET", "/test/copy-to")
make_request("GET", "/test/multiple-queries")
make_request("GET", "/test/pipeline-mode")
make_request("GET", "/test/dict-row-factory")
make_request("GET", "/test/namedtuple-row-factory")
make_request("GET", "/test/cursor-iteration")
make_request("GET", "/test/executemany-returning")
make_request("GET", "/test/rownumber")
make_request("GET", "/test/statusmessage")
make_request("GET", "/test/nextset")
make_request("GET", "/test/server-cursor-scroll")
make_request("GET", "/test/cursor-scroll")
make_request("GET", "/test/cursor-reuse")
make_request("GET", "/test/sql-composed")
make_request("GET", "/test/binary-uuid")
make_request("GET", "/test/binary-bytea")
make_request("GET", "/test/class-row-factory")
make_request("GET", "/test/kwargs-row-factory")
make_request("GET", "/test/scalar-row-factory")
make_request("GET", "/test/binary-format")
# Test: NULL values handling (integrated into E2E suite)
make_request("GET", "/test/null-values")
# Test: Transaction context manager
make_request("GET", "/test/transaction-context")
# JSON/JSONB and array types tests
make_request("GET", "/test/json-jsonb")
make_request("GET", "/test/array-types")
make_request("GET", "/test/cursor-set-result")
# These tests expose hash mismatch bugs with Decimal and date/time types
make_request("GET", "/test/decimal-types")
make_request("GET", "/test/date-time-types")
# These tests expose serialization bugs with inet/cidr and range types
make_request("GET", "/test/inet-cidr-types")
make_request("GET", "/test/range-types")
# Regression coverage for cursor fetch semantics and error replay fidelity
make_request("GET", "/db/fetchmany-arraysize")
make_request("GET", "/db/error-then-query")
print_request_summary()