mock

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: Apache-2.0, MIT Imports: 22 Imported by: 0

Documentation

Overview

Package mock provides all methods required to simulate a IONOS provider environment

Package mock provides all methods required to simulate a IONOS provider environment

Package mock provides all methods required to simulate a IONOS provider environment

Package mock provides all methods required to simulate a IONOS provider environment

Package mock provides all methods required to simulate a IONOS provider environment

Package mock provides all methods required to simulate a IONOS provider environment

Index

Constants

View Source
const (
	TestClusterCloudProfile = `` /* 519-byte string literal not displayed */

	TestClusterGenericTokenKubeconfigSecretName = "generic-token-kubeconfig-92e9ae14"
	TestClusterName                             = "xyz"
	TestClusterSeed                             = `{
		"apiVersion": "core.gardener.cloud/v1beta1",
		"kind": "Seed"
	}`
	TestClusterShoot = `` /* 437-byte string literal not displayed */

)
View Source
const (
	TestControlPlaneInfrastructureProviderStatus = `` /* 199-byte string literal not displayed */

	TestControlPlaneName           = "xyz"
	TestControlPlaneProviderConfig = `{
		"apiVersion": "ionos.provider.extensions.gardener.cloud/v1alpha1",
		"kind": "ControlPlaneConfig",
		"zone": "us-las"
	}`
	TestControlPlaneSecretName = "cloudprovider"
)
View Source
const (
	TestInfrastructureName           = "abc"
	TestInfrastructureProviderConfig = `` /* 348-byte string literal not displayed */

	TestInfrastructureSecretName         = "cloudprovider"
	TestInfrastructureServerID           = "6789abcd-ef01-4345-6789-abcdef012325"
	TestInfrastructureServerNameTemplate = "machine-%s"
	TestInfrastructureServerNicID        = "23456789-abcd-4f01-23e5-6789abcdef01"
	TestInfrastructureWorkersNetworkName = "test-namespace-workers"
)
View Source
const (
	TestDatacenterID     = "01234567-89ab-4def-0123-c56789abcdef"
	TestFloatingPoolName = "MY-FLOATING-POOL"
	TestImageID          = "01234567-89ab-4def-0123-c56789abcdef"
	TestImageName        = "ubuntu"
	TestImageVersion     = "1.0"
	TestNamespace        = "test-namespace"
	TestRegion           = "us"
	TestVolumeID         = "3456789a-bcde-4012-3f56-789abcdef012"
	TestSSHPublicKey     = "" /* 204-byte string literal not displayed */
	TestZone             = "us-las"
)
View Source
const (
	TestWorkerInfrastructureProviderStatus = `` /* 184-byte string literal not displayed */

	TestWorkerMachineCPUs       = 1
	TestWorkerMachineMemoryInMB = 1024
	TestWorkerMachineType       = "small"
	TestWorkerName              = "ionos"
	TestWorkerPoolName          = "ionos-pool-1"
	TestWorkerSecretName        = "secret"
	TestWorkerUserData          = "IyEvYmluL2Jhc2gKCmVjaG8gImhlbGxvIHdvcmxkIgo="
)

Variables

This section is empty.

Functions

func DecodeCluster

func DecodeCluster(cluster *v1alpha1.Cluster) (*extensions.Cluster, error)

DecodeCluster returns a decoded cluster structure.

PARAMETERS cluster *v1alpha1.Cluster Cluster specification

func ManipulateCluster

func ManipulateCluster(cluster *v1alpha1.Cluster, data map[string]interface{}) *v1alpha1.Cluster

ManipulateCluster changes given provider specification.

PARAMETERS cluster *v1alpha1.Cluster Cluster specification data map[string]interface{} Members to change

func ManipulateControlPlane

func ManipulateControlPlane(cp *v1alpha1.ControlPlane, data map[string]interface{}) *v1alpha1.ControlPlane

ManipulateControlPlane changes given provider specification.

PARAMETERS cp *v1alpha1.ControlPlane ControlPlane specification data map[string]interface{} Members to change

func ManipulateInfrastructure

func ManipulateInfrastructure(infrastructure *v1alpha1.Infrastructure, data map[string]interface{}) *v1alpha1.Infrastructure

ManipulateInfrastructure changes given provider specification.

PARAMETERS infrastructure *extensions.Infrastructure Infrastructure specification data map[string]interface{} Members to change

func ManipulateWorker

func ManipulateWorker(worker *v1alpha1.Worker, data map[string]interface{}) *v1alpha1.Worker

ManipulateWorker changes given provider specification.

PARAMETERS Worker *v1alpha1.Worker Worker specification data map[string]interface{} Members to change

func NewCluster

func NewCluster() *v1alpha1.Cluster

NewCluster generates a new provider specification for testing purposes.

func NewControlPlane

func NewControlPlane() *v1alpha1.ControlPlane

NewControlPlane generates a new provider specification for testing purposes.

func NewInfrastructure

func NewInfrastructure() *v1alpha1.Infrastructure

NewInfrastructure generates a new provider specification for testing purposes.

func NewInfrastructureConfigSpec

func NewInfrastructureConfigSpec() *apis.InfrastructureConfig

NewInfrastructureConfigSpec generates a new infrastructure config specification for testing purposes.

func NewWorker

func NewWorker() *v1alpha1.Worker

NewWorker generates a new provider specification for testing purposes.

func SetupDatacentersEndpointOnMux

func SetupDatacentersEndpointOnMux(mux *http.ServeMux)

SetupDatacentersEndpointOnMux configures a "/datacenters" endpoint on the mux given.

PARAMETERS mux *http.ServeMux Mux to add handler to

func SetupImagesEndpointOnMux

func SetupImagesEndpointOnMux(mux *http.ServeMux)

SetupImagesEndpointOnMux configures a "/images" endpoint on the mux given.

PARAMETERS mux *http.ServeMux Mux to add handler to

func SetupServersEndpointOnMux added in v0.0.2

func SetupServersEndpointOnMux(mux *http.ServeMux)

SetupServersEndpointOnMux configures a "/datacenters/<id>/servers" endpoint on the mux given.

PARAMETERS mux *http.ServeMux Mux to add handler to

func SetupTestDatacenterEndpointOnMux

func SetupTestDatacenterEndpointOnMux(mux *http.ServeMux)

SetupTestDatacenterEndpointOnMux configures "/datacenters/<dcid>/*" endpoints on the mux given.

PARAMETERS mux *http.ServeMux Mux to add handler to

func SetupTestImageEndpointOnMux added in v0.0.2

func SetupTestImageEndpointOnMux(mux *http.ServeMux)

SetupTestImageEndpointOnMux configures a "/images" endpoint on the mux given.

PARAMETERS mux *http.ServeMux Mux to add handler to

func SetupTestInfrastructureServerEndpointOnMux added in v0.0.2

func SetupTestInfrastructureServerEndpointOnMux(mux *http.ServeMux)

SetupTestInfrastructureServerEndpointOnMux configures "/datacenters/<dcid>/servers/<sid>/*" endpoints on the mux given.

PARAMETERS mux *http.ServeMux Mux to add handler to

Types

type MockTestEnv

type MockTestEnv struct {
	ChartApplier   *mockkubernetes.MockChartApplier
	Client         *mockclient.MockClient
	MockController *gomock.Controller
	StatusWriter   *mockclient.MockStatusWriter

	Server      *httptest.Server
	Mux         *http.ServeMux
	IonosClient *ionossdk.APIClient
}

MockTestEnv represents the test environment for testing ionos 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

Jump to

Keyboard shortcuts

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