mock

package
v0.6.31 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: Apache-2.0, MIT Imports: 19 Imported by: 0

Documentation

Overview

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

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

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

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

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

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

Index

Constants

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

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

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

	TestControlPlaneName           = "xyz"
	TestControlPlaneProviderConfig = `` /* 127-byte string literal not displayed */

	TestControlPlaneSecretName = "cloudprovider"
)
View Source
const (
	TestInfrastructureName           = "abc"
	TestInfrastructureProviderConfig = `` /* 193-byte string literal not displayed */

	TestInfrastructureSecretName         = "cloudprovider"
	TestInfrastructureWorkersNetworkCidr = "127.0.0.0/24"
)
View Source
const (
	TestFloatingPoolName = "MY-FLOATING-POOL"
	TestNamespace        = "test-namespace"
	TestRegion           = "hel1"
	TestSSHFingerprint   = "b0:aa:73:08:9e:4f:6b:d1:3f:12:eb:66:78:61:63:08"
	TestSSHPublicKey     = "" /* 204-byte string literal not displayed */
	TestZone             = "hel1-dc2"
)
View Source
const (
	TestWorkerInfrastructureProviderStatusTemplate = `` /* 173-byte string literal not displayed */

	TestWorkerMachineImageName      = "ubuntu"
	TestWorkerMachineImageVersion   = "20.04"
	TestWorkerMachineType           = "cx11"
	TestWorkerName                  = "hcloud"
	TestWorkerPoolName              = "hcloud-pool-1"
	TestWorkerSecretName            = "secret"
	TestWorkerCredentialsSecretName = "cloudprovider"
	TestWorkerUserData              = "IyEvYmluL2Jhc2gKCmVjaG8gImhlbGxvIHdvcmxkIgo="
)

Variables

This section is empty.

Functions

func DecodeCluster added in v0.1.3

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

DecodeCluster returns a decoded cluster structure.

PARAMETERS cluster *v1alpha1.Cluster Cluster specification

func ManipulateCluster added in v0.1.3

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 added in v0.3.4

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 added in v0.1.3

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 added in v0.3.2

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 added in v0.1.3

func NewCluster() *v1alpha1.Cluster

NewCluster generates a new provider specification for testing purposes.

func NewControlPlane added in v0.3.4

func NewControlPlane() *v1alpha1.ControlPlane

NewControlPlane generates a new provider specification for testing purposes.

func NewInfrastructure added in v0.1.3

func NewInfrastructure() *v1alpha1.Infrastructure

NewInfrastructure generates a new provider specification for testing purposes.

func NewInfrastructureConfigSpec added in v0.2.0

func NewInfrastructureConfigSpec() *apis.InfrastructureConfig

NewInfrastructureConfigSpec generates a new infrastructure config specification for testing purposes.

func NewWorker added in v0.3.2

func NewWorker() *v1alpha1.Worker

NewWorker generates a new provider specification for testing purposes.

func SetupImagesEndpointOnMux added in v0.3.2

func SetupImagesEndpointOnMux(mux *http.ServeMux)

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

PARAMETERS mux *http.ServeMux Mux to add handler to

func SetupLocationsEndpointOnMux added in v0.4.1

func SetupLocationsEndpointOnMux(mux *http.ServeMux)

SetupLocationsEndpointOnMux configures a "/locations" endpoint on the mux given.

PARAMETERS mux *http.ServeMux Mux to add handler to

func SetupNetworksEndpointOnMux added in v0.1.3

func SetupNetworksEndpointOnMux(mux *http.ServeMux)

SetupNetworksEndpointOnMux configures a "/networks" endpoint on the mux given.

PARAMETERS mux *http.ServeMux Mux to add handler to

func SetupPlacementGroupsEndpointOnMux added in v0.4.2

func SetupPlacementGroupsEndpointOnMux(mux *http.ServeMux)

SetupPlacementGroupsEndpointOnMux configures a "/placement_groups" endpoint on the mux given.

PARAMETERS mux *http.ServeMux Mux to add handler to

func SetupSshKeysEndpointOnMux added in v0.1.3

func SetupSshKeysEndpointOnMux(mux *http.ServeMux)

SetupSshKeysEndpointOnMux configures a "/ssh_keys" endpoint 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
	HcloudClient *hcloud.Client
}

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

Jump to

Keyboard shortcuts

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