testing

package
v1.24.2 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: Apache-2.0 Imports: 64 Imported by: 0

Documentation

Overview

Package testing contains test helpers for reconcilers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeFactory

func MakeFactory(ctor Ctor) rt.Factory

MakeFactory creates a testing factory for our controller.Reconciler, and initializes a Reconciler using the given Ctor as part of the process.

func NewARN

func NewARN(service, resource string) apis.ARN

NewARN returns a ARN with the given attributes.

func NewConfigMap

func NewConfigMap(name string, data map[string]string) *corev1.ConfigMap

NewConfigMap returns a ConfigMap object.

func NewConfigWatchRoleBinding added in v1.18.0

func NewConfigWatchRoleBinding(sa *corev1.ServiceAccount) func() *rbacv1.RoleBinding

NewConfigWatchRoleBinding returns a config watcher RoleBinding constructor for the given ServiceAccount.

func NewMTAdapterRoleBinding added in v1.18.0

func NewMTAdapterRoleBinding(sa *corev1.ServiceAccount) func() *rbacv1.RoleBinding

NewMTAdapterRoleBinding returns a (mt-)adapter RoleBinding constructor for the given ServiceAccount.

func NewScheme

func NewScheme() *runtime.Scheme

NewScheme returns a new scheme populated with the types defined in clientSetSchemes.

func NewTestDeploymentReconciler

func NewTestDeploymentReconciler[T kmeta.OwnerRefable, L common.Lister[T]](ctx context.Context,
	ls *Listers,
	ownersLister common.ListerGetter[T, L],
) common.GenericDeploymentReconciler[T, L]

NewTestDeploymentReconciler returns a GenericServiceReconciler initialized with test clients.

func NewTestServiceReconciler

func NewTestServiceReconciler[T kmeta.OwnerRefable, L common.Lister[T]](ctx context.Context,
	ls *Listers,
	ownersLister common.ListerGetter[T, L],
) common.GenericServiceReconciler[T, L]

NewTestServiceReconciler returns a GenericServiceReconciler initialized with test clients.

func NoToken

func NoToken(sa *corev1.ServiceAccount)

NoToken ensures the ServiceAccount's secrets list doesn't contain any reference to auto-generated tokens. Useful in tests that expect the creation of a ServiceAccount, when this list is supposed to always be empty.

func Populate

func Populate(rclCpy v1alpha1.Reconcilable)

Populate populates an component instance with generic attributes.

func TestControllerConstructor

func TestControllerConstructor(t *testing.T, ctor injection.ControllerConstructor, opts ...ctrlerCtorTestDecorator)

TestControllerConstructor tests that a controller constructor meets our requirements.

func TestControllerConstructorFailures

func TestControllerConstructorFailures(t *testing.T, ctor injection.ControllerConstructor)

TestControllerConstructorFailures tests that a controller constructor fails when various requirements are not met.

func TestReconcileAdapter

func TestReconcileAdapter[T kmeta.Accessor](t *testing.T,
	ctor Ctor, rcl v1alpha1.Reconcilable, ab common.AdapterBuilder[T])

TestReconcileAdapter tests the Reconcile() method of the controller.Reconciler implemented by component Reconcilers, with focus on the generic ReconcileAdapter logic executed by the generic adapter reconciler embedded in every component Reconciler.

The environment for each test case is set up as follows:

  1. MakeFactory initializes fake clients with the objects declared in the test case
  2. MakeFactory injects those clients into a context along with fake event recorders, etc.
  3. A Reconciler is constructed via a Ctor function using the values injected above
  4. The Reconciler returned by MakeFactory is used to run the test case

func ToUnstructured

func ToUnstructured(t *testing.T, objs []runtime.Object) (unstr []runtime.Object)

ToUnstructured takes a list of k8s resources and converts them to Unstructured objects. We must pass objects as Unstructured to the dynamic client fake, or it won't handle them properly.

Types

type Ctor

Ctor constructs a controller.Reconciler.

type ExpectExtraInformers

type ExpectExtraInformers int

type Listers

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

Listers returns listers and objects filtered from those listers.

func NewListers

func NewListers(scheme *runtime.Scheme, objs []runtime.Object) Listers

