nats_test_server

Crates.ionats_test_server
lib.rsnats_test_server
version0.3.0
sourcesrc
created_at2020-06-29 16:13:42.462699
updated_at2021-02-08 17:24:11.953999
descriptionAn intentionally buggy NATS server that facilitates fault injection for testing error paths in NATS-based libraries
homepage
repository
max_upload_size
id259460
size31,490
Tyler Neely (spacejam)

documentation

README

Test server

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.

Example usage

#[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
}

Limitations

  • hop_ports doesn't make any sense for multiple clients
Commit count: 0

cargo fmt