PropertyDamage.Nemesis.NetworkPartition (PropertyDamage v0.2.0)
View SourceSimulate network partitions between components.
Creates a network partition that blocks traffic between services, useful for testing split-brain scenarios, failover behavior, and partition tolerance.
Partition Types
:full- Complete bidirectional partition (no traffic in either direction):upstream- Block traffic from client to server:downstream- Block traffic from server to client:asymmetric- Requests go through, responses blocked
Configuration
:partition_type- Type of partition (default::full):duration_ms- How long the partition lasts (default: 5000ms):target- Specific service/host to partition (default::all)
Usage with Toxiproxy
context = %{toxiproxy: %{proxy_name: "database", api_url: "http://localhost:8474"}}Example
# In your model
def commands do
[
{QueryDatabase, weight: 5},
{PropertyDamage.Nemesis.NetworkPartition, weight: 1}
]
endTesting Behavior
During a partition, your system should:
- Detect the failure (timeouts, connection refused)
- Handle gracefully (retry, failover, queue)
- Recover when partition heals