NewListers returns a new instance of Listers initialized with the given objects.

func (*Listers) GetAWSCloudWatchLogsSourceLister

func (l *Listers) GetAWSCloudWatchLogsSourceLister() sourceslistersv1alpha1.AWSCloudWatchLogsSourceLister

GetAWSCloudWatchLogsSourceLister returns a Lister for AWSCloudWatchLogsSource objects.

func (*Listers) GetAWSCloudWatchSourceLister

func (l *Listers) GetAWSCloudWatchSourceLister() sourceslistersv1alpha1.AWSCloudWatchSourceLister

GetAWSCloudWatchSourceLister returns a Lister for AWSCloudWatchSource objects.

func (*Listers) GetAWSCodeCommitSourceLister

func (l *Listers) GetAWSCodeCommitSourceLister() sourceslistersv1alpha1.AWSCodeCommitSourceLister

GetAWSCodeCommitSourceLister returns a Lister for AWSCodeCommitSource objects.

func (*Listers) GetAWSCognitoIdentitySourceLister

func (l *Listers) GetAWSCognitoIdentitySourceLister() sourceslistersv1alpha1.AWSCognitoIdentitySourceLister

GetAWSCognitoIdentitySourceLister returns a Lister for AWSCognitoUserPoolSource objects.

func (*Listers) GetAWSCognitoUserPoolSourceLister

func (l *Listers) GetAWSCognitoUserPoolSourceLister() sourceslistersv1alpha1.AWSCognitoUserPoolSourceLister

GetAWSCognitoUserPoolSourceLister returns a Lister for AWSCognitoIdentitySource objects.

func (*Listers) GetAWSComprehendTargetLister

func (l *Listers) GetAWSComprehendTargetLister() targetslistersv1alpha1.AWSComprehendTargetLister

GetAWSComprehendTargetLister returns a Lister for AWSComprehendTarget objects.

func (*Listers) GetAWSDynamoDBSourceLister

func (l *Listers) GetAWSDynamoDBSourceLister() sourceslistersv1alpha1.AWSDynamoDBSourceLister

GetAWSDynamoDBSourceLister returns a Lister for AWSDynamoDBSource objects.

func (*Listers) GetAWSDynamoDBTargetLister

func (l *Listers) GetAWSDynamoDBTargetLister() targetslistersv1alpha1.AWSDynamoDBTargetLister

GetAWSDynamoDBTargetLister returns a Lister for AWSDynamoDBTarget objects.

func (*Listers) GetAWSEventBridgeSourceLister added in v1.18.0

func (l *Listers) GetAWSEventBridgeSourceLister() sourceslistersv1alpha1.AWSEventBridgeSourceLister

GetAWSEventBridgeSourceLister returns a Lister for AWSEventBridgeSource objects.

func (*Listers) GetAWSEventBridgeTargetLister

func (l *Listers) GetAWSEventBridgeTargetLister() targetslistersv1alpha1.AWSEventBridgeTargetLister

GetAWSEventBridgeTargetLister returns a Lister for AWSEventBridgeTarget objects.

func (*Listers) GetAWSKinesisSourceLister

func (l *Listers) GetAWSKinesisSourceLister() sourceslistersv1alpha1.AWSKinesisSourceLister

GetAWSKinesisSourceLister returns a Lister for AWSKinesisSource objects.

func (*Listers) GetAWSKinesisTargetLister

func (l *Listers) GetAWSKinesisTargetLister() targetslistersv1alpha1.AWSKinesisTargetLister

GetAWSKinesisTargetLister returns a Lister for AWSKinesisTarget objects.

func (*Listers) GetAWSLambdaTargetLister

func (l *Listers) GetAWSLambdaTargetLister() targetslistersv1alpha1.AWSLambdaTargetLister

GetAWSLambdaTargetLister returns a Lister for AWSLambdaTarget objects.

func (*Listers) GetAWSS3TargetLister

func (l *Listers) GetAWSS3TargetLister() targetslistersv1alpha1.AWSS3TargetLister

GetAWSS3TargetLister returns a Lister for AWSS3Target objects.

func (*Listers) GetAWSSNSSourceLister

