FailSafe Docs
Backend Testing

Backend Chaos Testing

Test your backend services running in Docker containers.

Docker Targets

FailSafe connects to your Docker daemon to discover and target running containers. You can specify targets by name, ID, or label selectors.

Prerequisites
  • Docker Engine running and accessible
  • FailSafe has access to Docker socket
  • Target containers are running
# Verify Docker is accessible
docker ps

# Run FailSafe with Docker socket access
docker run -v /var/run/docker.sock:/var/run/docker.sock failsafe/agent
Targeting Methods

By Container Name

Target specific containers by their name.

"targets": ["api-service", "postgres-db"]

By Container ID

Target by full or partial container ID.

"targets": ["abc123def456", "xyz789"]

By Label Selector

Target all containers matching label criteria.

"targets": ["app=myapp", "env=staging"]

Wildcard Patterns

Use wildcards to match multiple containers.

"targets": ["api-*", "*-service"]

Fault Types

Backend fault types simulate various infrastructure failures.

cpu_stress
CPU Stress

Consumes CPU cycles to simulate high CPU load on a container.

IntensityEffect
1010% CPU usage
5050% CPU usage
100100% CPU usage (all cores)
{
  "fault_type": "cpu_stress",
  "targets": ["api-service"],
  "duration": 60,
  "max_intensity": 80
}
memory_stress
Memory Stress

Allocates memory to simulate memory pressure.

IntensityEffect
25Allocate 25% of available memory
50Allocate 50% of available memory
90Allocate 90% - may trigger OOM
kill
Process Kill

Terminates container processes to simulate crashes.

IntensityEffect
1010% chance to kill per interval
5050% chance to kill per interval
100Guaranteed kill
network_delay
Network Delay

Adds latency to network packets using tc (traffic control).

IntensityEffect
5050ms added latency
200200ms added latency
10001 second added latency
packet_loss
Packet Loss

Drops a percentage of network packets.

IntensityEffect
55% packet loss
2020% packet loss
5050% packet loss - severe degradation