QC check
This commit is contained in:
@@ -67,7 +67,7 @@ class TestPerformance:
|
||||
products = []
|
||||
brands = ["Brand1", "Brand2", "Brand3"]
|
||||
marketplaces = ["Market1", "Market2"]
|
||||
|
||||
|
||||
for i in range(200):
|
||||
product = Product(
|
||||
product_id=f"COMPLEX{i:03d}",
|
||||
@@ -85,13 +85,15 @@ class TestPerformance:
|
||||
# Test complex filtering performance
|
||||
start_time = time.time()
|
||||
response = client.get(
|
||||
"/api/v1/product?brand=Brand1&marketplace=Market1&limit=50",
|
||||
headers=auth_headers
|
||||
"/api/v1/product?brand=Brand1&marketplace=Market1&limit=50",
|
||||
headers=auth_headers,
|
||||
)
|
||||
end_time = time.time()
|
||||
|
||||
assert response.status_code == 200
|
||||
assert end_time - start_time < 1.5 # Complex query should still be reasonably fast
|
||||
assert (
|
||||
end_time - start_time < 1.5
|
||||
) # Complex query should still be reasonably fast
|
||||
|
||||
def test_pagination_performance_large_dataset(self, client, auth_headers, db):
|
||||
"""Test pagination performance with large dataset"""
|
||||
@@ -113,11 +115,12 @@ class TestPerformance:
|
||||
for offset in offsets:
|
||||
start_time = time.time()
|
||||
response = client.get(
|
||||
f"/api/v1/product?skip={offset}&limit=20",
|
||||
headers=auth_headers
|
||||
f"/api/v1/product?skip={offset}&limit=20", headers=auth_headers
|
||||
)
|
||||
end_time = time.time()
|
||||
|
||||
assert response.status_code == 200
|
||||
assert len(response.json()["products"]) == 20
|
||||
assert end_time - start_time < 1.0 # Pagination should be fast regardless of offset
|
||||
assert (
|
||||
end_time - start_time < 1.0
|
||||
) # Pagination should be fast regardless of offset
|
||||
|
||||
Reference in New Issue
Block a user