package mock

import "github.com/hashicorp/nomad/client/serviceregistration/mock"

Index

Types

type Operation

type Operation struct {
	Op         string // add, remove, or update
	AllocID    string
	Name       string // task or group name
	OccurredAt time.Time
}

Operation represents the register/deregister operations.

type ServiceRegistrationHandler

type ServiceRegistrationHandler struct {

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

ServiceRegistrationHandler is the mock implementation of the serviceregistration.Handler interface and can be used for testing.

func NewServiceRegistrationHandler

func NewServiceRegistrationHandler(log hclog.Logger) *ServiceRegistrationHandler

NewServiceRegistrationHandler returns a ready to use ServiceRegistrationHandler for testing.

func (*ServiceRegistrationHandler) AllocRegistrations

func (*ServiceRegistrationHandler) GetOps

func (h *ServiceRegistrationHandler) GetOps() []Operation

GetOps returns all stored operations within the handler.

func (*ServiceRegistrationHandler) RegisterWorkload

func (*ServiceRegistrationHandler) RemoveWorkload

func (*ServiceRegistrationHandler) UpdateTTL

func (h *ServiceRegistrationHandler) UpdateTTL(checkID, namespace, output, status string) error

func (*ServiceRegistrationHandler) UpdateWorkload

func (h *ServiceRegistrationHandler) UpdateWorkload(old, newServices *serviceregistration.WorkloadServices) error

Source Files

mock.go

Version
v1.10.0 (latest)
Published
Apr 9, 2025
Platform
linux/amd64
Imports
5 packages
Last checked
14 minutes ago

Tools for package owners.