func (l *Listers) GetAWSSNSSourceLister() sourceslistersv1alpha1.AWSSNSSourceLister

GetAWSSNSSourceLister returns a Lister for AWSSNSSource objects.

func (*Listers) GetAWSSNSTargetLister

func (l *Listers) GetAWSSNSTargetLister() targetslistersv1alpha1.AWSSNSTargetLister

GetAWSSNSTargetLister returns a Lister for AWSSNSTarget objects.

func (*Listers) GetAWSSQSSourceLister

func (l *Listers) GetAWSSQSSourceLister() sourceslistersv1alpha1.AWSSQSSourceLister

GetAWSSQSSourceLister returns a Lister for AWSSQSSource objects.

func (*Listers) GetAWSSQSTargetLister

func (l *Listers) GetAWSSQSTargetLister() targetslistersv1alpha1.AWSSQSTargetLister

GetAWSSQSTargetLister returns a Lister for AWSSQSTarget objects.

func (*Listers) GetAzureActivityLogsSourceLister

func (l *Listers) GetAzureActivityLogsSourceLister() sourceslistersv1alpha1.AzureActivityLogsSourceLister

GetAzureActivityLogsSourceLister returns a Lister for AzureActivityLogsSource objects.

func (*Listers) GetAzureBlobStorageSourceLister

func (l *Listers) GetAzureBlobStorageSourceLister() sourceslistersv1alpha1.AzureBlobStorageSourceLister

GetAzureBlobStorageSourceLister returns a Lister for AzureBlobStorageSource objects.

func (*Listers) GetAzureEventGridSourceLister

func (l *Listers) GetAzureEventGridSourceLister() sourceslistersv1alpha1.AzureEventGridSourceLister

GetAzureEventGridSourceLister returns a Lister for AzureEventGridSource objects.

func (*Listers) GetAzureEventHubsSourceLister added in v1.22.0

func (l *Listers) GetAzureEventHubsSourceLister() sourceslistersv1alpha1.AzureEventHubsSourceLister

GetAzureEventHubsSourceLister returns a Lister for AzureEventHubsSource objects.

func (*Listers) GetAzureEventHubsTargetLister

func (l *Listers) GetAzureEventHubsTargetLister() targetslistersv1alpha1.AzureEventHubsTargetLister

GetAzureEventHubsTargetLister returns a Lister for AzureEventHubsTarget objects.

func (*Listers) GetAzureIOTHubSourceLister

func (l *Listers) GetAzureIOTHubSourceLister() sourceslistersv1alpha1.AzureIOTHubSourceLister

GetAzureIOTHubSourceLister returns a Lister for AzureIOTHuSource objects.

func (*Listers) GetAzureSentinelTargetLister added in v1.20.0

func (l *Listers) GetAzureSentinelTargetLister() targetslistersv1alpha1.AzureSentinelTargetLister

GetAzureSentinelTargetLister returns a Lister for AzureSentinelTarget objects.

func (*Listers) GetAzureServiceBusQueueSourceLister

func (l *Listers) GetAzureServiceBusQueueSourceLister() sourceslistersv1alpha1.AzureServiceBusQueueSourceLister

GetAzureServiceBusQueueSourceLister returns a Lister for AzureServiceBusQueueSource objects.

func (*Listers) GetAzureServiceBusTopicSourceLister

func (l *Listers) GetAzureServiceBusTopicSourceLister() sourceslistersv1alpha1.AzureServiceBusTopicSourceLister

GetAzureServiceBusTopicSourceLister returns a Lister for AzureServiceBusTopicSource objects.

func (*Listers) GetCloudEventsSourceLister added in v1.17.0

func (l *Listers) GetCloudEventsSourceLister() sourceslistersv1alpha1.CloudEventsSourceLister

GetCloudEventsSourceLister returns a Lister for CloudEventsSource objects.

func (*Listers) GetCloudEventsTargetLister added in v1.18.0

func (l *Listers) GetCloudEventsTargetLister() targetslistersv1alpha1.CloudEventsTargetLister

GetCloudEventsTargetLister returns a Lister for CloudEventsTarget objects.

func (*Listers) GetDatadogTargetLister

func (l *Listers) GetDatadogTargetLister() targetslistersv1alpha1.DatadogTargetLister

