-
Notifications
You must be signed in to change notification settings - Fork 691
test: basic end to end #1339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
test: basic end to end #1339
Changes from 40 commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
f1feaba
Adding test directory and e2e tests to Dynamo
pvijayakrish 70c6628
Add Licences to all files
pvijayakrish 529a25d
updated locally
nnshah1 6215a73
Merge branch 'main' into neelays/tests
nnshah1 4423f1a
incremental
nnshah1 b8af868
Merge branch 'main' into neelays/tests
nnshah1 6bd155d
updating incremental
nnshah1 1317900
updated - incremental
nnshah1 3934ca3
updated
nnshah1 aa02e2b
removing for testing only serve
nnshah1 ae4faec
tests
nnshah1 f4b7d93
missing file
nnshah1 716d35e
increasing timeout
nnshah1 0d337b8
updating test time 15 min
nnshah1 6833988
cleaning up
nnshah1 61d99ae
updated
nnshah1 38b782b
updated for mypy
nnshah1 6d9ae43
updating with pre-commit
nnshah1 07c821e
updated
nnshah1 d128f2a
updated
nnshah1 fd1281b
updated
nnshah1 3be2584
updaTed
nnshah1 d1235e1
updated
nnshah1 2d5c3a7
updates
nnshah1 d01e4c7
updated
nnshah1 c296f28
updates
nnshah1 b378d75
updates
nnshah1 a7a139d
updated
nnshah1 48d77b0
updated
nnshah1 b44884f
changing name back - will add comment
nnshah1 33ef224
updates
nnshah1 ec7379e
adding failure case
nnshah1 3d8b8ac
updated
nnshah1 35010a0
updates
nnshah1 47feef9
updated
nnshah1 702c713
updated
nnshah1 b5db16f
updated based on ai feedback
nnshah1 2358c7d
updates
nnshah1 b9ce178
Update tests/utils/managed_process.py
nnshah1 a0a4307
Update tests/utils/managed_process.py
nnshah1 e40ff81
tweaking elapsed logic
nnshah1 708afd0
Merge branch 'neelays/tests' of https://github.com/ai-dynamo/dynamo i…
nnshah1 1d0cf46
updated
nnshah1 b3823c2
fixes basd on feedback
nnshah1 b9ea317
mypy updates
nnshah1 ba5f400
updating from feedback
nnshah1 c87b950
update from feedback
nnshah1 1a16830
reverting change
nnshah1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| # Dynamo Testing Framework | ||
|
|
||
| ## Overview | ||
|
|
||
| This document outlines the testing framework for the Dynamo runtime system, including test discovery, organization, and best practices. | ||
|
|
||
| ## Directory Structure | ||
|
|
||
| ```bash | ||
| tests/ | ||
| ├── serve/ # E2E tests using dynamo serve | ||
| │ ├── conftest.py # test fixtures as needed for specific test area | ||
| ├── run/ # E2E tests using dynamo run | ||
| │ ├── conftest.py # test fixtures as needed for specific test area | ||
| ├── conftest.py # Shared fixtures and configuration | ||
| └── README.md # This file | ||
| ``` | ||
|
|
||
| ## Test Discovery | ||
|
|
||
| Pytest automatically discovers tests based on their naming convention. All test files must follow this pattern: | ||
|
|
||
| ```bash | ||
| test_<component_or_flow>.py | ||
| ``` | ||
|
|
||
| Where: | ||
| - `component_or_flow`: The component or flow being tested (e.g., planner, kv_router) | ||
| - For e2e tests, this could be the API or simply "dynamo" | ||
|
|
||
| ## Running Tests | ||
|
|
||
| To run all tests: | ||
| ```bash | ||
| pytest | ||
| ``` | ||
|
|
||
| To run only specific tests: | ||
| ```bash | ||
| # Run only vLLM tests | ||
| pytest -v -m vllm | ||
|
|
||
| # Run only e2e tests | ||
| pytest -v -m e2e | ||
|
|
||
| # Run tests for a specific component | ||
| pytest -v -m planner | ||
|
|
||
| # Run with print statements visible | ||
| pytest -s | ||
| ``` | ||
|
|
||
| ## Test Markers | ||
|
|
||
| Markers help control which tests run under different conditions. Add these decorators to your test functions: | ||
|
|
||
| ### Frequency-based markers | ||
| - `@pytest.mark.nightly` - Tests run nightly | ||
| - `@pytest.mark.weekly` - Tests run weekly | ||
| - `@pytest.mark.pre_merge` - Tests run before merging PRs | ||
|
|
||
| ### Role-based markers | ||
| - `@pytest.mark.e2e` - End-to-end tests | ||
| - `@pytest.mark.integration` - Integration tests | ||
| - `@pytest.mark.unit` - Unit tests | ||
nnshah1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - `@pytest.mark.stress` - Stress/load tests | ||
| - `@pytest.mark.benchmark` - Performance benchmark tests | ||
|
|
||
| ### Component-specific markers | ||
| - `@pytest.mark.vllm` - Framework tests | ||
nnshah1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - `@pytest.mark.sglang` - Framework tests | ||
| - `@pytest.mark.tensorrtllm` - Framework tests | ||
| - `@pytest.mark.planner` - Planner component tests | ||
| - `@pytest.mark.kv_router` - KV Router component tests | ||
| - etc. | ||
|
|
||
| ### Execution-related markers | ||
| - `@pytest.mark.slow` - Tests that take a long time to run | ||
| - `@pytest.mark.skip(reason="Example: KV Manager is under development")` - Skip these tests | ||
nnshah1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - `@pytest.mark.xfail(reason="Expected to fail because...")` - Tests expected to fail | ||
|
|
||
| ## Environment Setup | ||
|
|
||
| Tests are designed to run in the appropriate framework container built | ||
| via ```./container/build.sh --framework X``` and run via | ||
| ```./container/run.sh --mount-workspace -it -- pytest```. | ||
|
|
||
|
|
||
| ### Environment Variables | ||
| - `HF_TOKEN` - Your HuggingFace API token to avoid rate limits | ||
| - Get a token from https://huggingface.co/settings/tokens | ||
| - Set it before running tests: `export HF_TOKEN=your_token_here` | ||
|
|
||
| ### Model Download Cache | ||
|
|
||
| The tests will automatically use a local cache at `~/.cache/huggingface` to avoid | ||
| repeated downloads of model files. This cache is shared across test runs to improve performance. | ||
nnshah1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| import logging | ||
| import os | ||
|
|
||
| import pytest | ||
|
|
||
| from tests.utils.managed_process import ManagedProcess | ||
|
|
||
| # Custom format inspired by your example | ||
| LOG_FORMAT = "[TEST] %(asctime)s %(levelname)s %(name)s: %(message)s" | ||
|
|
||
| # Configure logging | ||
| logging.basicConfig( | ||
| level=logging.INFO, | ||
| format=LOG_FORMAT, | ||
| datefmt="%Y-%m-%dT%H:%M:%S", # ISO 8601 UTC format with microseconds | ||
| ) | ||
|
|
||
|
|
||
| class EtcdServer(ManagedProcess): | ||
whoisj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| def __init__(self, request, port=2379, timeout=300): | ||
| port_string = str(port) | ||
| etcd_env = os.environ.copy() | ||
| etcd_env["ALLOW_NONE_AUTHENTICATION"] = "yes" | ||
| command = [ | ||
| "etcd", | ||
| "--listen-client-urls", | ||
| f"http://0.0.0.0:{port_string}", | ||
| "--advertise-client-urls", | ||
| f"http://0.0.0.0:{port_string}", | ||
| "--data-dir", | ||
| "/tmp/etcd-test-data", | ||
| ] | ||
| super().__init__( | ||
| command=command, | ||
| timeout=timeout, | ||
| display_output=False, | ||
| health_check_ports=[port], | ||
| data_dir="/tmp/etcd-test-data", | ||
| log_dir=request.node.name, | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ) | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| class NatsServer(ManagedProcess): | ||
whoisj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| def __init__(self, request, port=4222, timeout=300): | ||
| data_dir = "/tmp/nats/jetstream" | ||
| command = ["nats-server", "-js", "--trace", "--store_dir", data_dir] | ||
| super().__init__( | ||
| command=command, | ||
| timeout=timeout, | ||
| display_output=False, | ||
| data_dir=data_dir, | ||
| health_check_ports=[port], | ||
| log_dir=request.node.name, | ||
| ) | ||
|
|
||
|
|
||
| @pytest.fixture() | ||
| def runtime_services(request): | ||
| with NatsServer(request) as nats_process: | ||
| with EtcdServer(request) as etcd_process: | ||
| yield nats_process, etcd_process | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.