Introducing a new way to review your PRs.

Read the announcement

bunkerity / bunkerweb

🛡️ Open-source and cloud-native Web Application Firewall (WAF)

View on GitHub

19 documents · Updated Nov 23, 2026

docs / test-orchestration

Test orchestration

Test orchestration provides one Python entry point for running integration checks against several deployment forms. It prepares a clean test area, selects the environment adapter, runs scenario checks with shared rules, reports useful logs, and removes the temporary environment.

Runner scope

The runner treats each example as a named scenario and each environment as a separate execution mode. It reads the scenario's tests.json, checks whether the selected mode is allowed, then sends the scenario to the matching environment class (tests/main.py• L22-32, tests/main.py• L82-126).

The main execution modes are:

ModeSystem under test
dockerA scenario-managed Docker Compose stack
autoconfA shared Autoconf Compose stack plus the scenario stack
swarmA Docker Swarm deployment
kubernetesA Kubernetes deployment
linuxA package installed inside a distribution container

The runner also accepts ansible as an input value, but tests/main.py has no normal setup or scenario dispatch branch for it. Infrastructure creation and removal use separate Terraform and Ansible scripts (tests/create.sh• L9-46, tests/rm.sh• L9-21).

References: tests/main.py• L22-32 tests/main.py• L82-126 tests/create.sh• L9-46 tests/rm.sh• L9-21

Execution selection

Scenario selection is data driven. A scenario declares its name, supported modes, timeout, optional start delay, optional data-copy rule, and a list of HTTP or TLS checks in examples/…/tests.json (examples/…/tests.json• L1-15). The runner executes matching scenarios in directory order and stops at the first failed scenario.

Each run creates temporary domain names from the test-domain environment values. This keeps parallel or repeated runs away from fixed public names while allowing scenario files to keep stable example names (tests/main.py• L56-80). The selected workflow supplies those values and starts one run for each requested environment or Linux distribution (.github/…/staging-tests.yml• L169-250). For the scenario definitions behind these executions, see Integration test scenarios.

References: examples/…/tests.json• L1-15 tests/main.py• L56-80 tests/main.py• L82-132 .github/…/staging-tests.yml• L169-250

Environment lifecycles

The environment adapters keep a common execution contract while changing how the product is started. Each adapter prepares its platform, waits for readiness, runs the selected scenarios, collects failure evidence, and removes platform resources.

The remaining adapters cover these deployment forms:

AdapterLifecycle role
AutoconfTestStarts the shared Autoconf services, then starts each scenario's Autoconf stack (tests/AutoconfTest.py• L26-101, tests/AutoconfTest.py• L122-225).
SwarmTestDeploys the shared and scenario stacks, waits for services, and removes the stack and temporary resources (tests/SwarmTest.py• L18-129, tests/SwarmTest.py• L131-249).
KubernetesTestApplies the shared Kubernetes deployment, waits for healthy pods, then applies and removes scenario resources (tests/KubernetesTest.py• L18-193, tests/KubernetesTest.py• L195-249).

References: tests/AutoconfTest.py• L26-225 tests/SwarmTest.py• L18-249 tests/KubernetesTest.py• L18-249

Logging and failure evidence

The logger writes timestamped, flushed lines with a component name and severity marker. Shared lifecycle events use the TEST label. Environment adapters use their own labels so startup, cleanup, and platform failures remain easy to separate in CI output (tests/logger.py• L1-6, tests/Test.py• L27-30).

Failure handling first records the failed assertion or exception. It then asks the active adapter to expose the system's logs: service logs for Swarm and pod logs for Kubernetes (tests/Test.py• L139-200, tests/SwarmTest.py• L239-249, tests/KubernetesTest.py• L242-249).

References: tests/logger.py• L1-6 tests/SwarmTest.py• L239-249 tests/KubernetesTest.py• L242-249

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the mode names accepted by tests/main.py, the kinds values in scenario files, and the workflow input values aligned.
  • Update both domain replacement and certificate-name expectations when a scenario changes its host names.
  • Keep adapter cleanup when adding a new setup resource, because top-level failure paths depend on end() after scenario failure.
  • Keep Linux distribution names aligned across package-image preparation and workflow matrix steps.

Important failure modes

TriggerConsequenceGuard
A scenario omits the selected mode from kindsThe scenario is skipped without running its checksReview tests.json mode lists when adding or changing a workflow mode
A test-domain value is missingGenerated URLs contain missing domain data and requests failProvide the domain variables before invoking tests/main.py
The environment does not become healthy during setupThe run stops before scenario checks and adapter diagnostics are printedCheck the platform stack health and its logs first
ansible is passed to the Python runnerThe input is accepted but no normal adapter runsUse a supported runner mode or the separate provisioning scripts

Key files

FileWhy to read it
tests/main.pyDefines command selection, scenario discovery, domain generation, and top-level cleanup.
tests/AutoconfTest.pyShows the two-stack Autoconf test lifecycle.
tests/SwarmTest.pyShows service readiness and cleanup for Docker Swarm.
tests/KubernetesTest.pyShows cluster deployment, pod readiness, and resource cleanup.
examples/…/tests.jsonShows the scenario data contract for mode selection and checks.
.github/…/staging-tests.ymlShows how CI selects modes, supplies domains, prepares images, and invokes the runner.
tests/logger.pyDefines the common timestamped log format.