GetDatadogTargetLister returns a Lister for DatadogTarget objects.

func (*Listers) GetDeploymentLister

func (l *Listers) GetDeploymentLister() appslistersv1.DeploymentLister

GetDeploymentLister returns a lister for Deployment objects.

func (*Listers) GetElasticsearchTargetLister

func (l *Listers) GetElasticsearchTargetLister() targetslistersv1alpha1.ElasticsearchTargetLister

GetElasticsearchTargetLister returns a Lister for ElasticsearchTarget objects.

func (*Listers) GetFunctionLister

func (l *Listers) GetFunctionLister() extensionslistersv1alpha1.FunctionLister

GetFunctionLister returns a Lister for Function objects.

func (*Listers) GetGoogleCloudAuditLogsSourceLister

func (l *Listers) GetGoogleCloudAuditLogsSourceLister() sourceslistersv1alpha1.GoogleCloudAuditLogsSourceLister

GetGoogleCloudAuditLogsSourceLister returns a Lister for GoogleCloudAuditLogsSource objects.

func (*Listers) GetGoogleCloudBillingSourceLister

func (l *Listers) GetGoogleCloudBillingSourceLister() sourceslistersv1alpha1.GoogleCloudBillingSourceLister

GetGoogleCloudBillingSourceLister returns a Lister for GoogleCloudBillingSource objects.

func (*Listers) GetGoogleCloudFirestoreTargetLister

func (l *Listers) GetGoogleCloudFirestoreTargetLister() targetslistersv1alpha1.GoogleCloudFirestoreTargetLister

GetGoogleCloudFirestoreTargetLister returns a Lister for GoogleCloudFirestoreTarget objects.

func (*Listers) GetGoogleCloudPubSubSourceLister

func (l *Listers) GetGoogleCloudPubSubSourceLister() sourceslistersv1alpha1.GoogleCloudPubSubSourceLister

GetGoogleCloudPubSubSourceLister returns a Lister for GoogleCloudPubSubSource objects.

func (*Listers) GetGoogleCloudPubSubTargetLister added in v1.19.3

func (l *Listers) GetGoogleCloudPubSubTargetLister() targetslistersv1alpha1.GoogleCloudPubSubTargetLister

GetGoogleCloudPubSubTargetLister returns a Lister for GoogleCloudPubSubTarget objects.

func (*Listers) GetGoogleCloudSourceRepositoriesSourceLister

func (l *Listers) GetGoogleCloudSourceRepositoriesSourceLister() sourceslistersv1alpha1.GoogleCloudSourceRepositoriesSourceLister

GetGoogleCloudSourceRepositoriesSourceLister returns a Lister for GoogleCloudSourceRepositoriesSource objects.

func (*Listers) GetGoogleCloudStorageSourceLister

func (l *Listers) GetGoogleCloudStorageSourceLister() sourceslistersv1alpha1.GoogleCloudStorageSourceLister

GetGoogleCloudStorageSourceLister returns a Lister for GoogleCloudStorageSource objects.

func (*Listers) GetGoogleCloudStorageTargetLister

func (l *Listers) GetGoogleCloudStorageTargetLister() targetslistersv1alpha1.GoogleCloudStorageTargetLister

GetGoogleCloudStorageTargetLister returns a Lister for GoogleCloudStorageTarget objects.

func (*Listers) GetGoogleCloudWorkflowsTargetLister

func (l *Listers) GetGoogleCloudWorkflowsTargetLister() targetslistersv1alpha1.GoogleCloudWorkflowsTargetLister

GetGoogleCloudWorkflowsTargetLister returns a Lister for GoogleCloudWorkflowsTarget objects.

func (*Listers) GetGoogleSheetTargetLister

func (l *Listers) GetGoogleSheetTargetLister() targetslistersv1alpha1.GoogleSheetTargetLister

GetGoogleSheetTargetLister returns a Lister for GoogleSheetTarget objects.

func (*Listers) GetHTTPPollerSourceLister

func (l *Listers) GetHTTPPollerSourceLister() sourceslistersv1alpha1.HTTPPollerSourceLister

GetHTTPPollerSourceLister returns a Lister for HTTPPollerSource objects.

