clusterstest

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: UPL-1.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const UnitTestClusterName = "cluster1"

UnitTestClusterName - cluster name used in unit tests

Variables

This section is empty.

Functions

func AssertMultiClusterResourceStatus

func AssertMultiClusterResourceStatus(assert *assert.Assertions,
	actualStatus v1alpha1.MultiClusterResourceStatus,
	expectedState v1alpha1.StateType,
	expectedConditionType v1alpha1.ConditionType,
	expectedConditionStatus v1.ConditionStatus)

AssertMultiClusterResourceStatus asserts that the status, conditions and cluster level status on the MultiClusterResourceStatus are as expected

func DoExpectGetMCRegistrationSecret

func DoExpectGetMCRegistrationSecret(cli *mocks.MockClient)

DoExpectGetMCRegistrationSecret adds an expectation to the given MockClient to expect a Get call for the managed cluster registration secret, and populate it with the cluster-name

func DoExpectUpdateState

func DoExpectUpdateState(t *testing.T, cli *mocks.MockClient, statusWriter *mocks.MockStatusWriter, mcAppConfig clusters.MultiClusterResource, expectedState v1alpha1.StateType)

DoExpectUpdateState checks that the status writer was retrieved and an update of the resource's state to the given value was called

func ExpectDeleteAssociatedResource added in v0.13.0

func ExpectDeleteAssociatedResource(cli *mocks.MockClient, resource runtime.Object, name types.NamespacedName)

ExpectDeleteAssociatedResource adds an expectation to the given MockClient to expect a Get call for the runtime resource and a subsequent request to delete it

func NewRequest

func NewRequest(namespace string, name string) ctrl.Request

NewRequest creates a new reconciler request for testing namespace - The namespace to use in the request name - The name to use in the request

func ReadContainerizedWorkload

func ReadContainerizedWorkload(rawWorkload runtime.RawExtension) (v1alpha2.ContainerizedWorkload, error)

ReadContainerizedWorkload reads the raw workload (typically from an OAM component) into a ContainerizedWorkload object

func ReadYaml2Json

func ReadYaml2Json(filename string) ([]byte, error)

ReadYaml2Json reads the testdata YAML file at the given path, converts it to JSON and returns a byte slice containing the JSON

Types

This section is empty.

Jump to

Keyboard shortcuts

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