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.
Click to show internal directories.
Click to hide internal directories.