#nats #injection #testing #fault #nats-client #facilitate #test-server

bin+lib nats_test_server

An intentionally buggy NATS server that facilitates fault injection for testing error paths in NATS-based libraries

5 unstable releases

0.3.0 Feb 8, 2021
0.2.0 Nov 23, 2020
0.1.2 Jul 6, 2020
0.1.1 Jul 6, 2020
0.1.0 Jun 29, 2020

#1417 in Filesystem

Download history 809/week @ 2024-04-06 424/week @ 2024-04-13 698/week @ 2024-04-20 2283/week @ 2024-04-27 2653/week @ 2024-05-04 2536/week @ 2024-05-11 2377/week @ 2024-05-18 1892/week @ 2024-05-25 2976/week @ 2024-06-01 4032/week @ 2024-06-08 3118/week @ 2024-06-15 1980/week @ 2024-06-22 573/week @ 2024-06-29 269/week @ 2024-07-06 123/week @ 2024-07-13 436/week @ 2024-07-20

1,652 downloads per month

Apache-2.0

24KB
566 lines

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

Dependencies

~4–14MB
~153K SLoC