Documentation
¶
Overview ¶
Package natstest starts an embedded, in-process nats-server with JetStream enabled for use in tests. It is a real server (no client mocks), satisfying the requirement that all tests run against a genuine nats-server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
Server is a running embedded nats-server with a connected client.
func Start ¶
Start launches an embedded JetStream-enabled nats-server on a random port, returns a connected client and a JetStream context, and registers cleanup with the test.
func (*Server) Connect ¶ added in v0.2.0
Connect opens a second, independent connection to the same server, closed when the test ends. Use it where the point under test is that two separate processes share only a NATS cluster: reusing s.NC would hide a dependency on in-process state that a real deployment does not have.