func (*Listers) GetHTTPTargetLister

func (l *Listers) GetHTTPTargetLister() targetslistersv1alpha1.HTTPTargetLister

GetHTTPTargetLister returns a Lister for HTTPTarget objects.

func (*Listers) GetIBMMQTargetLister

func (l *Listers) GetIBMMQTargetLister() targetslistersv1alpha1.IBMMQTargetLister

GetIBMMQTargetLister returns a Lister for IBMMQTarget objects.

func (*Listers) GetJQTransformationLister

func (l *Listers) GetJQTransformationLister() flowlistersv1alpha1.JQTransformationLister

GetJQTransformationLister returns a Lister for JQTransformation objects.

func (*Listers) GetJiraTargetLister

func (l *Listers) GetJiraTargetLister() targetslistersv1alpha1.JiraTargetLister

GetJiraTargetLister returns a Lister for JiraTarget objects.

func (*Listers) GetKafkaSourceLister added in v1.19.0

func (l *Listers) GetKafkaSourceLister() sourceslistersv1alpha1.KafkaSourceLister

GetKafkaSourceLister returns a Lister for KafkaSource objects.

func (*Listers) GetKafkaTargetLister added in v1.19.0

func (l *Listers) GetKafkaTargetLister() targetslistersv1alpha1.KafkaTargetLister

GetKafkaTargetLister returns a Lister for KafkaTarget objects.

func (*Listers) GetKubeObjects

func (l *Listers) GetKubeObjects() []runtime.Object

GetKubeObjects returns objects from Kubernetes APIs.

func (*Listers) GetLogzMetricsTargetLister

func (l *Listers) GetLogzMetricsTargetLister() targetslistersv1alpha1.LogzMetricsTargetLister

GetLogzMetricsTargetLister returns a Lister for LogzMetricsTarget objects.

func (*Listers) GetLogzTargetLister

func (l *Listers) GetLogzTargetLister() targetslistersv1alpha1.LogzTargetLister

GetLogzTargetLister returns a Lister for LogzTarget objects.

func (*Listers) GetMongoDBTargetLister added in v1.24.0

func (l *Listers) GetMongoDBTargetLister() targetslistersv1alpha1.MongoDBTargetLister

GetMongoDBTargetLister returns a Lister for MongoDBTarget objects.

func (*Listers) GetOCIMetricsSourceLister

func (l *Listers) GetOCIMetricsSourceLister() sourceslistersv1alpha1.OCIMetricsSourceLister

GetOCIMetricsSourceLister returns a Lister for OCIMetricsSource objects.

func (*Listers) GetOracleTargetLister

func (l *Listers) GetOracleTargetLister() targetslistersv1alpha1.OracleTargetLister

GetOracleTargetLister returns a Lister for OracleTarget objects.

func (*Listers) GetPodLister added in v1.18.0

func (l *Listers) GetPodLister() corelistersv1.PodLister

GetPodLister returns a lister for Pod objects.

func (*Listers) GetRoleBindingLister

func (l *Listers) GetRoleBindingLister() rbaclistersv1.RoleBindingLister

GetRoleBindingLister returns a lister for RoleBinding objects

func (*Listers) GetSalesforceSourceLister

func (l *Listers) GetSalesforceSourceLister() sourceslistersv1alpha1.SalesforceSourceLister

GetSalesforceSourceLister returns a Lister for SalesforceSource objects.

func (*Listers) GetSalesforceTargetLister

func (l *Listers) GetSalesforceTargetLister() targetslistersv1alpha1.SalesforceTargetLister

GetSalesforceTargetLister returns a Lister for SalesforceTarget objects.

func (*Listers) GetSendGridTargetLister

func (l *Listers) GetSendGridTargetLister() targetslistersv1alpha1.SendGridTargetLister

GetSendGridTargetLister returns a Lister for SendGridTarget objects.

func (*Listers) GetServiceAccountLister

func (l *Listers) GetServiceAccountLister() corelistersv1.ServiceAccountLister

GetServiceAccountLister returns a lister for ServiceAccount objects.

func (*Listers) GetServiceLister

func (l *Listers) GetServiceLister() servinglistersv1.ServiceLister

