feat: implement pagination for transaction log queries (#5281)

* Add pagination support for transaction logs.

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

* Replace 'TransactionData' with 'data' variable.

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
dhlidongming 2024-12-17 05:04:30 +08:00 • committed by GitHub
commit 1ec63800b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 105 additions and 47 deletions

View file

@ -324,7 +324,8 @@ async def test_delete_flows_with_transaction_and_build(client: AsyncClient, logg
"GET", "api/v1/monitor/transactions", params={"flow_id": flow_id}, headers=logged_in_headers
)
assert response.status_code == 200
assert response.json() == []
json_response = response.json()
assert json_response["items"] == []
for flow_id in flow_ids:
response = await client.request(
@ -358,11 +359,15 @@ async def test_delete_folder_with_flows_with_transaction_and_build(client: Async
class VertexTuple(NamedTuple):
id: str
params: dict
# Create a transaction for each flow
for flow_id in flow_ids:
await log_transaction(
str(flow_id), source=VertexTuple(id="vid"), target=VertexTuple(id="tid"), status="success"
str(flow_id),
source=VertexTuple(id="vid", params={}),
target=VertexTuple(id="tid", params={}),
status="success",
)
# Create a build for each flow
@ -391,8 +396,9 @@ async def test_delete_folder_with_flows_with_transaction_and_build(client: Async
response = await client.request(
"GET", "api/v1/monitor/transactions", params={"flow_id": flow_id}, headers=logged_in_headers
)
assert response.status_code == 200
assert response.json() == []
assert response.status_code == 200, response.json()
json_response = response.json()
assert json_response["items"] == []
for flow_id in flow_ids:
response = await client.request(