pub struct RedisCluster {
pub servers: Vec<RedisServer>,
pub folders: Vec<TempDir>,
pub tls_paths: Option<TlsFilePaths>,
}Expand description
A mock Redis Cluster for testing.
RedisCluster spawns multiple RedisServer instances and configures them as a cluster.
It provides methods to start, stop, and interact with the servers.
§Example
use redis_test::cluster::{RedisCluster, RedisClusterConfiguration};
let config = RedisClusterConfiguration::default();
let cluster = RedisCluster::new(config);
// Get the connection details of the nodes and connect
let addresses: Vec<_> = cluster.servers.iter().map(|s| s.connection_info()).collect();
let client = redis::cluster::ClusterClient::new(addresses).unwrap();
let mut connection = client.get_connection().unwrap();Fields§
§servers: Vec<RedisServer>§folders: Vec<TempDir>§tls_paths: Option<TlsFilePaths>Implementations§
Source§impl RedisCluster
impl RedisCluster
pub fn username() -> &'static str
pub fn password() -> &'static str
pub fn new(configuration: RedisClusterConfiguration) -> RedisCluster
pub fn stop(&mut self)
pub fn iter_servers(&self) -> impl Iterator<Item = &RedisServer>
Trait Implementations§
Source§impl Drop for RedisCluster
impl Drop for RedisCluster
Auto Trait Implementations§
impl Freeze for RedisCluster
impl RefUnwindSafe for RedisCluster
impl Send for RedisCluster
impl Sync for RedisCluster
impl Unpin for RedisCluster
impl UnsafeUnpin for RedisCluster
impl UnwindSafe for RedisCluster
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more