chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:17:40 +08:00
commit f1825c8ceb
10096 changed files with 2364182 additions and 0 deletions
@@ -0,0 +1,53 @@
import sys
import pytest
from ray.serve._private.benchmarks.common import run_controller_benchmark
@pytest.mark.asyncio
async def test_run_controller_benchmark(ray_start_stop):
"""Test that run_controller_benchmark runs and returns valid samples."""
config = {
"checkpoints": [1, 2],
"marination_period_s": 15,
"sample_interval_s": 5,
}
samples = await run_controller_benchmark(config=config)
assert len(samples) > 0, "Expected at least one sample"
expected_keys = [
"target_replicas",
"autoscale_duration_s",
"loop_duration_mean_s",
"loops_per_second",
"event_loop_delay_s",
"num_asyncio_tasks",
"deployment_state_update_mean_s",
"application_state_update_mean_s",
"proxy_state_update_mean_s",
"node_update_min_s",
"handle_metrics_delay_mean_ms",
"replica_metrics_delay_mean_ms",
"process_memory_mb",
]
for sample in samples:
for key in expected_keys:
assert key in sample, f"Sample missing expected key: {key}"
# Verify we have samples for each checkpoint
replicas_seen = {s["target_replicas"] for s in samples}
assert 1 in replicas_seen
assert 2 in replicas_seen
# Verify numeric fields are reasonable
for sample in samples:
assert sample["loops_per_second"] >= 0
assert sample["process_memory_mb"] >= 0
assert sample["autoscale_duration_s"] >= 0
if __name__ == "__main__":
sys.exit(pytest.main(["-v", "-s", __file__]))