mock

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package mock provides a mock implementation of the resource.Provider interface for testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFloatingIP

func NewFloatingIP(name, location, networkZone string, ip netip.Addr) resource.FloatingIP

NewFloatingIP creates a new mock floating IP.

func NewFloatingIPv4

func NewFloatingIPv4(name, location, networkZone string) resource.FloatingIP

NewFloatingIPv4 creates a new mock floating IP with an unspecified IPv4 address.

func NewFloatingIPv6

func NewFloatingIPv6(name, location, networkZone string) resource.FloatingIP

NewFloatingIPv6 creates a new mock floating IP with an unspecified IPv6 address.

Types

type Provider

type Provider struct {
	FloatingIPs []resource.FloatingIP
	Servers     []resource.Server

	PollDelay             time.Duration
	AssignFloatingIPDelay time.Duration

	PollError             error
	AssignFloatingIPError error
}

Provider is a mock provider for testing.

func NewProvider

func NewProvider() *Provider

NewProvider creates a new mock provider.

func (*Provider) AssignFloatingIP

func (p *Provider) AssignFloatingIP(_ context.Context, fip resource.FloatingIP, server resource.Server) error

AssignFloatingIP assigns a floating IP to a server.

func (*Provider) Name

func (p *Provider) Name() resource.ProviderName

Name returns the name of the mock provider, "mock".

func (*Provider) Poll

func (p *Provider) Poll(_ context.Context) (resource.Group, error)

Poll returns the current state of the cloud resources.

Jump to

Keyboard shortcuts

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