natstest

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

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

type Server struct {
	NS *natsserver.Server
	NC *nats.Conn
	JS jetstream.JetStream
}

Server is a running embedded nats-server with a connected client.

func Start

func Start(t testing.TB) *Server

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL