Skip to content

CICD-348 · Network partition simulation ​

Encyclopedia · Distributed systems and reliability testing · All snippets

Previous · CICD-347 · Next · CICD-349

1. Where it fits ​

  • Placement isolated compose CI job.
  • Prerequisites disposable integration environment, synthetic traffic and controlled test faults.
  • Platforms local-linux, github-actions, gitea-actions.

2. Copy the snippet ​

bash
docker network disconnect chaoslab_partition worker
trap 'docker network connect chaoslab_partition worker' EXIT
pytest -q tests/test_partition_recovery.py

3. How it works ​

The lab network disconnect removes one path to the disposable worker. A reconnect trap restores it while the test probes recovery and stale-work handling.

4. Verify the result ​

Use disposable named containers and network. Verify stale work is retried or fenced after the reconnect.

Watch for. Confine the test and all synthetic traffic to an authorized, disposable lab. Check cleanup even after a failing assertion.

Validation syntax-validated (Bash parse). Status definitions.