test

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package test adds helper utilities for testing run.Group enabled services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IRQService

type IRQService interface {
	run.Service
	io.Closer
}

IRQService is a run.Service and io.Closer implementation. It can be registered with run.Group and calling Close will initiate shutdown of the run.Group. This is primarily used for unit tests of run.Group enabled services and handlers.

func NewIRQService

func NewIRQService(cleanup func()) IRQService

NewIRQService returns a IRQService for usage in run.Group tests. Use the Close() method to shutdown a run.Group. The GracefulStop() method will be called automatically when run.Group is shutting down. Both Serve() and GracefulStop() should not be called outside of the internal run.Group logic as run.Service is to be managed by run.Group

type Svc added in v0.1.1

type Svc struct {
	SvcName   string
	Execute   func() error
	Interrupt func()
}

Svc allows one to quickly bootstrap a run.GroupService from simple functions. This is especially useful for unit tests.

func (Svc) GracefulStop added in v0.1.1

func (t Svc) GracefulStop()

GracefulStop implements run.Service

func (Svc) Name added in v0.1.1

func (t Svc) Name() string

Name implements run.Unit.

func (Svc) Serve added in v0.1.1

func (t Svc) Serve() error

Serve implements run.Service

Jump to

Keyboard shortcuts

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