test

package
v3.31.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: Apache-2.0, Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Copyright 2021 Molecula Corp. All rights reserved.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfig

func DefaultConfig() *server.Config

DefaultConfig includes a single instance of each service type.

Types

type ManagedCommand

type ManagedCommand struct {
	*server.Command
	// contains filtered or unexported fields
}

ManagedCommand represents a test wrapper for server.Command.

func MustRunManagedCommand

func MustRunManagedCommand(tb testing.TB, opts ...server.CommandOption) *ManagedCommand

MustRunManagedCommand starts an in-process set of Services based on the provided configuration. If no configuration is provided, it will use the DefaultConfig which consists of one instance of each service type.

func NewManagedCommand

func NewManagedCommand(tb fbtest.DirCleaner, opts ...server.CommandOption) *ManagedCommand

NewManagedCommand returns a new instance of Command.

func (*ManagedCommand) Address

func (mc *ManagedCommand) Address() dax.Address

Address returns the advertise address at which the command can be reached.

func (*ManagedCommand) Close

func (mc *ManagedCommand) Close() error

Close closes the embedded command.

func (*ManagedCommand) Healthy

func (mc *ManagedCommand) Healthy(key dax.ServiceKey) bool

Healthy returns true if the provided service's /health endpoint returns 200 OK. This means that the service has been added to the ServiceManager and started, and that its http handler has been dynamically added.

func (*ManagedCommand) Manage

func (mc *ManagedCommand) Manage() *dax.ServiceManager

Manage returns the ServiceManager for the ManagedCommand.

func (*ManagedCommand) NewComputer

func (mc *ManagedCommand) NewComputer() dax.ServiceKey

NewComputer adds a new ComputerService to the ManagedCommands ServiceManager.

func (*ManagedCommand) NewController added in v3.30.0

func (mc *ManagedCommand) NewController(cfg controller.Config) dax.ServiceKey

NewController adds a new ControllerService to the ManagedCommands ServiceManager.

func (*ManagedCommand) NewQueryer

func (mc *ManagedCommand) NewQueryer(cfg queryer.Config) dax.ServiceKey

NewQueryer adds a new QueryerService to the ManagedCommands ServiceManager.

func (*ManagedCommand) Start

func (mc *ManagedCommand) Start() error

Start starts the embedded command.

func (*ManagedCommand) WaitForApplied

func (mc *ManagedCommand) WaitForApplied(t *testing.T, key dax.ServiceKey, n int, sleep time.Duration)

WaitForApplied is a test helper function which retries a computer's /directive endpoint a specified number of times, along with a sleep time in between tries, until the computer returns applied=true.

Jump to

Keyboard shortcuts

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