#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

#10 in #fault

Download history 440/week @ 2024-07-20 441/week @ 2024-07-27 317/week @ 2024-08-03 201/week @ 2024-08-10 101/week @ 2024-08-17 101/week @ 2024-08-24 231/week @ 2024-08-31 267/week @ 2024-09-07 110/week @ 2024-09-14 228/week @ 2024-09-21 352/week @ 2024-09-28 323/week @ 2024-10-05 437/week @ 2024-10-12 360/week @ 2024-10-19 132/week @ 2024-10-26 183/week @ 2024-11-02

1,140 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

~5–14MB
~159K SLoC