mirror of
https://github.com/SigNoz/signoz.git
synced 2026-04-23 20:30:31 +01:00
Pull the e2e contributor guide out of tests/e2e/CLAUDE.md (which read like a full agent-workflow reference doc) and into docs/contributing/tests/e2e.md alongside the existing development / go guides. - Delete tests/e2e/CLAUDE.md; its content (layout, commands, role tags, locator priority, Playwright agent workflow) lives in the new e2e.md with references to the now-.gitignore'd specs/ dir removed. - Add docs/contributing/tests/integration.md — short guide covering layout, runner commands, filename conventions, and the flow for adding a new suite (there was no contributor doc for this before). - Trim tests/e2e/README.md to quick-start + commands; link out to the full guide. Readers who just want to run tests get the 5 commands they need; anything deeper is one hop away.
2.2 KiB
2.2 KiB
Integration tests
Backend integration tests run against a containerized SigNoz stack brought
up by pytest fixtures. Live under tests/integration/.
Layout
tests/integration/
bootstrap/setup.py Stack lifecycle entrypoint (test_setup, test_teardown)
tests/ Suites, one dir per feature area
<suite>/ e.g. alerts, dashboard, querier, role, ...
NN_<name>.py Numbered test files (collected in order)
testdata/ JSON / JSONL / YAML data keyed by suite
Running
From signoz/:
make py-test-setup # warm up stack (keeps containers under --reuse)
make py-test # run all integration suites
make py-test-teardown # free containers
From signoz/tests/:
uv sync # first time only
uv run pytest --basetemp=./tmp/ -vv --reuse integration/bootstrap/setup.py::test_setup
uv run pytest --basetemp=./tmp/ -vv --reuse integration/tests/<suite>/<file>.py
Always pass --reuse — without it, pytest recreates containers on every
invocation.
Conventions
- Filenames:
NN_<snake_name>.py(e.g.01_register.py). The numeric prefix orders execution within a suite. - Suite directory: one dir per feature area under
tests/. Optionally<suite>/conftest.pyfor suite-local fixtures. - Fixtures: shared ones live in
tests/fixtures/(registered viatests/conftest.py'spytest_plugins). Reuse before adding new. - Data: test inputs / expected outputs live in
testdata/<suite>/. Load viafixtures.fs.get_testdata_file_path. - Style: black + pylint via
make py-fmtandmake py-lintbefore committing (run from repo root).
Adding a suite
- Create
tests/integration/tests/<suite>/with an empty__init__.py. - Add
01_<entry>.pywithtest_<thing>(signoz: types.SigNoz)functions. - Import shared fixtures directly (e.g.
from fixtures.auth import USER_ADMIN_EMAIL, USER_ADMIN_PASSWORD). - If the suite needs bespoke setup, add
conftest.pyalongside the tests. - Put any test data under
testdata/<suite>/.
Running a single test while iterating:
uv run pytest --basetemp=./tmp/ -vv --reuse \
integration/tests/<suite>/<file>.py::test_<name>