Documentation
¶
Overview ¶
Package mock provides a test mock implementation of the infrastructure provider interface.
Index ¶
- type Options
- type Provider
- func (p *Provider) AssignLeaderNetwork(ctx context.Context, providerInstanceID string, ln provider.LeaderNetwork) error
- func (p *Provider) CheckSubnetCapacity(ctx context.Context, subnetID string) (bool, error)
- func (p *Provider) CreateInstance(ctx context.Context, req provider.CreateInstanceRequest) (*provider.CreateInstanceResponse, error)
- func (p *Provider) DeleteInstance(ctx context.Context, instanceID, providerInstanceID string) error
- func (p *Provider) DeregisterFromLB(ctx context.Context, req provider.DeregisterLBRequest) error
- func (p *Provider) GetInstanceCount() int
- func (p *Provider) GetInstanceStatus(ctx context.Context, instanceID, providerInstanceID string) (*provider.InstanceStatus, error)
- func (p *Provider) Kind() string
- func (p *Provider) ListInstances(ctx context.Context, req provider.ListInstancesRequest) (*provider.ListInstancesResponse, error)
- func (p *Provider) ListLBInstances(ctx context.Context, req provider.ListLBInstancesRequest) ([]string, error)
- func (p *Provider) RegisterWithLB(ctx context.Context, req provider.RegisterLBRequest) error
- func (p *Provider) ReleaseLeaderNetwork(ctx context.Context, providerInstanceID string, ln provider.LeaderNetwork) error
- func (p *Provider) Reset()
- func (p *Provider) SetCreateDelay(delay time.Duration)
- func (p *Provider) SetCreateError(err error)
- func (p *Provider) SetDeleteError(err error)
- func (p *Provider) SetStatusError(err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
Config provider.ProviderConfig
Logger *slog.Logger
}
Options contains options for creating a mock provider
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements both the Provider and LoadBalancerProvider interfaces for testing
func (*Provider) AssignLeaderNetwork ¶
func (p *Provider) AssignLeaderNetwork(ctx context.Context, providerInstanceID string, ln provider.LeaderNetwork) error
AssignLeaderNetwork is a no-op for mock provider
func (*Provider) CheckSubnetCapacity ¶
CheckSubnetCapacity simulates checking subnet capacity (always returns true for mock)
func (*Provider) CreateInstance ¶
func (p *Provider) CreateInstance(ctx context.Context, req provider.CreateInstanceRequest) (*provider.CreateInstanceResponse, error)
CreateInstance simulates creating an instance
func (*Provider) DeleteInstance ¶
DeleteInstance simulates deleting an instance by provider instance ID
func (*Provider) DeregisterFromLB ¶
DeregisterFromLB removes an instance from a mock load balancer
func (*Provider) GetInstanceCount ¶
GetInstanceCount returns the number of instances (for testing)
func (*Provider) GetInstanceStatus ¶
func (p *Provider) GetInstanceStatus(ctx context.Context, instanceID, providerInstanceID string) (*provider.InstanceStatus, error)
GetInstanceStatus returns the status of a mock instance
func (*Provider) ListInstances ¶
func (p *Provider) ListInstances(ctx context.Context, req provider.ListInstancesRequest) (*provider.ListInstancesResponse, error)
ListInstances returns mock instances with pagination support
func (*Provider) ListLBInstances ¶
func (p *Provider) ListLBInstances(ctx context.Context, req provider.ListLBInstancesRequest) ([]string, error)
ListLBInstances lists all instances currently registered with a mock load balancer
func (*Provider) RegisterWithLB ¶
RegisterWithLB registers an instance with a mock load balancer
func (*Provider) ReleaseLeaderNetwork ¶
func (p *Provider) ReleaseLeaderNetwork(ctx context.Context, providerInstanceID string, ln provider.LeaderNetwork) error
ReleaseLeaderNetwork is a no-op for mock provider
func (*Provider) Reset ¶
func (p *Provider) Reset()
Reset clears all instances and resets testing controls
func (*Provider) SetCreateDelay ¶
SetCreateDelay sets a delay for instance creation (for testing)
func (*Provider) SetCreateError ¶
SetCreateError sets an error to return on instance creation (for testing)
func (*Provider) SetDeleteError ¶
SetDeleteError sets an error to return on instance deletion (for testing)
func (*Provider) SetStatusError ¶
SetStatusError sets an error to return on status queries (for testing)