Documentation ¶
Overview ¶
Package mock provides all methods required to simulate a driver
Package mock provides all methods required to simulate a driver ¶
Package mock provides all methods required to simulate a driver ¶
Package mock provides all methods required to simulate a driver
Index ¶
- Constants
- func ManipulateMachine(machine *v1alpha1.Machine, data map[string]interface{}) *v1alpha1.Machine
- func ManipulateProviderSpec(providerSpec *apis.ProviderSpec, data map[string]interface{}) *apis.ProviderSpec
- func NewMachine(serverID int) *v1alpha1.Machine
- func NewMachineClass() *v1alpha1.MachineClass
- func NewMachineClassWithProviderSpec(providerSpec []byte) *v1alpha1.MachineClass
- func NewProviderSpec() *apis.ProviderSpec
- func SetupFloatingIPsEndpointOnMux(mux *http.ServeMux)
- func SetupImagesEndpointOnMux(mux *http.ServeMux)
- func SetupServersEndpointOnMux(mux *http.ServeMux, emptyOnFirstRequest bool)
- func SetupSshKeysEndpointOnMux(mux *http.ServeMux)
- func SetupTestPlacementGroupEndpointOnMux(mux *http.ServeMux)
- func SetupTestServerEndpointOnMux(mux *http.ServeMux)
- type MockTestEnv
Constants ¶
const ( TestNamespace = "test" TestServerID = 42 TestServerNameTemplate = "machine-%d" )
const ( TestCluster = "xyz" TestImageName = "ubuntu-20.04" TestProviderSpec = "" /* 202-byte string literal not displayed */ TestServerType = "cx11-ceph" TestSSHFingerprint = "00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff" TestZone = "hel1-dc2" TestInvalidProviderSpec = "{\"test\":\"invalid\"}" )
const (
TestPlacementGroupID = "42"
)
Variables ¶
This section is empty.
Functions ¶
func ManipulateMachine ¶
ManipulateMachine changes given machine data.
PARAMETERS machine *v1alpha1.Machine Machine data data map[string]interface{} Members to change
func ManipulateProviderSpec ¶
func ManipulateProviderSpec(providerSpec *apis.ProviderSpec, data map[string]interface{}) *apis.ProviderSpec
ManipulateProviderSpec changes given provider specification.
PARAMETERS providerSpec *apis.ProviderSpec Provider specification data map[string]interface{} Members to change
func NewMachine ¶
NewMachine generates new v1alpha1 machine data for testing purposes.
PARAMETERS serverID int Server ID to use for machine specification
func NewMachineClass ¶
func NewMachineClass() *v1alpha1.MachineClass
NewMachineClass generates new v1alpha1 machine class data for testing purposes.
func NewMachineClassWithProviderSpec ¶
func NewMachineClassWithProviderSpec(providerSpec []byte) *v1alpha1.MachineClass
NewMachineClassWithProviderSpec generates new v1alpha1 machine class data based on the given provider specification for testing purposes.
PARAMETERS providerSpec []byte ProviderSpec to use
func NewProviderSpec ¶
func NewProviderSpec() *apis.ProviderSpec
NewProviderSpec generates a new provider specification for testing purposes.
func SetupFloatingIPsEndpointOnMux ¶
SetupFloatingIPsEndpointOnMux configures a "/floating_ips" endpoint on the mux given.
PARAMETERS mux *http.ServeMux Mux to add handler to
func SetupImagesEndpointOnMux ¶
SetupImagesEndpointOnMux configures a "/images" endpoint on the mux given.
PARAMETERS mux *http.ServeMux Mux to add handler to
func SetupServersEndpointOnMux ¶
SetupServersEndpointOnMux configures a "/servers" endpoint on the mux given.
PARAMETERS mux *http.ServeMux Mux to add handler to
func SetupSshKeysEndpointOnMux ¶
SetupSshKeysEndpointOnMux configures a "/ssh_keys" endpoint on the mux given.
PARAMETERS mux *http.ServeMux Mux to add handler to
func SetupTestPlacementGroupEndpointOnMux ¶ added in v0.2.6
SetupTestPlacementGroupEndpointOnMux configures a "/placement_groups/42" endpoint on the mux given.
PARAMETERS mux *http.ServeMux Mux to add handler to
func SetupTestServerEndpointOnMux ¶ added in v0.2.4
SetupTestServerEndpointOnMux configures a "/servers/42" endpoint on the mux given.
PARAMETERS mux *http.ServeMux Mux to add handler to
Types ¶
type MockTestEnv ¶
MockTestEnv represents the test environment for testing HCloud API calls
func NewMockTestEnv ¶
func NewMockTestEnv() MockTestEnv
NewMockTestEnv generates a new, unconfigured test environment for testing purposes.
func (*MockTestEnv) Teardown ¶
func (env *MockTestEnv) Teardown()
Teardown shuts down the test environment server