Documentation
¶
Index ¶
- func ClearSharedMockDevices()
- type BlockDeviceInterface
- type Event
- type MockBlockDevice
- func (m *MockBlockDevice) Close() error
- func (m *MockBlockDevice) GetData() []byte
- func (m *MockBlockDevice) IsClosed() bool
- func (m *MockBlockDevice) Path() string
- func (m *MockBlockDevice) ReadAt(p []byte, off int64) (int, error)
- func (m *MockBlockDevice) SetFailRead(fail bool)
- func (m *MockBlockDevice) SetFailSync(fail bool)
- func (m *MockBlockDevice) SetFailWrite(fail bool)
- func (m *MockBlockDevice) Sync() error
- func (m *MockBlockDevice) WriteAt(p []byte, off int64) (int, error)
- func (m *MockBlockDevice) WriteFenceMessage(nodeID, targetNodeID uint16, sequence uint64, reason uint8) error
- func (m *MockBlockDevice) WritePeerHeartbeat(nodeID uint16, timestamp uint64, sequence uint64) error
- type MockEventRecorder
- func (m *MockEventRecorder) AnnotatedEventf(object runtime.Object, annotations map[string]string, ...)
- func (m *MockEventRecorder) Event(object runtime.Object, eventtype, reason, message string)
- func (m *MockEventRecorder) Eventf(object runtime.Object, eventtype, reason, messageFmt string, ...)
- func (m *MockEventRecorder) GetEvents() []Event
- func (m *MockEventRecorder) Reset()
- type MockWatchdog
- func (m *MockWatchdog) Close() error
- func (m *MockWatchdog) GetPetCount() int
- func (m *MockWatchdog) IsClosed() bool
- func (m *MockWatchdog) IsOpen() bool
- func (m *MockWatchdog) Path() string
- func (m *MockWatchdog) Pet() error
- func (m *MockWatchdog) SetFailClose(fail bool)
- func (m *MockWatchdog) SetFailPet(fail bool)
- type SharedMockDevices
- type WatchdogInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearSharedMockDevices ¶
func ClearSharedMockDevices()
ClearSharedMockDevices clears all shared devices (convenience function)
Types ¶
type BlockDeviceInterface ¶
type BlockDeviceInterface interface {
io.ReaderAt
io.WriterAt
Sync() error
Close() error
Path() string
IsClosed() bool
}
BlockDevice defines the interface for block device operations
func GetSharedMockDevice ¶
func GetSharedMockDevice(path string, size int) BlockDeviceInterface
GetSharedMockDevice returns a shared mock device for the given path
type MockBlockDevice ¶
type MockBlockDevice struct {
// contains filtered or unexported fields
}
MockBlockDevice is a mock implementation of BlockDevice for testing
func NewMockBlockDevice ¶
func NewMockBlockDevice(path string, size int) *MockBlockDevice
NewMockBlockDevice creates a new mock block device with the specified size
func (*MockBlockDevice) Close ¶
func (m *MockBlockDevice) Close() error
func (*MockBlockDevice) GetData ¶
func (m *MockBlockDevice) GetData() []byte
GetData returns a copy of the current data buffer
func (*MockBlockDevice) IsClosed ¶
func (m *MockBlockDevice) IsClosed() bool
func (*MockBlockDevice) Path ¶
func (m *MockBlockDevice) Path() string
func (*MockBlockDevice) SetFailRead ¶
func (m *MockBlockDevice) SetFailRead(fail bool)
SetFailRead configures the mock to fail read operations
func (*MockBlockDevice) SetFailSync ¶
func (m *MockBlockDevice) SetFailSync(fail bool)
SetFailSync configures the mock to fail sync operations
func (*MockBlockDevice) SetFailWrite ¶
func (m *MockBlockDevice) SetFailWrite(fail bool)
SetFailWrite configures the mock to fail write operations
func (*MockBlockDevice) Sync ¶
func (m *MockBlockDevice) Sync() error
func (*MockBlockDevice) WriteAt ¶
func (m *MockBlockDevice) WriteAt(p []byte, off int64) (int, error)
func (*MockBlockDevice) WriteFenceMessage ¶
func (m *MockBlockDevice) WriteFenceMessage(nodeID, targetNodeID uint16, sequence uint64, reason uint8) error
WriteFenceMessage writes a fence message to a specific slot for testing
func (*MockBlockDevice) WritePeerHeartbeat ¶
func (m *MockBlockDevice) WritePeerHeartbeat(nodeID uint16, timestamp uint64, sequence uint64) error
WritePeerHeartbeat writes a heartbeat message to a specific peer slot for testing
type MockEventRecorder ¶
type MockEventRecorder struct {
Events []Event
// contains filtered or unexported fields
}
MockEventRecorder is a mock implementation of record.EventRecorder for testing
func NewMockEventRecorder ¶
func NewMockEventRecorder() *MockEventRecorder
NewMockEventRecorder creates a new MockEventRecorder
func (*MockEventRecorder) AnnotatedEventf ¶
func (m *MockEventRecorder) AnnotatedEventf(object runtime.Object, annotations map[string]string, eventtype, reason, messageFmt string, args ...interface{})
AnnotatedEventf records an annotated formatted event for testing
func (*MockEventRecorder) Event ¶
func (m *MockEventRecorder) Event(object runtime.Object, eventtype, reason, message string)
Event records an event for testing
func (*MockEventRecorder) Eventf ¶
func (m *MockEventRecorder) Eventf(object runtime.Object, eventtype, reason, messageFmt string, args ...interface{})
Eventf records a formatted event for testing
func (*MockEventRecorder) GetEvents ¶
func (m *MockEventRecorder) GetEvents() []Event
GetEvents returns a copy of recorded events for testing
func (*MockEventRecorder) Reset ¶
func (m *MockEventRecorder) Reset()
Reset clears all recorded events
type MockWatchdog ¶
type MockWatchdog struct {
// contains filtered or unexported fields
}
MockWatchdog is a mock implementation of WatchdogInterface for testing
func NewMockWatchdog ¶
func NewMockWatchdog(path string) *MockWatchdog
NewMockWatchdog creates a new mock watchdog
func (*MockWatchdog) Close ¶
func (m *MockWatchdog) Close() error
func (*MockWatchdog) GetPetCount ¶
func (m *MockWatchdog) GetPetCount() int
GetPetCount returns the number of times Pet() was called
func (*MockWatchdog) IsClosed ¶
func (m *MockWatchdog) IsClosed() bool
IsClosed returns true if the watchdog is closed
func (*MockWatchdog) IsOpen ¶
func (m *MockWatchdog) IsOpen() bool
IsOpen returns true if the watchdog is open (opposite of IsClosed)
func (*MockWatchdog) Path ¶
func (m *MockWatchdog) Path() string
func (*MockWatchdog) Pet ¶
func (m *MockWatchdog) Pet() error
func (*MockWatchdog) SetFailClose ¶
func (m *MockWatchdog) SetFailClose(fail bool)
SetFailClose configures the mock to fail close operations
func (*MockWatchdog) SetFailPet ¶
func (m *MockWatchdog) SetFailPet(fail bool)
SetFailPet configures the mock to fail pet operations
type SharedMockDevices ¶
type SharedMockDevices struct {
// contains filtered or unexported fields
}
SharedMockDevices provides a thread-safe registry for shared mock devices This is useful for tests that need multiple processes/goroutines to share the same device data
func (*SharedMockDevices) Clear ¶
func (s *SharedMockDevices) Clear()
Clear removes all shared devices (for test cleanup)
func (*SharedMockDevices) Get ¶
func (s *SharedMockDevices) Get(path string, size int) BlockDeviceInterface
Get returns a shared mock device for the given path
type WatchdogInterface ¶
WatchdogInterface defines the interface for watchdog operations This is duplicated here to avoid import cycles with specific implementations