#testing-server #nats #test-server #injection-for-testing #fault-injection #nats-based #buggy

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

#1617 in Filesystem

Download history 680670/week @ 2026-01-22 619553/week @ 2026-01-29 709446/week @ 2026-02-05 658699/week @ 2026-02-12 443494/week @ 2026-02-19 585043/week @ 2026-02-26 579163/week @ 2026-03-05 618968/week @ 2026-03-12 428138/week @ 2026-03-19 379254/week @ 2026-03-26 351032/week @ 2026-04-02 376269/week @ 2026-04-09 380918/week @ 2026-04-16 554660/week @ 2026-04-23 517785/week @ 2026-04-30 720798/week @ 2026-05-07

2,255,533 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–8MB
~141K SLoC