#nats #testing #injection #clients #fault #path #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

#1364 in Filesystem

Download history 139/week @ 2023-11-20 80/week @ 2023-11-27 79/week @ 2023-12-04 166/week @ 2023-12-11 293/week @ 2023-12-18 23/week @ 2023-12-25 104/week @ 2024-01-01 303/week @ 2024-01-08 243/week @ 2024-01-15 193/week @ 2024-01-22 405/week @ 2024-01-29 204/week @ 2024-02-05 1075/week @ 2024-02-12 240/week @ 2024-02-19 578/week @ 2024-02-26 652/week @ 2024-03-04

2,548 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–6.5MB
~118K SLoC