Documentation
¶
Overview ¶
Package test provides mock implementations for testing.
Index ¶
- type MockMemoryProtector
- func (f *MockMemoryProtector) AcquireResource(_ context.Context, _ uint64) error
- func (f *MockMemoryProtector) AvailableBytes() int64
- func (f *MockMemoryProtector) FlagSet() *run.FlagSet
- func (f *MockMemoryProtector) GetLimit() uint64
- func (f *MockMemoryProtector) GracefulStop()
- func (f *MockMemoryProtector) Name() string
- func (f *MockMemoryProtector) PreRun(_ context.Context) error
- func (f *MockMemoryProtector) Serve() run.StopNotify
- func (f *MockMemoryProtector) ShouldCache(_ int64) bool
- func (f *MockMemoryProtector) State() protector.State
- func (f *MockMemoryProtector) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockMemoryProtector ¶
type MockMemoryProtector struct {
ExpectQuotaExceeded bool
// contains filtered or unexported fields
}
MockMemoryProtector is a mock implementation of a memory protector.
func (*MockMemoryProtector) AcquireResource ¶
func (f *MockMemoryProtector) AcquireResource(_ context.Context, _ uint64) error
AcquireResource simulates acquiring memory resources.
func (*MockMemoryProtector) AvailableBytes ¶
func (f *MockMemoryProtector) AvailableBytes() int64
AvailableBytes returns a mocked available memory size.
func (*MockMemoryProtector) FlagSet ¶
func (f *MockMemoryProtector) FlagSet() *run.FlagSet
FlagSet returns a new flag set for the mock memory protector.
func (*MockMemoryProtector) GetLimit ¶
func (f *MockMemoryProtector) GetLimit() uint64
GetLimit returns the mocked memory limit.
func (*MockMemoryProtector) GracefulStop ¶
func (f *MockMemoryProtector) GracefulStop()
GracefulStop simulates graceful shutdown.
func (*MockMemoryProtector) Name ¶
func (f *MockMemoryProtector) Name() string
Name returns the name of the mock memory protector.
func (*MockMemoryProtector) PreRun ¶
func (f *MockMemoryProtector) PreRun(_ context.Context) error
PreRun is a no-op setup for the mock.
func (*MockMemoryProtector) Serve ¶
func (f *MockMemoryProtector) Serve() run.StopNotify
Serve immediately returns a closed stop channel.
func (*MockMemoryProtector) ShouldCache ¶
func (f *MockMemoryProtector) ShouldCache(_ int64) bool
ShouldCache always returns false for testing.
func (*MockMemoryProtector) State ¶
func (f *MockMemoryProtector) State() protector.State
State returns the mocked memory state.
func (*MockMemoryProtector) Validate ¶
func (f *MockMemoryProtector) Validate() error
Validate validates the mock configuration.