initial commit

This commit is contained in:
2023-10-03 22:13:42 +01:00
commit 79ba18e15f
17 changed files with 1110 additions and 0 deletions

25
tests/test_standard.py Normal file
View File

@@ -0,0 +1,25 @@
import asyncio
from datetime import datetime
import pytest
@pytest.mark.anyio
async def test_standard_requests(client) -> None:
print("Making 5x100 concurrent requests (500 total)...")
async def make_requests():
for _ in range(100):
response = await client.get("/standard/1")
assert response.status_code == 200
# Make the requests concurrently and wait until they complete
start_time = datetime.now()
tasks = [asyncio.create_task(make_requests()) for _ in range(5)]
for task in tasks:
await task
print("Standard Requests: Took {delta}ms".format(delta=(datetime.now() - start_time).microseconds / 1000))
# View the metrics
metrics = await client.get("/metrics")
print("Standard Metrics:", metrics.json())