Skip to content

ADR-041: Shared operator fixture in tests

Category: development Provenance: human

Decision

Use shared pytest fixture for operator deployment in integration tests. Single operator instance serves all integration tests to reduce setup time and resource usage.

Rationale

Deploying operator for every test is slow. Session-scoped fixture deploys once, amortizing cost across all tests. Reduces Kind cluster resource usage - single operator deployment vs dozens. Faster test suite execution. Tests remain isolated via namespace-scoped fixtures for resources. Operator reconciles resources in all namespaces so single instance can serve multiple test namespaces. Trade-off: Tests can't modify operator configuration, but that's rarely needed.

Agent Instructions

Define operator fixture at session scope in conftest.py. Deploy operator once per test session, not per test. Use namespace fixtures for test isolation. Tests should be independent despite sharing operator. Clean up test resources between tests, not operator itself.

Rejected Alternatives

Deploy operator per test

Very slow. Each test waits for operator deployment. Excessive resource usage in Kind cluster.

No operator, mock reconciliation

Defeats purpose of integration tests. Need real operator behavior to catch bugs.