testing

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func AssertCSRCondition

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

AssertCSRCondition asserts the actual csr conditions has the expected condition

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 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 with the expected

func AssertManagedClusterStatus

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

AssertManagedClusterStatus asserts the actual managed cluster status is the same with the expected

func AssertSubjectAccessReviewObj

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

AssertSubjectAccessReviewObj asserts the given runtime object is the authorization SubjectAccessReview object

func AssertV1beta1CSRCondition

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

AssertV1beta1CSRCondition asserts the actual csr conditions has the expected condition

func NewAcceptedManagedCluster

func NewAcceptedManagedCluster() *clusterv1.ManagedCluster

func NewAcceptingManagedCluster

func NewAcceptingManagedCluster() *clusterv1.ManagedCluster

func NewAddOnLease

func NewAddOnLease(namespace, name string, renewTime time.Time) *coordv1.Lease

func NewApprovedCSR

func NewApprovedCSR(holder CSRHolder) *certv1.CertificateSigningRequest

func NewApprovedV1beta1CSR

func NewApprovedV1beta1CSR(holder CSRHolder) *certv1beta1.CertificateSigningRequest

func NewAvailableManagedCluster

func NewAvailableManagedCluster() *clusterv1.ManagedCluster

func NewCSR

func NewClusterRole added in v0.13.0

func NewClusterRole(name string, finalizers []string, labels map[string]string, terminated bool) *rbacv1.ClusterRole

func NewClusterRoleBinding added in v0.13.0

func NewClusterRoleBinding(name string, finalizers []string, labels map[string]string, terminated bool) *rbacv1.ClusterRoleBinding

func NewDeletingManagedCluster

func NewDeletingManagedCluster() *clusterv1.ManagedCluster

func NewDeniedCSR

func NewDeniedCSR(holder CSRHolder) *certv1.CertificateSigningRequest

func NewDeniedManagedCluster

func NewDeniedManagedCluster() *clusterv1.ManagedCluster

func NewDeniedV1beta1CSR

func NewDeniedV1beta1CSR(holder CSRHolder) *certv1beta1.CertificateSigningRequest

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(server, proxyURL string, caData, key, cert []byte) []byte

func NewManagedCluster

func NewManagedCluster() *clusterv1.ManagedCluster

func NewManagedClusterAddons added in v0.13.0

func NewManagedClusterAddons(name, namespace string, finalizers []string, deletionTimestamp *metav1.Time) *addonv1alpha1.ManagedClusterAddOn

func NewManagedClusterCondition

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

func NewManagedClusterLease

func NewManagedClusterLease(name string, renewTime time.Time) *coordv1.Lease

func NewManagedClusterWithStatus

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

func NewManifestWork

func NewManifestWork(namespace, name string, finalizers []string,
	labels, annotations map[string]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 NewRoleBinding

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

func NewUnAvailableManagedCluster

func NewUnAvailableManagedCluster() *clusterv1.ManagedCluster

func NewUnknownManagedCluster

func NewUnknownManagedCluster() *clusterv1.ManagedCluster

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 TestCert

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

func NewTestCert

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

func NewTestCertWithSubject

func NewTestCertWithSubject(subject pkix.Name, duration time.Duration) *TestCert

Jump to

Keyboard shortcuts

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