testservices

package
v0.40.3 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package testservices contains services useful for testing. They are not intended to be exposed by end users and so this package should only be imported in tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fake

type Fake struct {
	DefinitionFunc func() service.Definition
	RunFunc        func(ctx context.Context, host service.Host) error
	UpdateFunc     func(newConfig any) error
	DataFunc       func() any
}

The Fake service allows injecting custom behavior for interface methods.

func (*Fake) Data

func (f *Fake) Data() any

Data implements service.Service. If f.DataFunc is non-nil, it will be used. Otherwise, a default implementation is used.

func (*Fake) Definition

func (f *Fake) Definition() service.Definition

Definition implements service.Service. If f.DefinitionFunc is non-nil, it will be used. Otherwise, a default implementation is used.

func (*Fake) Run

func (f *Fake) Run(ctx context.Context, host service.Host) error

Run implements service.Service. If f.RunFunc is non-nil, it will be used. Otherwise, a default implementation is used.

func (*Fake) Update

func (f *Fake) Update(newConfig any) error

Update implements service.Service. If f.UpdateFunc is non-nil, it will be used. Otherwise, a default implementation is used.

Jump to

Keyboard shortcuts

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