testing

package
v2.24.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NetworkID       = "8bb661f5-76b9-45f1-9ef9-eeffcd025fe4"
	SubnetID        = "bec43a98-2d0a-4b1d-9df0-0f21e8f89d8a"
	SubnetPoolID    = "bed43a98-2d0a-4b1d-9df0-0f21e8f89d8a"
	RouterID        = "b8a25073-b35f-4b64-b205-6d21c8221d98"
	PortID          = "6f5c4730-aa3f-4677-bca2-3b1ead8545d9"
	InterfaceInfoID = "6f5c4730-aa3f-4677-bca2-3b1ead8545d9"
	SecGroupID      = "babf744f-0098-4f61-8e15-f91c30b3ed05"
	SecGroupRuleID  = "da8d0577-eeb8-4351-b543-4bb0687f81d3"
)

IDs used when a new resource is created. Note that using always the same ID is not correct, but is sufficient to cover the current usage. For more advanced usages a pseudo-random UID generator should be used instead.

View Source
const (
	SecurityGroupsEndpoint = "/security-groups"
	NetworksEndpoint       = "/networks"
	SubnetsEndpoint        = "/subnets"
	RoutersEndpoint        = "/routers"
	SubnetPoolsEndpoint    = "/subnetpools"
)

Relative paths to resource endpoints.

Variables

View Source
var ExternalNetwork = Network{
	Network:            networks.Network{Name: "external-network", ID: "d32019d3-bc6e-4319-9c1d-6722fc136a22"},
	NetworkExternalExt: external.NetworkExternalExt{External: true},
}
View Source
var InternalNetwork = Network{
	Network: networks.Network{Name: "kubernetes-cluster-xyz", ID: NetworkID},
}

Functions

func AddRouterInterfaceEndpoint

func AddRouterInterfaceEndpoint(routerID string) string

Types

type InterfaceInfo

type InterfaceInfo struct {
	routers.InterfaceInfo
	// contains filtered or unexported fields
}

func (*InterfaceInfo) CreateResponse

func (i *InterfaceInfo) CreateResponse() ([]byte, error)

func (*InterfaceInfo) FromCreateRequest

func (i *InterfaceInfo) FromCreateRequest(c []byte) (Resource, error)

func (InterfaceInfo) GetID

func (i InterfaceInfo) GetID() string

func (InterfaceInfo) GetName

func (i InterfaceInfo) GetName() string

func (InterfaceInfo) GetPath

func (i InterfaceInfo) GetPath() string

func (InterfaceInfo) GetType

func (i InterfaceInfo) GetType() string

func (*InterfaceInfo) SubResources

func (i *InterfaceInfo) SubResources() []ResourceBuilder

type Network

type Network struct {
	external.NetworkExternalExt
	networks.Network
}

func (*Network) CreateResponse

func (n *Network) CreateResponse() ([]byte, error)

func (*Network) FromCreateRequest

func (n *Network) FromCreateRequest(c []byte) (Resource, error)

func (Network) GetID

func (n Network) GetID() string

func (Network) GetName

func (n Network) GetName() string

func (Network) GetPath

func (n Network) GetPath() string

func (Network) GetType

func (n Network) GetType() string

func (*Network) SubResources

func (n *Network) SubResources() []ResourceBuilder

type Port

type Port ports.Port

func (*Port) CreateResponse

func (p *Port) CreateResponse() ([]byte, error)

func (*Port) FromCreateRequest

func (p *Port) FromCreateRequest(c []byte) (Resource, error)

func (Port) GetID

func (p Port) GetID() string

func (Port) GetName

func (p Port) GetName() string

func (Port) GetPath

func (p Port) GetPath() string

func (Port) GetType

func (p Port) GetType() string

func (*Port) SubResources

func (p *Port) SubResources() []ResourceBuilder

type Request

type Request struct {
	Method string
	Path   string
}

type Resource

type Resource interface {
	GetType() string
	GetPath() string
	GetID() string
	GetName() string
	FromCreateRequest([]byte) (Resource, error)
	CreateResponse() ([]byte, error)
	SubResources() []ResourceBuilder
}

type ResourceBuilder

type ResourceBuilder func() Resource

type Router

type Router routers.Router

func (*Router) CreateResponse

