mock

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-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 ContainerStateUpdater

type ContainerStateUpdater struct {
	ResourceManagerCallback

	sync.RWMutex
	// contains filtered or unexported fields
}

func NewContainerStateUpdater

func NewContainerStateUpdater() *ContainerStateUpdater

NewContainerStateUpdater returns a mock that can allows retrieval of the update that was sent.

func (*ContainerStateUpdater) GetContainerUpdateRequest

func (m *ContainerStateUpdater) GetContainerUpdateRequest() *si.UpdateContainerSchedulingStateRequest

func (*ContainerStateUpdater) UpdateContainerSchedulingState

func (m *ContainerStateUpdater) UpdateContainerSchedulingState(request *si.UpdateContainerSchedulingStateRequest)

type EventPlugin

type EventPlugin struct {
	ResourceManagerCallback

	sync.Mutex
	// contains filtered or unexported fields
}

func NewEventPlugin

func NewEventPlugin() *EventPlugin

NewEventPlugin creates a mocked event plugin

func (*EventPlugin) GetNextEventRecord

func (m *EventPlugin) GetNextEventRecord() *si.EventRecord

func (*EventPlugin) SendEvent

func (m *EventPlugin) SendEvent(events []*si.EventRecord)

type PredicatePlugin

type PredicatePlugin struct {
	ResourceManagerCallback
	// contains filtered or unexported fields
}

func NewPredicatePlugin

func NewPredicatePlugin(mustFail bool, nodes map[string]int) *PredicatePlugin

NewPredicatePlugin returns a mock that can either always fail or fail based on the node that is checked. mustFail will cause the predicate check to always fail nodes allows specifying which node to fail for which check using the nodeID: possible values: -1 fail reserve, 0 fail always, 1 fail alloc (defaults to always)

func (*PredicatePlugin) Predicates

func (f *PredicatePlugin) Predicates(args *si.PredicatesArgs) error

type Preemption

type Preemption struct {
	// contains filtered or unexported fields
}

func NewPreemption

func NewPreemption(success bool, allocKey, nodeID string, expectedPreemptions []string, start, index int32) Preemption

NewPreemption returns a preemption scenario success: overall success state allocKey: allocation key for this preemption scenario nodeID: node for this preemption scenario expectedPreemptions: the allocations that should be in the preemption list start: the point at which to start the checks index: the index into the expectedPreemptions to return on success

type PreemptionPredicatePlugin

type PreemptionPredicatePlugin struct {
	ResourceManagerCallback
	// contains filtered or unexported fields
}

func NewPreemptionPredicatePlugin

func NewPreemptionPredicatePlugin(reservations, allocs map[string]string, preempt []Preemption) *PreemptionPredicatePlugin

NewPreemptionPredicatePlugin returns a mock plugin that can handle multiple predicate scenarios. reservations: provide a list of allocations and node IDs for which the reservation predicate succeeds allocs: provide a list of allocations and node IDs for which the allocation predicate succeeds preempt: a slice of preemption scenarios configured for the plugin to check

func (*PreemptionPredicatePlugin) GetPredicateError

func (m *PreemptionPredicatePlugin) GetPredicateError() error

GetPredicateError returns the error set by the preemption predicate check that failed. Returns a nil error on success.

func (*PreemptionPredicatePlugin) Predicates

func (m *PreemptionPredicatePlugin) Predicates(args *si.PredicatesArgs) error

func (*PreemptionPredicatePlugin) PreemptionPredicates

type ResourceManagerCallback

type ResourceManagerCallback struct{}

func (*ResourceManagerCallback) GetStateDump

func (f *ResourceManagerCallback) GetStateDump() (string, error)

func (*ResourceManagerCallback) Predicates

func (f *ResourceManagerCallback) Predicates(_ *si.PredicatesArgs) error

func (*ResourceManagerCallback) PreemptionPredicates

func (*ResourceManagerCallback) SendEvent

func (f *ResourceManagerCallback) SendEvent(_ []*si.EventRecord)

func (*ResourceManagerCallback) UpdateAllocation

func (f *ResourceManagerCallback) UpdateAllocation(_ *si.AllocationResponse) error

func (*ResourceManagerCallback) UpdateApplication

func (f *ResourceManagerCallback) UpdateApplication(_ *si.ApplicationResponse) error

func (*ResourceManagerCallback) UpdateContainerSchedulingState

func (f *ResourceManagerCallback) UpdateContainerSchedulingState(_ *si.UpdateContainerSchedulingStateRequest)

func (*ResourceManagerCallback) UpdateNode

func (f *ResourceManagerCallback) UpdateNode(_ *si.NodeResponse) error

Jump to

Keyboard shortcuts

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