Help us shape the future of Go! Take the 2026 Go Developer Survey

consul

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2019 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsulServiceAPI added in v0.9.0

type ConsulServiceAPI interface {
	RegisterGroup(*structs.Allocation) error
	RemoveGroup(*structs.Allocation) error
	UpdateGroup(oldAlloc, newAlloc *structs.Allocation) error
	RegisterTask(*consul.TaskServices) error
	RemoveTask(*consul.TaskServices)
	UpdateTask(old, newTask *consul.TaskServices) error
	AllocRegistrations(allocID string) (*consul.AllocRegistration, error)
	UpdateTTL(id, output, status string) error
}

ConsulServiceAPI is the interface the Nomad Client uses to register and remove services and checks from Consul.

type MockConsulOp added in v0.9.0

type MockConsulOp struct {
	Op      string // add, remove, or update
	AllocID string
	Name    string // task or group name
}

MockConsulOp represents the register/deregister operations.

func NewMockConsulOp added in v0.9.0

func NewMockConsulOp(op, allocID, name string) MockConsulOp

type MockConsulServiceClient added in v0.9.0

type MockConsulServiceClient struct {

	// AllocRegistrationsFn allows injecting return values for the
	// AllocRegistrations function.
	AllocRegistrationsFn func(allocID string) (*consul.AllocRegistration, error)
	// contains filtered or unexported fields
}

MockConsulServiceClient implements the ConsulServiceAPI interface to record and log task registration/deregistration.

func NewMockConsulServiceClient added in v0.9.0

func NewMockConsulServiceClient(t testing.T, logger log.Logger) *MockConsulServiceClient

func (*MockConsulServiceClient) AllocRegistrations added in v0.9.0

func (m *MockConsulServiceClient) AllocRegistrations(allocID string) (*consul.AllocRegistration, error)

func (*MockConsulServiceClient) GetOps added in v0.9.0

func (m *MockConsulServiceClient) GetOps() []MockConsulOp

func (*MockConsulServiceClient) RegisterGroup added in v0.10.0

func (m *MockConsulServiceClient) RegisterGroup(alloc *structs.Allocation) error

func (*MockConsulServiceClient) RegisterTask added in v0.9.0

func (m *MockConsulServiceClient) RegisterTask(task *consul.TaskServices) error

func (*MockConsulServiceClient) RemoveGroup added in v0.10.0

func (m *MockConsulServiceClient) RemoveGroup(alloc *structs.Allocation) error

func (*MockConsulServiceClient) RemoveTask added in v0.9.0

func (m *MockConsulServiceClient) RemoveTask(task *consul.TaskServices)

func (*MockConsulServiceClient) UpdateGroup added in v0.10.0

func (m *MockConsulServiceClient) UpdateGroup(_, alloc *structs.Allocation) error

func (*MockConsulServiceClient) UpdateTTL added in v0.10.0

func (m *MockConsulServiceClient) UpdateTTL(checkID, output, status string) error

func (*MockConsulServiceClient) UpdateTask added in v0.9.0

func (m *MockConsulServiceClient) UpdateTask(old, newSvcs *consul.TaskServices) error

Jump to

Keyboard shortcuts

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