Crates.io | nats_test_server |
lib.rs | nats_test_server |
version | 0.3.0 |
source | src |
created_at | 2020-06-29 16:13:42.462699 |
updated_at | 2021-02-08 17:24:11.953999 |
description | An intentionally buggy NATS server that facilitates fault injection for testing error paths in NATS-based libraries |
homepage | |
repository | |
max_upload_size | |
id | 259460 |
size | 31,490 |
A test NATS server for testing the NATS rust client and applications using it. Allows injection of bugsand useful for testing a number of things.
#[test]
fn test_use_nats() {
let nats = NatsTestServer::build().spawn();
let my_component1 = component(nats.address())
let my_component2 = component(nats.address())
// test component behaviour
let nats = nats.restart().spawn();
// test behaviour after restart
} // server is stopped on drop
#[test]
fn test_use_buggy_nats() {
let nats = NatsTestServer::build().bugginess(400).spawn(); // a 1/400 chance of restarting on any given message
// bugginess test
}
hop_ports
doesn't make any sense for multiple clients