func (r *Router) CreateResponse() ([]byte, error)

func (*Router) FromCreateRequest

func (r *Router) FromCreateRequest(c []byte) (Resource, error)

func (Router) GetID

func (r Router) GetID() string

func (Router) GetName

func (r Router) GetName() string

func (Router) GetPath

func (r Router) GetPath() string

func (Router) GetType

func (r Router) GetType() string

func (*Router) SubResources

func (r *Router) SubResources() []ResourceBuilder

type SecGroup

type SecGroup groups.SecGroup

func (*SecGroup) CreateResponse

func (s *SecGroup) CreateResponse() ([]byte, error)

func (*SecGroup) FromCreateRequest

func (s *SecGroup) FromCreateRequest(c []byte) (Resource, error)

func (SecGroup) GetID

func (s SecGroup) GetID() string

func (SecGroup) GetName

func (s SecGroup) GetName() string

func (SecGroup) GetPath

func (s SecGroup) GetPath() string

func (SecGroup) GetType

func (s SecGroup) GetType() string

func (*SecGroup) SubResources

func (s *SecGroup) SubResources() []ResourceBuilder

type SecGroupRule

type SecGroupRule rules.SecGroupRule

func (*SecGroupRule) CreateResponse

func (s *SecGroupRule) CreateResponse() ([]byte, error)

func (*SecGroupRule) FromCreateRequest

func (s *SecGroupRule) FromCreateRequest(c []byte) (Resource, error)

func (SecGroupRule) GetID

func (s SecGroupRule) GetID() string

func (SecGroupRule) GetName

func (s SecGroupRule) GetName() string

func (SecGroupRule) GetPath

func (s SecGroupRule) GetPath() string

func (SecGroupRule) GetType

func (s SecGroupRule) GetType() string

func (*SecGroupRule) SubResources

func (s *SecGroupRule) SubResources() []ResourceBuilder

type Simulator

type Simulator struct {
	*testing.T
	sync.RWMutex
	// contains filtered or unexported fields
}

Simulator provides an OpenStack API server to be used for testing purposes.

func NewSimulator

func NewSimulator(t *testing.T) *Simulator

func (*Simulator) Add

func (s *Simulator) Add(res ...Resource) *Simulator

func (*Simulator) GetClient

func (s *Simulator) GetClient() *gophercloud.ServiceClient

func (*Simulator) GetRequestCounters

func (s *Simulator) GetRequestCounters() map[Request]int

func (*Simulator) Handle

func (s *Simulator) Handle(w http.ResponseWriter, r *http.Request)

func (*Simulator) Register

func (s *Simulator) Register(builder ResourceBuilder) *Simulator

func (*Simulator) TearDown

func (s *Simulator) TearDown()

type Subnet

type Subnet subnets.Subnet

func (*Subnet) CreateResponse

func (s *Subnet) CreateResponse() ([]byte, error)

func (*Subnet) FromCreateRequest

func (s *Subnet) FromCreateRequest(c []byte) (Resource, error)

func (Subnet) GetID

func (s Subnet) GetID() string

func (Subnet) GetName

func (s Subnet) GetName() string

func (Subnet) GetPath

func (s Subnet) GetPath() string

func (Subnet) GetType

func (s Subnet) GetType() string

func (*Subnet) SubResources

func (s *Subnet) SubResources() []ResourceBuilder

type SubnetPool added in v2.21.0

type SubnetPool subnetpools.SubnetPool

func (*SubnetPool) CreateResponse added in v2.21.0

func (s *SubnetPool) CreateResponse() ([]byte, error)

func (*SubnetPool) FromCreateRequest added in v2.21.0

func (s *SubnetPool) FromCreateRequest(c []byte) (Resource, error)

func (SubnetPool) GetID added in v2.21.0

func (s SubnetPool) GetID() string

func (SubnetPool) GetName added in v2.21.0

func (s SubnetPool) GetName() string

func (SubnetPool) GetPath added in v2.21.0

func (s SubnetPool) GetPath() string

func (SubnetPool) GetType added in v2.21.0

func (s SubnetPool) GetType() string

func (*SubnetPool) SubResources added in v2.21.0

func (s *SubnetPool) SubResources() []ResourceBuilder

Jump to

Keyboard shortcuts

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