Test suite for RHOS Lightspeed in RHOSO environments.
Python 3.12 is required. Install from a cloned repo:
uv sync
source .venv/bin/activateOr install the standalone command directly from GitHub:
uv tool install --python 3.12 git+https://github.com/openstack-k8s-operators/lightspeed-tests.gitThe package includes the tests and their default configuration. Once installed,
lightspeed-tests works from any directory. lightspeed-test is also available
as an alias.
The tests load the default config from src/rhos_lightspeed_tests/default.yaml.
Configure the service through environment variables:
export RHOS_LIGHTSPEED_URL="https://localhost:8443"
export RHOS_LIGHTSPEED_TOKEN="<Lightspeed bearer token>"
export RHOS_LIGHTSPEED_MODEL="<same value as Goose LIGHTSPEED_MODEL>"RHOS_LIGHTSPEED_URL and RHOS_LIGHTSPEED_MODEL can override the URL and model
from the default config. Use a service origin without /v1. With the test-operator
playbook, supply lightspeed_model. For Goose API tests, set the model to the Goose
container's LIGHTSPEED_MODEL value.
If you run the tests outside of OpenShift, you need to have a running port forward
for the lightspeed-app-server service. For example:
oc port-forward -n openstack-lightspeed svc/lightspeed-app-server 8443:8443
Telemetry tests are excluded by default. To run them, deploy Lightspeed and
enable its metrics collection through telemetry-operator. Configure the
Lightspeed URL and token above, then set a reachable Prometheus URL. TLS
verification is enabled by default. For an internal CA, set
RHOS_LIGHTSPEED_PROMETHEUS_CA_CERT_PATH (prometheus.ca_cert_path) to its
PEM CA bundle:
export RHOS_LIGHTSPEED_PROMETHEUS_URL="https://metric-storage-prometheus.openstack.svc:9090"
export RHOS_LIGHTSPEED_PROMETHEUS_CA_CERT_PATH="/path/to/prometheus-ca.pem"
lightspeed-tests -m telemetryIf you run the telemetry test outside of OpenShift, you need to have a running port forward
for the metric-storage-prometheus service. For example:
oc port-forward -n openstack svc/metric-storage-prometheus 9090:9090
Map metric-storage-prometheus.openstack.svc to 127.0.0.1 in your local
hosts file and keep the service hostname in the URL above so TLS hostname
verification succeeds. Export the OpenStack control plane CA bundle locally:
oc -n openstack get secret combined-ca-bundle \
-o jsonpath='{.data.tls-ca-bundle\.pem}' | base64 --decode > prometheus-ca.pem
export RHOS_LIGHTSPEED_PROMETHEUS_CA_CERT_PATH="$PWD/prometheus-ca.pem"The command accepts pytest options and returns pytest's exit status. In a uv
checkout, prefix the commands below with uv run. An explicit -m expression
replaces the default not telemetry filter. For example, -m "not llm_dependent"
also includes telemetry; use -m "not llm_dependent and not telemetry" to exclude
both groups.
# Run the default suite (excludes telemetry)
lightspeed-tests
# Run all tests, including telemetry (requires Prometheus configuration)
lightspeed-tests -m ""
# Run integration tests only
lightspeed-tests -k integration
# Run one installed test module
lightspeed-tests rhos_lightspeed_tests.tests.integration.test_query_endpoint
# Run one test file from a checkout
lightspeed-tests src/rhos_lightspeed_tests/tests/integration/test_query_endpoint.py
# Run Goose API tests
lightspeed-tests -k goose
# Skip Goose tests that require a real LLM's answer content
lightspeed-tests -k goose -m "not llm_dependent"
# Verify test discovery without contacting a service
lightspeed-tests --collect-only
# Choose a different JUnit XML report path
lightspeed-tests --junitxml=results.xmlIntegration tests require a deployed Lightspeed service. Goose tests also require a configured model.
-
Create test file in appropriate directory:
src/rhos_lightspeed_tests/tests/unit/- Fast, isolated suite testssrc/rhos_lightspeed_tests/tests/integration/- Tests requiring deployed servicesrc/rhos_lightspeed_tests/tests/e2e/- Full end-to-end scenarios
-
Use the shared fixtures from
conftest.py:class TestMyFeature: def test_something(self, client, config): response = client.query("my question") assert response.status_code == 200
-
Run:
uv run lightspeed-tests -k test_my_feature
Build a source distribution and wheel with uv build.
rhos-lightspeed-tests/
├── src/rhos_lightspeed_tests/ # Installed package
│ ├── __init__.py # lightspeed-tests entry point
│ ├── client.py # API client (query, health)
│ ├── config.py # Loads defaults and environment overrides
│ ├── default.yaml # Bundled default configuration
│ ├── pytest.ini # Bundled pytest settings and default suite
│ └── tests/
│ ├── conftest.py # Shared fixtures (config, client)
│ ├── unit/
│ ├── integration/
│ └── e2e/
├── pyproject.toml
└── README.md