feat(smoke-test): select pytest smoke tests by backend capability

Merged
DE
2d ago
+1089-26

Smoke tests can now run against the Docker quickstart (default) or the Docker-free local stack (datahub-dev.sh start --local).

  • requires(...) marker and utilities/backends.py / backend_plugin.py: SMOKE_BACKEND=local deselects tests needing Kafka, the SQL database, the docker CLI, the Play frontend or object storage; SMOKE_BACKEND_MODE=canary runs only those (plus docker_canary) on Docker.
  • Batch plans record the backend; a batch job run with a different backend stops.
  • Kafka/SQL test helpers fail fast with the marker to add when the backend lacks the capability.
  • .github/scripts/check_backend_markers.py: static lint (pre-commit + smoke-test-lint) for modules that use Kafka/SQL/docker without a marker.
  • CI: SMOKE_BACKEND=docker on the pytest plan and batch steps; the GMS-lite local-stack workflow runs its smoke tests with SMOKE_BACKEND=local and checks the lane selection.
  • Tests read ES URL, usage index, index prefix and frontend URL from env, so they also run on the Docker-free stack.
  • Markers from a full run on the Docker-free stack: requires(play_frontend) on mcp/mcp_test.py and the two Bearer-token tests in test_authentication_e2e.py; requires(kafka) on the actions doc/term propagation modules (no actions process locally); test_queue_ingest_usage.py needs only kafka.
  • The analytics backfill writes to ELASTICSEARCH_INDEX, so it honours the local stack's index prefix.

No behaviour change when SMOKE_BACKEND is unset (defaults to docker, every test selected).

Ported from the fork: bf8f597ae85, 1925b3b8a27, a869b8017bd, 435dba1da41, and marker parts of 73f4a580589.

  • The PR conforms to DataHub's Contributing Guideline (particularly PR Title Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (tests/unit/test_backend_plugin.py, test_check_backend_markers.py, test_batch_plan_dump.py)
  • Docs related to the changes have been added/updated (smoke-test/AGENTS.md, smoke-test/README.md)
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Breaking Changes — none

šŸ¤– Generated with Claude Code


Summary by cubic

Smoke tests can now run on the Docker-free local stack (datahub-dev.sh start --local) as well as the Docker quickstart. Tests declare the backend capabilities they need with a requires(...) marker; SMOKE_BACKEND=local deselects tests that need Kafka, the SQL database, the docker CLI, the Play frontend, object storage, or the executor image, and SMOKE_BACKEND_MODE=canary runs only those tests on Docker.

No behavior change when SMOKE_BACKEND is unset: it defaults to docker and every test is selected.

Selection and markers

  • New Capability enum and selection logic in utilities/backends.py; a pytest plugin deselects tests the configured backend cannot run.
  • Markers sit on the tests that genuinely need the capability: only the Bearer-token auth and MCP tests require play_frontend, and the actions propagation tests require kafka because the local stack runs no actions process.
  • Kafka and SQL helpers in tests/e2e/utils.py fail fast naming the missing requires(...) marker on the local stack.
  • Unknown capability names and SMOKE_BACKEND_MODE=canary without SMOKE_BACKEND=docker fail collection with a usage error.
  • Tests read the ES URL, usage index, index prefix, and frontend URL from env, so they also run on the Docker-free stack.

CI and guardrails

  • New lint script .github/scripts/check_backend_markers.py flags modules that use Kafka, SQL, or the docker CLI without a marker; wired into pre-commit and smoke-test-lint.
  • Batch plans record the backend, and a batch job run with a different backend stops instead of running the wrong selection.
  • The GMS-lite local-stack workflow runs its smoke tests with SMOKE_BACKEND=local and verifies the lane selection.
  • CI sets SMOKE_BACKEND=docker on the pytest plan and batch steps.