Skip to content

Commit 16b470c

Browse files
committed
a
1 parent 6946542 commit 16b470c

File tree

3 files changed

+115
-0
lines changed

3 files changed

+115
-0
lines changed

.github/workflows/test.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: Test Suite
5+
on: push
6+
7+
jobs:
8+
unit-tests:
9+
name: Unit Tests (Python ${{ matrix.python-version }})
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
python-version: ["3.10", "3.11", "3.12", "3.13"]
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
- name: Install uv
19+
uses: astral-sh/setup-uv@v6
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
activate-environment: true
23+
- name: Install dependencies
24+
run: uv pip install ".[dev]"
25+
- name: Run unit tests
26+
run: pytest tests --ignore=tests/integration -v
27+
28+
# integration-tests:
29+
# name: Integration Tests (Python ${{ matrix.python-version }})
30+
# runs-on: ubuntu-latest
31+
# strategy:
32+
# fail-fast: false
33+
# matrix:
34+
# python-version: ["3.10", "3.11", "3.12", "3.13"]
35+
# steps:
36+
# - name: Checkout repository
37+
# uses: actions/checkout@v4
38+
# - name: Install uv
39+
# uses: astral-sh/setup-uv@v6
40+
# with:
41+
# python-version: ${{ matrix.python-version }}
42+
# activate-environment: true
43+
# - name: Install dependencies
44+
# run: |
45+
# uv pip install ".[dev]"
46+
# uv pip install "./integration-tests[dev]"
47+
# - name: Run integration tests
48+
# run: pytest tests/integration -v

tests/integration/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
import pytest
5+
import requests
6+
import time
7+
import subprocess
8+
9+
10+
class TestAIPerfMockServerIntegration:
11+
@pytest.fixture(scope="class")
12+
def server_fixture(self):
13+
"""Start a test LLM inference server for integration testing"""
14+
# Start test server (e.g., vLLM, Triton, etc.)
15+
server_process = subprocess.Popen(
16+
[
17+
"aiperf-mock-server",
18+
"-m",
19+
"Qwen/Qwen3-0.6B",
20+
"-p",
21+
"8080",
22+
]
23+
)
24+
25+
# Wait for server to be ready
26+
self._wait_for_server_ready("http://localhost:8080")
27+
28+
yield "http://localhost:8080"
29+
30+
# Cleanup
31+
server_process.terminate()
32+
server_process.wait()
33+
34+
def _wait_for_server_ready(self, url, timeout=60):
35+
"""Wait for server to become ready"""
36+
start_time = time.time()
37+
while time.time() - start_time < timeout:
38+
try:
39+
response = requests.get(f"{url}/health", timeout=5)
40+
if response.status_code == 200:
41+
return
42+
except requests.exceptions.RequestException:
43+
pass
44+
time.sleep(2)
45+
raise RuntimeError("Server failed to start within timeout")
46+
47+
def test_basic_performance_analysis(self, test_server):
48+
"""Test basic throughput and latency measurement"""
49+
# Run your CLI tool against the test server
50+
result = subprocess.run(
51+
[
52+
"aiperf",
53+
"profile",
54+
"--model-names",
55+
"Qwen/Qwen3-0.6B",
56+
"--concurrency",
57+
"1",
58+
"--request-count",
59+
"1",
60+
],
61+
capture_output=True,
62+
text=True,
63+
)
64+
65+
assert result.returncode == 0, f"aiperf failed: {result.stderr}"

0 commit comments

Comments
 (0)