22
33Test suite for RHOS Lightspeed in RHOSO environments.
44
5- ## Setup
5+ ## Installation
6+
7+ Python 3.12 is required. Install from a cloned repo:
68
79``` bash
8- uv venv
9- uv sync
10+ uv sync --python 3.12
11+ source .venv/bin/activate
1012```
1113
12- ## Configuration
13-
14- Configure the service in ` config/default.yaml ` . For Goose API tests, set
15- ` goose.model ` to the value of the Goose container's ` LIGHTSPEED_MODEL ` :
14+ Or install the standalone command directly from GitHub:
1615
17- ``` yaml
18- rhos_lightspeed :
19- base_url : " http://localhost:8080"
20- timeout : 30
16+ ``` bash
17+ uv tool install --python 3.12 git+https://github.com/openstack-k8s-operators/lightspeed-tests.git
18+ ```
2119
22- query :
23- default_question : " What is OpenStack?"
20+ The package includes the tests and their default configuration. Once installed,
21+ ` lightspeed-tests ` works from any directory. ` lightspeed-test ` is also available
22+ as an alias.
2423
25- goose :
26- model : " <same value as Goose LIGHTSPEED_MODEL>"
27- ` ` `
24+ ## Configuration
2825
29- Supply the bearer token through the environment:
26+ The tests load the default config from ` src/rhos_lightspeed_tests/default.yaml ` .
27+ Configure the service through environment variables:
3028
3129``` bash
30+ export RHOS_LIGHTSPEED_URL=" https://localhost:8443"
3231export RHOS_LIGHTSPEED_TOKEN=" <Lightspeed bearer token>"
32+ export RHOS_LIGHTSPEED_MODEL=" <same value as Goose LIGHTSPEED_MODEL>"
3333```
3434
3535` RHOS_LIGHTSPEED_URL ` and ` RHOS_LIGHTSPEED_MODEL ` can override the URL and model
36- from the config file. Use a service origin without ` /v1 ` . With the test-operator
37- playbook, supply ` lightspeed_model ` .
36+ from the default config. Use a service origin without ` /v1 ` . With the test-operator
37+ playbook, supply ` lightspeed_model ` . For Goose API tests, set the model to the Goose
38+ container's ` LIGHTSPEED_MODEL ` value.
3839
3940If you run the tests outside of OpenShift, you need to have a running port forward
4041for the ` lightspeed-app-server ` service. For example:
@@ -45,29 +46,38 @@ oc port-forward -n openstack-lightspeed svc/lightspeed-app-server 8443:8443
4546
4647## Running tests
4748
49+ The command accepts pytest options and returns pytest's exit status. In a uv
50+ checkout, prefix the commands below with ` uv run ` .
51+
4852``` bash
4953# Run all tests
50- uv run pytest
54+ lightspeed-tests
5155
5256# Run integration tests only
53- uv run pytest tests/ integration/
57+ lightspeed-tests -k integration
5458
5559# Run Goose API tests
56- uv run pytest tests/integration/test_goose_responses.py
60+ lightspeed-tests -k goose
5761
5862# Skip Goose tests that require a real LLM's answer content
59- uv run pytest tests/integration/test_goose_responses.py -m " not llm_dependent"
63+ lightspeed-tests -k goose -m " not llm_dependent"
64+
65+ # Verify test discovery without contacting a service
66+ lightspeed-tests --collect-only
6067
61- # Generate JUnit XML (automatic via pyproject.toml config)
62- uv run pytest # outputs test- results.xml
68+ # Enable verbose output and generate a JUnit XML report
69+ lightspeed-tests -v --junitxml= results.xml
6370```
6471
72+ Integration tests require a deployed Lightspeed service. Goose tests also
73+ require a configured model.
74+
6575## Adding tests
6676
67771 . Create test file in appropriate directory:
68- - ` tests/unit/ ` - Fast, isolated tests
69- - ` tests/integration/ ` - Tests requiring deployed service
70- - ` tests/e2e/ ` - Full end-to-end scenarios
78+ - ` src/rhos_lightspeed_tests/ tests/unit/` - Fast, isolated suite tests
79+ - ` src/rhos_lightspeed_tests/ tests/integration/` - Tests requiring deployed service
80+ - ` src/rhos_lightspeed_tests/ tests/e2e/` - Full end-to-end scenarios
7181
72822 . Use the shared fixtures from ` conftest.py ` :
7383 ``` python
@@ -77,24 +87,24 @@ uv run pytest # outputs test-results.xml
7787 assert response.status_code == 200
7888 ```
7989
80- 3 . Run: ` uv run pytest tests/integration/test_my_feature.py `
90+ 3 . Run: ` uv run lightspeed-tests -k test_my_feature `
91+
92+ Build a source distribution and wheel with ` uv build ` .
8193
8294## Project structure
8395
8496```
8597rhos-lightspeed-tests/
86- ├── config/
87- │ └── default.yaml # Default test configuration
88- ├── src/rhos_lightspeed_tests/ # Shared utilities
89- │ ├── __init__.py
98+ ├── src/rhos_lightspeed_tests/ # Installed package
99+ │ ├── __init__.py # lightspeed-tests entry point
90100│ ├── client.py # API client (query, health)
91- │ └ ── config.py # Reads default.yaml, env var overrides
92- ├── tests/
93- │ ├ ── conftest.py # Shared fixtures (config, client)
94- │ ├── unit/
95- │ ├── integration /
96- │ │ └ ── test_query_endpoint.py # First test: /query endpoint
97- │ └── e2e/
101+ │ ├ ── config.py # Loads defaults and environment overrides
102+ │ ├── default.yaml # Bundled default configuration
103+ │ └ ── tests/
104+ │ ├── conftest.py # Shared fixtures (config, client)
105+ │ ├── unit /
106+ │ ├ ── integration/
107+ │ └── e2e/
98108├── pyproject.toml
99109└── README.md
100110```
0 commit comments