Quality and validation
The quality system checks that BunkerWeb works across its supported run modes and that its security features produce the expected results. It combines repeatable environment setup with scenario checks, package checks, browser checks, and unit coverage gates so a change is tested from service start to user-visible result.
Validation model
The test harness turns each scenario into a short, isolated run. It prepares the target environment, starts the needed services, loads a YAML scenario, checks the result, and removes the test state. A scenario can check an HTTP response, browser state, package state, or service state.
The main validation flow moves from an environment choice to a scenario result and then to cleanup.
flowchart LR
A[Choose environment] --> B[Prepare services]
B --> C[Load scenario]
C --> D[Apply scenario actions]
D --> E[Check response or service state]
E --> F{Pass?}
F -->|Yes| G[Clean up]
F -->|No| H[Collect logs and fail]
H --> G
The harness retries checks during a bounded wait. This helps separate slow service startup from a real failure without hiding a result that never becomes valid. See test orchestration for the run contract and environment setup.
References: tests/…/test.sh tests/README.md
Supported environments
The project validates the same product behavior through several deployment shapes. This shows whether a feature works in a container stack, a Linux service, or a cluster control plane.
| Environment | Quality signal |
|---|---|
| Docker Compose | Service behavior in a local multi-container stack. |
| Linux package install | Package behavior through system services on supported distributions. |
| Kubernetes | Cluster deployment and readiness through a local cluster. |
| Autoconf | Service discovery and dynamic configuration in a Compose-based setup. |
| All-in-one | Behavior when the product services run in one packaged image. |
| Browser UI | User flows against the UI in Docker or on a Linux installation. |
Swarm is not part of the current validation set. The CI workflow selects the integration type, architecture, runner, and scenario from one matrix entry. It then uses the matching built image or Linux package so the test checks the artifact produced for that run.
References: .github/…/integration-tests.yml• L16-99 .github/…/integration-tests.yml• L282-333 tests/AGENTS.md
Scenario suites
Scenario suites express product expectations as named cases. The same scenario model can run against different service layouts, while each environment supplies the services and readiness checks that the case needs.
Core security scenarios
Core suites check the controls that change how BunkerWeb handles a request. They cover both the enabled path and the safe behavior when a feature is disabled or configured with an alternate source.
| Scenario group | What it validates |
|---|---|
| Request controls | Access rules, rate limits, redirects, headers, CORS, and client caching. |
| Threat controls | Antibot behavior, bad-actor handling, scans, and ModSecurity rule modes. |
| Identity and transport | Authentication, sessions, certificates, and secure-host behavior. |
| Service dependencies | Redis, database, compression, plugins, and command-line access. |
Each case changes one feature state at a time, waits for the service to become ready, and checks the expected result. This shows whether the feature changes traffic as intended instead of only showing that the process started.
References: tests/README.md tests/core/ tests/core_handlers/
Integration scenarios
Integration scenarios validate behavior that depends on more than one service or on a deployment platform. They check that configuration reaches the right service and that the resulting stack stays usable.
The principal integration paths are:
- Docker Compose for repeatable service combinations.
- Autoconf for service discovery and dynamic configuration.
- Kubernetes for cluster deployment and readiness.
- Linux packages for service-manager operation on distribution images.
- All-in-one for the single-image service layout.
The scenario definitions use stable example host names and replace them with test domains for each run. This keeps checks isolated while preserving the relationships between the protected service, upstream applications, and supporting services. See integration test scenarios for the scenario families and deployment relationships.
References: tests/README.md tests/…/integrations.yml .github/…/integration-tests.yml• L333-418
UI scenarios
UI scenarios validate the product through a real browser. They confirm that a user can reach the UI, use its main pages, and complete security-sensitive account actions.
The browser suite checks page navigation and form state. It also covers account changes, login, logout, and time-based one-time-password activation and removal. CI prepares Firefox and stores a screenshot when a UI run fails, which gives a failure a visible result as well as a process log.
References: tests/ui/ .github/…/integration-tests.yml• L136-225 .github/…/integration-tests.yml• L434-439
Unit validation
The unit suite checks the Python layers without starting a deployment stack. It runs across supported database engines and applies both statement and branch coverage floors to each product component and to the overall suite.
The coverage gate includes source files that were not imported during the run. It maps each source path to a component, calculates the gap to its floor, and fails the run when any component or the overall result is below its line or branch threshold.
References: tests/…/coverage_gate.py• L13-37 tests/…/coverage_gate.py• L42-110 tests/…/README.md
Result evidence
Validation reports success only after both environment readiness and scenario checks pass. Readiness comes from container health, service state, or a known ready message. Scenario evidence comes from HTTP responses, browser state, package state, coverage data, or TLS certificate data.
When a run fails, the harness collects evidence from the affected stack before it exits. This gives the next engineer enough information to separate a startup problem from a feature problem. Cleanup then removes containers, stacks, temporary files, and changed service state so later scenarios do not inherit a prior result.
References: tests/…/test.sh tests/scripts/ tests/…/coverage_gate.py• L113-148 .github/…/integration-tests.yml• L274-281
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the integration matrix, workflow input format, and scenario selection contract aligned.
- Keep each integration tied to the image or package artifact built for the same release value.
- Keep scenario action types aligned across their YAML model, runner, and handler so an expected check is not silently dropped.
- Add a coverage component mapping and both floors when a new source component enters the unit gate.
- Keep Linux package names, distribution rows, and package artifact names aligned across setup and install steps.
- Keep browser setup, UI addresses, and failure artifacts aligned when the UI service changes.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A selected image or Linux package is missing for the matrix entry. | The integration run cannot test the intended artifact. | The workflow selects and pulls the artifact that matches the integration and release inputs. |
| A stack never reaches its health or ready signal. | The scenario does not run and the environment test fails. | Bounded readiness waits collect service logs before exit. |
| A scenario action uses a field that its model does not define. | The field is dropped and the intended assertion does not run. | Keep scenario fields aligned with the action model and handler contract. |
| A source path has no coverage component mapping. | The coverage gate stops instead of producing a trusted result. | Add the path mapping and its coverage floors with the component. |
| A component falls below its line or branch floor. | The unit validation job fails even when the overall percentage is high. | The gate evaluates every component and the overall result. |
| The browser or driver cannot reach the UI. | UI cases fail before they can test user behavior. | CI installs the browser and driver, then uploads a failure screenshot when available. |
Key files
| File | Why to read it |
|---|---|
| tests/README.md | Explains the scenario model, supported integrations, and local run contract. |
| tests/…/test.sh | Shows the main integration-test entry point and lifecycle. |
tests/core/ | Shows how core security expectations are expressed as scenarios. |
tests/api/ | Shows API-focused scenario coverage. |
tests/ui/ | Shows browser-based product and account checks. |
| tests/…/coverage_gate.py | Defines component line and branch coverage floors. |
| tests/…/README.md | Explains the unit suite and database-engine validation. |
| .github/…/integration-tests.yml | Defines CI setup, artifact selection, environment preparation, and test execution. |
| tests/…/integrations.yml | Defines the integration and runner matrix used by the harness. |