E2E tests fall into one of three sharing tiers. Each tier maps to one
or more CI shards (see e2e-parallelism.md for the shard scheme).
The test asserts on state already produced by the session-scoped
styrmin_resources + a session-scoped deployed_simple_app (or
equivalent). It MUST NOT create, modify, or delete deployments.
- Shard:
general(lumped together with isolated-mutation tests because read-only assertions are cheap and don't warrant their own shard). - Examples:
test_pod_component_attribution,test_ui_smoke,test_deployment_timeline, the cli-auth and admin-user/group suites. - Review rule: A read-only test that creates its own deployment is a review-blocker. Refactor to consume the shared fixture.
The test creates and tears down its own deployment with a unique name. Multiple isolated-mutation tests can run in the same shard but each one must not depend on another's state.
- Shard:
generalfor most short mutation tests,envfor env-var / env-update tests,computefor pod-scheduling or ingress-controller tests,applyfor manifestapply/apply_filestests,task_stepsfor tests that fail a rollout on purpose and wait out the operator's or FluxCD's timeouts. - Examples:
test_deploy_app,test_delete_deployment_*,test_environment_update,test_service_discovery(its module fixture createsintentandexecutorin the session's scenario environment, and its last test deletesintent, so the other tests of the module run before it). - Review rule: Reuse
deployed_simple_appif your test only reads — do not create a fresh deployment just for an isolated assertion.
The test depends on cluster-wide infrastructure that conflicts with other tests, or on a heavy product stack whose boot time would starve a shared shard. It MUST live in its own file and its own shard.
- Shards:
backup(Velero / Garage) — deployment-level simple-app + database backup/restore.env_backup(Velero / Garage) — environment-level backup/restore and environment clone; split out ofbackupso the two shards run in parallel instead of one cell taking about twice as long as any other.infrahub(Infrahub stack) — boots a full Infrahub server + DB; split out ofbackupso debug iteration on the simple-app backup tests doesn't pay for the Infrahub boot.
- Examples:
test_backup_and_restore_lifecycle,test_backup_restore_databases(inshard_backup);test_environment_backup_and_restore_lifecycle,test_environment_clone_lifecycle(inshard_env_backup, same module, per-test markers);test_infrahub_backup_restore(inshard_infrahub). - Review rule: Adding another "heavy" test category? Open an ADR
first — the matrix YAML in
.github/workflows/ci.ymlneeds a new shard entry alongside updates to_VALID_SHARDS(conftest),pyproject.tomlmarkers, and both e2e guides.
A new E2E test that only reads state is not free just because it consumes a session-scoped fixture. Before adding one, run these checks:
-
Does an existing test already boot the stack you need? If so, add your assertion to that test (or a sibling in the same file that shares its session fixture) instead of creating a new test node. Prefer extending an existing E2E over adding a new one whenever the setup is shared and expensive — this is explicitly allowed by Constitution §V ("…or an existing one extended to cover the new behaviour").
-
Does the session fixture you're about to depend on have an active, non-skipped consumer? A session-scoped fixture is only booted when a test that actually runs requests it. If every current consumer is
@pytest.mark.skip, your test becomes its sole consumer and silently pays the full boot cost — a heavy boot in disguise, not a reuse. Verify withgrep -rn <fixture_name> backend/tests/e2e/ | grep -v conftestand confirm at least one consumer is not skipped. -
Is there a cheaper already-booted stack that exercises the same machinery? Driver-format features (service discovery, computed FQDNs, ingress) are shared across driver variants that use the same subchart. If the community and enterprise variants both run the component under test, assert against whichever stack is already booted in the shard rather than booting a second one — adding the service/values to that variant's driver for parity if it is missing.
Worked example (#273 / PR #308). The Prefect-UI task-manager service was
added to the community infrahub driver, and the first draft added a new test
consuming deployed_infrahub_app. But that fixture's only other consumer is the
community backup test, which is skipped — so the community stack is never booted
in CI, and the new test would have resurrected a full second Infrahub boot in
shard_infrahub for four read-only assertions. The fix: declare the same
task-manager service on the enterprise driver (identical prefect-server
subchart) and assert against the already-booted deployed_infrahub_enterprise_app.
Net new heavy boots: zero.
- Does it touch the Infrahub stack (full Infrahub server + DB)? → Yes:
infrahub(isolated). - Does it touch Velero or Garage? → Yes:
backup(isolated). - Is it a config-drawer UI flow? → Yes:
configuration. - Is it a manifest
apply/apply_filesflow? → Yes:apply. - Does it fail a rollout on purpose and wait out the operator's or FluxCD's timeouts? → Yes:
task_steps. - Is it about env vars or environment updates? → Yes:
env. - Is it about pod scheduling or the ingress controller? → Yes:
compute. - Otherwise →
general.
A configuration module does not create its own deployment. Declare it
at module level — DRAWER_DEPLOYMENT = DrawerDeployment(name="drawer-…"),
with config=DeploymentConfigInput(...) for a non-default baseline — and
take the drawer_deployment fixture. configuration/conftest.py creates
every selected, non-skipped module's environment + deployment
concurrently through the SDK, so a new module adds almost no wall-clock.
Seed the baseline through config rather than a follow-up
deployments.update: each update is another reconcile.
Every @pytest.mark.ci E2E test MUST carry exactly one bare-name
shard marker (shard_general, shard_env, shard_compute,
shard_backup, shard_env_backup, shard_infrahub,
shard_configuration, shard_apply, or shard_task_steps). The conftest collection hook (enforce_shard_markers)
rejects the suite if any test is missing the marker or carries more
than one.
Apply at module scope when all tests in the file share the same shard:
pytestmark = [
pytest.mark.ci,
pytest.mark.api_only(reason="..."), # if applicable
pytest.mark.shard_general,
]