Expand description
Fault injection primitives for testing Redis client resilience.
This module provides operations for simulating failures in Redis topologies: killing nodes, freezing processes (SIGSTOP/SIGCONT), triggering failovers, and more. All operations work with the handle types returned by the server, cluster, and sentinel builders.
§Example
use redis_server_wrapper::{RedisCluster, chaos};
use std::time::Duration;
let cluster = RedisCluster::builder()
.masters(3)
.replicas_per_master(1)
.base_port(7100)
.start()
.await
.unwrap();
// Freeze a node (SIGSTOP) -- it stops processing but stays in memory.
chaos::freeze_node(cluster.node(0));
// ... test client behavior with a frozen node ...
// Resume the node (SIGCONT).
chaos::resume_node(cluster.node(0));Functions§
- flushall
- Flush all data from a node.
- freeze_
master_ by_ slot - Freeze the master node that owns a given hash slot.
- freeze_
node - Freeze a node by sending SIGSTOP.
- kill_
master_ by_ key - Kill the master node that owns the hash slot for a given key.
- kill_
master_ by_ slot - Kill the master node that owns a given hash slot.
- kill_
node - Kill a node immediately with SIGKILL.
- recover
- Resume all nodes in a cluster by sending SIGCONT.
- resume_
node - Resume a frozen node by sending SIGCONT.
- slow_
down - Pause client connections for a duration using
CLIENT PAUSE. - trigger_
failover - Trigger a
CLUSTER FAILOVERon a replica node. - trigger_
save - Trigger a background RDB save.