testing

package
v0.0.0-...-c496dc8 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2021 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestLeaseDurationSeconds int32 = 1
	TestManagedClusterName         = "testmanagedcluster"
)

Variables

This section is empty.

Functions

func AssertActions

func AssertActions(t *testing.T, actualActions []clienttesting.Action, expectedVerbs ...string)

AssertActions asserts the actual actions have the expected action verb

func AssertCSRCondition

func AssertCSRCondition(
	t *testing.T,
	actualConditions []certv1beta1.CertificateSigningRequestCondition,
	expectedCondition certv1beta1.CertificateSigningRequestCondition)

AssertCSRCondition asserts the actual csr conditions has the expected condition

func AssertError

func AssertError(t *testing.T, actual error, expectedErr string)

AssertError asserts the actual error representation is the same with the expected, if the expected error representation is empty, the actual should be nil

func AssertErrorWithPrefix

func AssertErrorWithPrefix(t *testing.T, actual error, expectedErrorPrefix string)

AssertError asserts the actual error representation starts with the expected prerfix, if the expected error prefix is empty, the actual should be nil

func AssertFileContent

func AssertFileContent(t *testing.T, filePath string, expectedContent []byte)

AssertFileContent asserts a given file content

func AssertFileExist

func AssertFileExist(t *testing.T, filePath string)

AssertFileExist asserts a given file exists

func AssertFinalizers

func AssertFinalizers(t *testing.T, obj runtime.Object, finalizers []string)

AssertFinalizers asserts the given runtime object has the expected finalizers

func AssertLeaseUpdated

func AssertLeaseUpdated(t *testing.T, lease, lastLease *coordinationv1.Lease)

AssertLeaseUpdated asserts the lease obj is updated

func AssertManagedClusterClientConfigs

func AssertManagedClusterClientConfigs(t *testing.T, actual, expected []clusterv1.ClientConfig)

AssertManagedClusterClientConfigs asserts the actual managed cluster client configs are the same wiht the expected

func AssertManagedClusterCondition

func AssertManagedClusterCondition(
	t *testing.T,
	actualConditions []metav1.Condition,
	expectedCondition metav1.Condition)

AssertManagedClusterCondition asserts the actual managed cluster conditions has the expected condition

func AssertManagedClusterStatus

func AssertManagedClusterStatus(t *testing.T, actual, expected clusterv1.ManagedClusterStatus)

AssertManagedClusterStatus sserts the actual managed cluster status is the same wiht the expected

func AssertNoActions

func AssertNoActions(t *testing.T, actualActions []clienttesting.Action)

AssertNoActions asserts no actions are happened

func AssertNoMoreUpdates

func AssertNoMoreUpdates(t *testing.T, actions []clienttesting.Action)

AssertNoMoreUpdates asserts only one update action in given actions

func AssertSubjectAccessReviewObj

func AssertSubjectAccessReviewObj(t *testing.T, actual runtime.Object)

AssertSubjectAccessReviewObj asserts the given runtime object is the authorization SubjectAccessReview object

func AssertUpdateActions

func AssertUpdateActions(t *testing.T, actions []clienttesting.Action)

AssertUpdateActions asserts the actions are get-then-update action

func NewAcceptedManagedCluster

func NewAcceptedManagedCluster() *clusterv1.ManagedCluster

func NewAcceptingManagedCluster

func NewAcceptingManagedCluster() *clusterv1.ManagedCluster

func NewAvailableManagedCluster

func NewAvailableManagedCluster() *clusterv1.ManagedCluster

func NewDeletingManagedCluster

func NewDeletingManagedCluster() *clusterv1.ManagedCluster

func NewDeniedManagedCluster

func NewDeniedManagedCluster() *clusterv1.ManagedCluster

func NewHubKubeconfigSecret

func NewHubKubeconfigSecret(namespace, name, resourceVersion string, cert *TestCert, data map[string][]byte) *corev1.Secret

func NewJoinedManagedCluster

func NewJoinedManagedCluster() *clusterv1.ManagedCluster

func NewKubeconfig

func NewKubeconfig(key, cert []byte) []byte

func NewManagedCluster

func NewManagedCluster() *clusterv1.ManagedCluster

func NewManagedClusterCondition

func NewManagedClusterCondition(name, status, reason, message string, lastTransition *metav1.Time) metav1.Condition

func NewManagedClusterLease

func NewManagedClusterLease(renewTime time.Time) *coordv1.Lease

func NewManagedClusterWithStatus

func NewManagedClusterWithStatus(capacity, allocatable corev1.ResourceList) *clusterv1.ManagedCluster

func NewManifestWork

func NewManifestWork(namespace, name string, finalizers []string, deletionTimestamp *metav1.Time) *workapiv1.ManifestWork

func NewNamespace

func NewNamespace(name string, terminated bool) *corev1.Namespace

func NewNode

func NewNode(name string, capacity, allocatable corev1.ResourceList) *corev1.Node

func NewResourceList

func NewResourceList(cpu, mem int) corev1.ResourceList

func NewRole

func NewRole(namespace, name string, finalizers []string, terminated bool) *rbacv1.Role

func NewRoleBinding

func NewRoleBinding(namespace, name string, finalizers []string, terminated bool) *rbacv1.RoleBinding

func NewUnstructuredObj

func NewUnstructuredObj(apiVersion, kind, namespace, name string) *unstructured.Unstructured

func WriteFile

func WriteFile(filename string, data []byte)

Types

type CSRHolder

type CSRHolder struct {
	Name         string
	Labels       map[string]string
	SignerName   *string
	CN           string
	Orgs         []string
	Username     string
	ReqBlockType string
}

type FakeSyncContext

type FakeSyncContext struct {
	// contains filtered or unexported fields
}

func NewFakeSyncContext

func NewFakeSyncContext(t *testing.T, clusterName string) *FakeSyncContext

func (FakeSyncContext) Queue

func (FakeSyncContext) QueueKey

func (f FakeSyncContext) QueueKey() string

func (FakeSyncContext) Recorder

func (f FakeSyncContext) Recorder() events.Recorder

type TestCert

type TestCert struct {
	Cert []byte
	Key  []byte
}

func NewTestCert

func NewTestCert(commonName string, duration time.Duration) *TestCert

Jump to

Keyboard shortcuts

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