|
| 1 | +# Shared Test Fixtures |
| 2 | + |
| 3 | +This directory contains shared pytest fixtures that are used across multiple test modules. These fixtures are automatically loaded via pytest's plugin mechanism, registered in `/tests/conftest.py`. |
| 4 | + |
| 5 | +## Directory Structure |
| 6 | + |
| 7 | +```text |
| 8 | +fixtures/ |
| 9 | +├── files.py # File storage provider fixtures |
| 10 | +├── guardrails.py # Guardrails orchestrator infrastructure fixtures |
| 11 | +├── inference.py # Inference service and serving runtime fixtures |
| 12 | +├── trustyai.py # TrustyAI operator and DSC configuration fixtures |
| 13 | +└── vector_io.py # Vector database provider deployment fixtures |
| 14 | +``` |
| 15 | + |
| 16 | +### Fixture Modules |
| 17 | + |
| 18 | +- **`files.py`** - Factory fixture for configuring file storage providers (local, S3/MinIO) |
| 19 | +- **`guardrails.py`** - Fixtures for deploying and configuring the Guardrails Orchestrator, including pods, routes, health checks, and gateway configuration |
| 20 | +- **`inference.py`** - Fixtures for vLLM CPU serving runtimes, InferenceServices (Qwen), LLM-d inference simulator, and KServe controller configuration |
| 21 | +- **`trustyai.py`** - Fixtures for TrustyAI operator deployment and DataScienceCluster LMEval configuration |
| 22 | +- **`vector_io.py`** - Factory fixture for deploying vector database providers (Milvus, Faiss, PGVector, Qdrant) with their backing services and configuration |
| 23 | + |
| 24 | +## Registration |
| 25 | + |
| 26 | +All fixture modules are registered as pytest plugins in `/tests/conftest.py`: |
| 27 | + |
| 28 | +```python |
| 29 | +pytest_plugins = [ |
| 30 | + "tests.fixtures.inference", |
| 31 | + "tests.fixtures.guardrails", |
| 32 | + "tests.fixtures.trustyai", |
| 33 | + "tests.fixtures.vector_io", |
| 34 | + "tests.fixtures.files", |
| 35 | +] |
| 36 | +``` |
| 37 | + |
| 38 | +## Usage |
| 39 | + |
| 40 | +Fixtures are automatically available to all tests. Factory fixtures accept parameters via `pytest.mark.parametrize` with `indirect=True`. |
| 41 | + |
| 42 | +### Vector I/O Provider Example |
| 43 | + |
| 44 | +```python |
| 45 | +@pytest.mark.parametrize( |
| 46 | + "vector_io_provider_deployment_config_factory", |
| 47 | + ["milvus", "pgvector", "qdrant-remote"], |
| 48 | + indirect=True, |
| 49 | +) |
| 50 | +def test_with_vector_db(vector_io_provider_deployment_config_factory): |
| 51 | + # Fixture deploys the provider and returns env var configuration |
| 52 | + ... |
| 53 | +``` |
| 54 | + |
| 55 | +### Supported Vector I/O Providers |
| 56 | + |
| 57 | +| Provider | Type | Description | |
| 58 | +| --------------- | ------ | ------------------------------------------- | |
| 59 | +| `milvus` | Local | In-memory Milvus (no external dependencies) | |
| 60 | +| `milvus-remote` | Remote | Milvus standalone with etcd backend | |
| 61 | +| `faiss` | Local | Facebook AI Similarity Search (in-memory) | |
| 62 | +| `pgvector` | Local | PostgreSQL with pgvector extension | |
| 63 | +| `qdrant-remote` | Remote | Qdrant vector database | |
| 64 | + |
| 65 | +### Supported File Providers |
| 66 | + |
| 67 | +| Provider | Description | |
| 68 | +| -------- | ---------------------------------- | |
| 69 | +| `local` | Local filesystem storage (default) | |
| 70 | +| `s3` | S3/MinIO remote object storage | |
| 71 | + |
| 72 | +## Adding New Fixtures |
| 73 | + |
| 74 | +When adding shared fixtures, place them in the appropriate module file (or create a new one), and register the new module in `/tests/conftest.py` under `pytest_plugins`. Follow the project's fixture conventions: use noun-based names, narrowest appropriate scope, and context managers for resource lifecycle. |
0 commit comments