GetServiceLister returns a lister for Service objects.

func (*Listers) GetServingObjects

func (l *Listers) GetServingObjects() []runtime.Object

GetServingObjects returns objects from the serving API.

func (*Listers) GetSlackSourceLister

func (l *Listers) GetSlackSourceLister() sourceslistersv1alpha1.SlackSourceLister

GetSlackSourceLister returns a Lister for SlackSource objects.

func (*Listers) GetSlackTargetLister

func (l *Listers) GetSlackTargetLister() targetslistersv1alpha1.SlackTargetLister

GetSlackTargetLister returns a Lister for SlackTarget objects.

func (*Listers) GetSolaceSourceLister added in v1.24.0

func (l *Listers) GetSolaceSourceLister() sourceslistersv1alpha1.SolaceSourceLister

GetSolaceSourceLister returns a Lister for SolaceSource objects.

func (*Listers) GetSolaceTargetLister added in v1.24.0

func (l *Listers) GetSolaceTargetLister() targetslistersv1alpha1.SolaceTargetLister

GetSolaceTargetLister returns a Lister for SolaceTarget objects.

func (*Listers) GetSplunkTargetLister

func (l *Listers) GetSplunkTargetLister() targetslistersv1alpha1.SplunkTargetLister

GetSplunkTargetLister returns a Lister for SplunkTarget objects.

func (*Listers) GetSynchronizerLister

func (l *Listers) GetSynchronizerLister() flowlistersv1alpha1.SynchronizerLister

GetSynchronizerLister returns a Lister for Synchronizer objects.

func (*Listers) GetTransformationLister

func (l *Listers) GetTransformationLister() flowlistersv1alpha1.TransformationLister

GetTransformationLister returns a Lister for Transformation objects.

func (*Listers) GetTriggerMeshObjects

func (l *Listers) GetTriggerMeshObjects() []runtime.Object

GetTriggerMeshObjects returns objects from TriggerMesh APIs.

func (*Listers) GetTwilioSourceLister

func (l *Listers) GetTwilioSourceLister() sourceslistersv1alpha1.TwilioSourceLister

GetTwilioSourceLister returns a Lister for TwilioSource objects.

func (*Listers) GetTwilioTargetLister

func (l *Listers) GetTwilioTargetLister() targetslistersv1alpha1.TwilioTargetLister

GetTwilioTargetLister returns a Lister for TwilioTarget objects.

func (*Listers) GetWebhookSourceLister

func (l *Listers) GetWebhookSourceLister() sourceslistersv1alpha1.WebhookSourceLister

GetWebhookSourceLister returns a Lister for WebhookSource objects.

func (*Listers) GetXMLToJSONTransformationLister

func (l *Listers) GetXMLToJSONTransformationLister() flowlistersv1alpha1.XMLToJSONTransformationLister

GetXMLToJSONTransformationLister returns a Lister for XMLToJSONTransformation objects.

func (*Listers) GetXSLTTransformationLister

func (l *Listers) GetXSLTTransformationLister() flowlistersv1alpha1.XSLTTransformationLister

GetXSLTTransformationLister returns a Lister for XSLTTransformation objects.

func (*Listers) GetZendeskSourceLister

func (l *Listers) GetZendeskSourceLister() sourceslistersv1alpha1.ZendeskSourceLister

GetZendeskSourceLister returns a Lister for ZendeskSource objects.

func (*Listers) GetZendeskTargetLister

func (l *Listers) GetZendeskTargetLister() targetslistersv1alpha1.ZendeskTargetLister

GetZendeskTargetLister returns a Lister for ZendeskTarget objects.

func (*Listers) IndexerFor

func (l *Listers) IndexerFor(obj runtime.Object) cache.Indexer

IndexerFor returns the indexer for the given object.

type ServiceAccountCtorWithOptions

type ServiceAccountCtorWithOptions func(...resource.ServiceAccountOption) *corev1.ServiceAccount

ServiceAccountCtorWithOptions returns a ServiceAccount constructor which accepts options.

func NewServiceAccount

NewServiceAccount returns a ServiceAccountCtorWithOptions for the given component instance.

Jump to

Keyboard shortcuts

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