dynamo/tests
Hongkuan Zhou 7da510cf7a
chore: many bug fixes and improvements when testing planner (#2776)
Signed-off-by: hongkuanz <hongkuanz@nvidia.com>
Signed-off-by: hongkuan <hongkuanz@nvidia.com>
2025-09-02 17:05:50 -07:00
..
fault_tolerance feat: Shutdown DRT when vLLM engine fails (#2698) 2025-09-02 20:10:54 +00:00
kvbm build: enable kvbm in vllm container (#2763) 2025-09-02 14:43:17 -04:00
lmcache feat: LMCache integration in newest ux (#2079) 2025-08-07 00:17:26 +00:00
planner chore: many bug fixes and improvements when testing planner (#2776) 2025-09-02 17:05:50 -07:00
router fix: do not delete KV events jetstream (#2800) 2025-09-01 21:25:49 +00:00
serve refactor: Rewrite test_metrics_labels to use TRTLLMProcess. (#2794) 2025-09-02 18:08:11 +00:00
utils fix: Remove duplicate import and make logger global. (#2817) 2025-09-02 17:02:54 -07:00
README.md chore: Rename tensorrtllm framework to trtllm (#2435) 2025-08-14 17:13:37 -07:00
__init__.py test: basic end to end (#1339) 2025-06-05 20:22:36 +00:00
conftest.py chore: Rename tensorrtllm framework to trtllm (#2435) 2025-08-14 17:13:37 -07:00

README.md

Dynamo Testing Framework

Overview

This document outlines the testing framework for the Dynamo runtime system, including test discovery, organization, and best practices.

Directory Structure

tests/
├── serve/              # E2E tests
│   ├── conftest.py     # test fixtures as needed for specific test area
├── conftest.py         # Shared fixtures and configuration
├── utils               # Common utils accross tests
└── README.md           # This file

Test Discovery

Pytest automatically discovers tests based on their naming convention. All test files must follow this pattern:

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:

pytest

To run only specific tests:

# 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
  • @pytest.mark.stress - Stress/load tests
  • @pytest.mark.benchmark - Performance benchmark tests

Component-specific markers

  • @pytest.mark.vllm - Framework tests
  • @pytest.mark.sglang - Framework tests
  • @pytest.mark.trtllm_marker - Framework tests
  • @pytest.mark.planner - Planner component tests
  • @pytest.mark.kv_router - KV Router component tests
  • etc.
  • @pytest.mark.slow - Tests that take a long time to run
  • @pytest.mark.skip(reason="Example: KV Manager is under development") - Skip these tests
  • @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 HuggingFace Settings
    • 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.

Running tests locally outside of a container

To run tests outside of the development container, ensure that you have properly setup your environment and have installed the following dependencies in your venv:

uv pip install pytest-mypy
uv pip install pytest-asyncio