monaxtest

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package monaxtest provides a utility function to start the SUT for Monax tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(ctx context.Context, config *monax.Config, newRuntimeFn monax.NewRuntimeFn) (*monax.SUT, error)

Start creates, starts, and checks the health of the Monax SUT.

If the SUT fails to start or is unhealthy after startup, it will be stopped and an error will be returned. Otherwise, the SUT is returned. The caller is responsible for stopping the SUT.

Example Usage:

var sut *monax.SUT

func TestMain(m *testing.M) {
	ctx := context.Background()
	var err error
	sut, err = monaxtest.Start(ctx, &config, myRuntime.New)
	if err != nil {
		log.ExitContextf(ctx, "Failed to start SUT: %v", err)
	}
	defer func() {
		if err := sut.Stop(ctx); err != nil {
			log.ErrorContextf(ctx, "Failed to stop SUT: %v", err)
		}
	}()
	m.Run()
}

func TestX(t *testing.T) {
	ctx := t.Context()
	if err := sut.Status(ctx); err != nil {
			t.Fatalf("SUT is unhealthy: %v", err)
	}
	// use sut
}

Types

This section is empty.

Jump to

Keyboard shortcuts

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