servicetest

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 13 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertHealthReportNames added in v0.5.0

func AssertHealthReportNames(t *testing.T, hp map[string]error, names ...string)

func Run

func Run[R Runnable](tb TestingT, r R) R

Run fails tb if the service fails to start or close.

func RunHealthy

func RunHealthy[S services.Service](tb TestingT, s S) S

RunHealthy fails tb if the service fails to start, close, is never ready, or is ever unhealthy (based on periodic checks).

  • after starting, readiness will always be checked at least once, before closing
  • if ever ready, then health will be checked at least once, before closing

func SetupNoOpMock added in v1.3.0

func SetupNoOpMock(srv Mock)

SetupNoOpMock registers possible no-op methods calls on a mocked services.Service.

Types

type Mock added in v1.3.0

type Mock interface {
	services.Service
	On(methodName string, arguments ...interface{}) *mock.Call
	String() string
}

Mock is implemented by mock generated services.Service, due to the embedded mock.Mock.

type Runnable

type Runnable interface {
	Start(context.Context) error
	Close() error
}

type TestingT

type TestingT interface {
	require.TestingT
	Helper()
	Cleanup(func())
}

Jump to

Keyboard shortcuts

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