Files
signoz/docs/contributing/tests/integration.md
grandwizard28 8633b3d358 docs(contributing/tests): move e2e/integration guides out of test dirs
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.
2026-04-21 22:27:43 +05:30

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.py for suite-local fixtures.
  • Fixtures: shared ones live in tests/fixtures/ (registered via tests/conftest.py's pytest_plugins). Reuse before adding new.
  • Data: test inputs / expected outputs live in testdata/<suite>/. Load via fixtures.fs.get_testdata_file_path.
  • Style: black + pylint via make py-fmt and make py-lint before committing (run from repo root).

Adding a suite

  1. Create tests/integration/tests/<suite>/ with an empty __init__.py.
  2. Add 01_<entry>.py with test_<thing>(signoz: types.SigNoz) functions.
  3. Import shared fixtures directly (e.g. from fixtures.auth import USER_ADMIN_EMAIL, USER_ADMIN_PASSWORD).
  4. If the suite needs bespoke setup, add conftest.py alongside the tests.
  5. 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>