Documentation
¶
Overview ¶
Package fakelinstor provides an in-memory HTTP test double for the LINSTOR REST API. It implements a subset of the API against which a client.Client can be pointed, so applications can exercise their LINSTOR interactions in tests without a running LINSTOR controller.
All state is kept in memory. The following client calls are supported:
- Controller: GetVersion (reports a static fake version)
- Nodes: Create, GetAll, Get, Delete, Evacuate, Restore, Lost
- Node storage pools: GetStoragePools, GetStoragePool, CreateStoragePool, ModifyStoragePool, DeleteStoragePool
- Node physical storage: CreateDevicePool
- ResourceGroups: Create, GetAll
- ResourceDefinitions: Create, GetAll (optionally with volume definitions), Delete, Truncate, CreateVolumeDefinition, GetVolumeDefinitions, ModifyVolumeDefinition
- Resources: Create, Get, GetAll, GetResourceView
Any endpoint not listed above responds with 501 Not Implemented rather than 404, so an unimplemented call is not mistaken for a genuine github.com/LINBIT/golinstor/client.NotFoundError.
FakeLinstor additionally exposes the test-only helpers StoragePools and DevicePoolCreations for assertions, and SetConnectionStatus to simulate node connectivity changes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeLinstor ¶
func New ¶
func New() *FakeLinstor
func (*FakeLinstor) DevicePoolCreations ¶
func (f *FakeLinstor) DevicePoolCreations() int
DevicePoolCreations returns how many times CreateDevicePool was called, for assertions in tests.
func (*FakeLinstor) SetConnectionStatus ¶
func (f *FakeLinstor) SetConnectionStatus(name string, status string)
func (*FakeLinstor) StoragePools ¶
func (f *FakeLinstor) StoragePools() []lapi.StoragePool
StoragePools returns a copy of the registered storage pools, for assertions in tests.