Documentation ¶
Overview ¶
Package testing contains test helpers for reconcilers.
Index ¶
- func MakeFactory(ctor Ctor) rt.Factory
- func NewARN(service, resource string) apis.ARN
- func NewConfigMap(name string, data map[string]string) *corev1.ConfigMap
- func NewRoleBinding(sa *corev1.ServiceAccount) func() *rbacv1.RoleBinding
- func NewScheme() *runtime.Scheme
- func NewTestDeploymentReconciler(ctx context.Context, ls *Listers) common.GenericDeploymentReconciler
- func NewTestServiceReconciler(ctx context.Context, ls *Listers) common.GenericServiceReconciler
- func Populate(srcCpy v1alpha1.EventSource)
- func SetEnvVar(t *testing.T, name, val string) (unset func())
- func TestControllerConstructor(t *testing.T, ctor injection.ControllerConstructor)
- func TestControllerConstructorFailures(t *testing.T, ctor injection.ControllerConstructor)
- func TestReconcileAdapter(t *testing.T, ctor Ctor, src v1alpha1.EventSource, adapterBuilder interface{})
- func ToUnstructured(t *testing.T, objs []runtime.Object) (unstr []runtime.Object)
- type Ctor
- type Listers
- func (l *Listers) GetAWSCloudWatchLogsSourceLister() listersv1alpha1.AWSCloudWatchLogsSourceLister
- func (l *Listers) GetAWSCloudWatchSourceLister() listersv1alpha1.AWSCloudWatchSourceLister
- func (l *Listers) GetAWSCodeCommitSourceLister() listersv1alpha1.AWSCodeCommitSourceLister
- func (l *Listers) GetAWSCognitoIdentitySourceLister() listersv1alpha1.AWSCognitoIdentitySourceLister
- func (l *Listers) GetAWSCognitoUserPoolSourceLister() listersv1alpha1.AWSCognitoUserPoolSourceLister
- func (l *Listers) GetAWSDynamoDBSourceLister() listersv1alpha1.AWSDynamoDBSourceLister
- func (l *Listers) GetAWSKinesisSourceLister() listersv1alpha1.AWSKinesisSourceLister
- func (l *Listers) GetAWSSNSSourceLister() listersv1alpha1.AWSSNSSourceLister
- func (l *Listers) GetAWSSQSSourceLister() listersv1alpha1.AWSSQSSourceLister
- func (l *Listers) GetAzureActivityLogsSourceLister() listersv1alpha1.AzureActivityLogsSourceLister
- func (l *Listers) GetAzureBlobStorageSourceLister() listersv1alpha1.AzureBlobStorageSourceLister
- func (l *Listers) GetAzureEventGridSourceLister() listersv1alpha1.AzureEventGridSourceLister
- func (l *Listers) GetAzureEventHubSourceLister() listersv1alpha1.AzureEventHubSourceLister
- func (l *Listers) GetAzureIOTHubSourceLister() listersv1alpha1.AzureIOTHubSourceLister
- func (l *Listers) GetAzureServiceBusQueueSourceLister() listersv1alpha1.AzureServiceBusQueueSourceLister
- func (l *Listers) GetDeploymentLister() appslistersv1.DeploymentLister
- func (l *Listers) GetGoogleCloudAuditLogsSourceLister() listersv1alpha1.GoogleCloudAuditLogsSourceLister
- func (l *Listers) GetGoogleCloudBillingSourceLister() listersv1alpha1.GoogleCloudBillingSourceLister
- func (l *Listers) GetGoogleCloudPubSubSourceLister() listersv1alpha1.GoogleCloudPubSubSourceLister
- func (l *Listers) GetGoogleCloudRepositoriesSourceLister() listersv1alpha1.GoogleCloudRepositoriesSourceLister
- func (l *Listers) GetGoogleCloudStorageSourceLister() listersv1alpha1.GoogleCloudStorageSourceLister
- func (l *Listers) GetHTTPPollerSourceLister() listersv1alpha1.HTTPPollerSourceLister
- func (l *Listers) GetKubeObjects() []runtime.Object
- func (l *Listers) GetOCIMetricsSourceLister() listersv1alpha1.OCIMetricsSourceLister
- func (l *Listers) GetRoleBindingLister() rbaclistersv1.RoleBindingLister
- func (l *Listers) GetSalesforceSourceLister() listersv1alpha1.SalesforceSourceLister
- func (l *Listers) GetServiceAccountLister() corelistersv1.ServiceAccountLister
- func (l *Listers) GetServiceLister() servinglistersv1.ServiceLister
- func (l *Listers) GetServingObjects() []runtime.Object
- func (l *Listers) GetSlackSourceLister() listersv1alpha1.SlackSourceLister
- func (l *Listers) GetSourcesObjects() []runtime.Object
- func (l *Listers) GetTwilioSourceLister() listersv1alpha1.TwilioSourceLister
- func (l *Listers) GetWebhookSourceLister() listersv1alpha1.WebhookSourceLister
- func (l *Listers) GetZendeskSourceLister() listersv1alpha1.ZendeskSourceLister
- func (l *Listers) IndexerFor(obj runtime.Object) cache.Indexer
- type ServiceAccountCtorWithOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeFactory ¶
MakeFactory creates a testing factory for our controller.Reconciler, and initializes a Reconciler using the given Ctor as part of the process.
func NewConfigMap ¶
NewConfigMap returns a ConfigMap object.
func NewRoleBinding ¶
func NewRoleBinding(sa *corev1.ServiceAccount) func() *rbacv1.RoleBinding
NewRoleBinding returns a RoleBinding constructor for the given ServiceAccount.
func NewScheme ¶
NewScheme returns a new scheme populated with the types defined in clientSetSchemes.
func NewTestDeploymentReconciler ¶
func NewTestDeploymentReconciler(ctx context.Context, ls *Listers) common.GenericDeploymentReconciler
NewTestDeploymentReconciler returns a GenericServiceReconciler initialized with test clients.
func NewTestServiceReconciler ¶
func NewTestServiceReconciler(ctx context.Context, ls *Listers) common.GenericServiceReconciler
NewTestServiceReconciler returns a GenericServiceReconciler initialized with test clients.
func Populate ¶
func Populate(srcCpy v1alpha1.EventSource)
Populate populates an event source with generic attributes.
func SetEnvVar ¶
SetEnvVar sets the value of an env var and returns a function that can be deferred to unset that variable.
func TestControllerConstructor ¶
func TestControllerConstructor(t *testing.T, ctor injection.ControllerConstructor)
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 *testing.T, ctor Ctor, src v1alpha1.EventSource, adapterBuilder interface{})
TestReconcileAdapter tests the Reconcile() method of the controller.Reconciler implemented by source Reconcilers, with focus on the generic ReconcileSource logic executed by the generic adapter reconciler embedded in every source Reconciler.
The environment for each test case is set up as follows:
- MakeFactory initializes fake clients with the objects declared in the test case
- MakeFactory injects those clients into a context along with fake event recorders, etc.
- A Reconciler is constructed via a Ctor function using the values injected above
- The Reconciler returned by MakeFactory is used to run the test case
Types ¶
type Ctor ¶
type Ctor func(*testing.T, context.Context, *rt.TableRow, *Listers) controller.Reconciler
Ctor constructs a controller.Reconciler.
type Listers ¶
type Listers struct {
// contains filtered or unexported fields
}
Listers returns listers and objects filtered from those listers.
func NewListers ¶
NewListers returns a new instance of Listers initialized with the given objects.
func (*Listers) GetAWSCloudWatchLogsSourceLister ¶
func (l *Listers) GetAWSCloudWatchLogsSourceLister() listersv1alpha1.AWSCloudWatchLogsSourceLister
GetAWSCloudWatchLogsSourceLister returns a Lister for AWSCloudWatchSource objects.
func (*Listers) GetAWSCloudWatchSourceLister ¶
func (l *Listers) GetAWSCloudWatchSourceLister() listersv1alpha1.AWSCloudWatchSourceLister
GetAWSCloudWatchSourceLister returns a Lister for AWSCloudWatchSource objects.
func (*Listers) GetAWSCodeCommitSourceLister ¶
func (l *Listers) GetAWSCodeCommitSourceLister() listersv1alpha1.AWSCodeCommitSourceLister
GetAWSCodeCommitSourceLister returns a Lister for AWSCodeCommitSource objects.
func (*Listers) GetAWSCognitoIdentitySourceLister ¶
func (l *Listers) GetAWSCognitoIdentitySourceLister() listersv1alpha1.AWSCognitoIdentitySourceLister
GetAWSCognitoIdentitySourceLister returns a Lister for AWSCognitoUserPoolSource objects.
func (*Listers) GetAWSCognitoUserPoolSourceLister ¶
func (l *Listers) GetAWSCognitoUserPoolSourceLister() listersv1alpha1.AWSCognitoUserPoolSourceLister
GetAWSCognitoUserPoolSourceLister returns a Lister for AWSCognitoIdentitySource objects.
func (*Listers) GetAWSDynamoDBSourceLister ¶
func (l *Listers) GetAWSDynamoDBSourceLister() listersv1alpha1.AWSDynamoDBSourceLister
GetAWSDynamoDBSourceLister returns a Lister for AWSDynamoDBSource objects.
func (*Listers) GetAWSKinesisSourceLister ¶
func (l *Listers) GetAWSKinesisSourceLister() listersv1alpha1.AWSKinesisSourceLister
GetAWSKinesisSourceLister returns a Lister for AWSKinesisSource objects.
func (*Listers) GetAWSSNSSourceLister ¶
func (l *Listers) GetAWSSNSSourceLister() listersv1alpha1.AWSSNSSourceLister
GetAWSSNSSourceLister returns a Lister for AWSSNSSource objects.
func (*Listers) GetAWSSQSSourceLister ¶
func (l *Listers) GetAWSSQSSourceLister() listersv1alpha1.AWSSQSSourceLister
GetAWSSQSSourceLister returns a Lister for AWSSQSSource objects.
func (*Listers) GetAzureActivityLogsSourceLister ¶
func (l *Listers) GetAzureActivityLogsSourceLister() listersv1alpha1.AzureActivityLogsSourceLister
GetAzureActivityLogsSourceLister returns a Lister for AzureActivityLogsSource objects.
func (*Listers) GetAzureBlobStorageSourceLister ¶
func (l *Listers) GetAzureBlobStorageSourceLister() listersv1alpha1.AzureBlobStorageSourceLister
GetAzureBlobStorageSourceLister returns a Lister for AzureBlobStorageSource objects.
func (*Listers) GetAzureEventGridSourceLister ¶
func (l *Listers) GetAzureEventGridSourceLister() listersv1alpha1.AzureEventGridSourceLister
GetAzureEventGridSourceLister returns a Lister for AzureEventGridSource objects.
func (*Listers) GetAzureEventHubSourceLister ¶
func (l *Listers) GetAzureEventHubSourceLister() listersv1alpha1.AzureEventHubSourceLister
GetAzureEventHubSourceLister returns a Lister for AzureEventHubSource objects.
func (*Listers) GetAzureIOTHubSourceLister ¶
func (l *Listers) GetAzureIOTHubSourceLister() listersv1alpha1.AzureIOTHubSourceLister
GetAzureIOTHubSourceLister returns a Lister for AzureIOTHuSource objects.
func (*Listers) GetAzureServiceBusQueueSourceLister ¶
func (l *Listers) GetAzureServiceBusQueueSourceLister() listersv1alpha1.AzureServiceBusQueueSourceLister
GetAzureServiceBusQueueSourceLister returns a Lister for AzureServiceBusQueueSource objects.
func (*Listers) GetDeploymentLister ¶
func (l *Listers) GetDeploymentLister() appslistersv1.DeploymentLister
GetDeploymentLister returns a lister for Deployment objects.
func (*Listers) GetGoogleCloudAuditLogsSourceLister ¶
func (l *Listers) GetGoogleCloudAuditLogsSourceLister() listersv1alpha1.GoogleCloudAuditLogsSourceLister
GetGoogleCloudAuditLogsSourceLister returns a Lister for GoogleCloudAuditLogsSource objects.
func (*Listers) GetGoogleCloudBillingSourceLister ¶
func (l *Listers) GetGoogleCloudBillingSourceLister() listersv1alpha1.GoogleCloudBillingSourceLister
GetGoogleCloudBillingSourceLister returns a Lister for GoogleCloudBillingSource objects.
func (*Listers) GetGoogleCloudPubSubSourceLister ¶
func (l *Listers) GetGoogleCloudPubSubSourceLister() listersv1alpha1.GoogleCloudPubSubSourceLister
GetGoogleCloudPubSubSourceLister returns a Lister for GoogleCloudPubSubSource objects.
func (*Listers) GetGoogleCloudRepositoriesSourceLister ¶
func (l *Listers) GetGoogleCloudRepositoriesSourceLister() listersv1alpha1.GoogleCloudRepositoriesSourceLister
GetGoogleCloudRepositoriesSourceLister returns a Lister for GoogleCloudRepositoriesSource objects.
func (*Listers) GetGoogleCloudStorageSourceLister ¶
func (l *Listers) GetGoogleCloudStorageSourceLister() listersv1alpha1.GoogleCloudStorageSourceLister
GetGoogleCloudStorageSourceLister returns a Lister for GoogleCloudStorageSource objects.
func (*Listers) GetHTTPPollerSourceLister ¶
func (l *Listers) GetHTTPPollerSourceLister() listersv1alpha1.HTTPPollerSourceLister
GetHTTPPollerSourceLister returns a Lister for HTTPPollerSource objects.
func (*Listers) GetKubeObjects ¶
GetKubeObjects returns objects from Kubernetes APIs.
func (*Listers) GetOCIMetricsSourceLister ¶
func (l *Listers) GetOCIMetricsSourceLister() listersv1alpha1.OCIMetricsSourceLister
GetOCIMetricsSourceLister returns a Lister for OCIMetricsSource objects.
func (*Listers) GetRoleBindingLister ¶
func (l *Listers) GetRoleBindingLister() rbaclistersv1.RoleBindingLister
GetRoleBindingLister returns a lister for RoleBinding objects
func (*Listers) GetSalesforceSourceLister ¶
func (l *Listers) GetSalesforceSourceLister() listersv1alpha1.SalesforceSourceLister
GetSalesforceSourceLister returns a Lister for SalesforceSource 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 Knative Service objects.
func (*Listers) GetServingObjects ¶
GetServingObjects returns objects from the serving API.
func (*Listers) GetSlackSourceLister ¶
func (l *Listers) GetSlackSourceLister() listersv1alpha1.SlackSourceLister
GetSlackSourceLister returns a Lister for SlackSource objects.
func (*Listers) GetSourcesObjects ¶
GetSourcesObjects returns objects from the sources API.
func (*Listers) GetTwilioSourceLister ¶
func (l *Listers) GetTwilioSourceLister() listersv1alpha1.TwilioSourceLister
GetTwilioSourceLister returns a Lister for TwilioSource objects.
func (*Listers) GetWebhookSourceLister ¶
func (l *Listers) GetWebhookSourceLister() listersv1alpha1.WebhookSourceLister
GetWebhookSourceLister returns a Lister for WebhookSource objects.
func (*Listers) GetZendeskSourceLister ¶
func (l *Listers) GetZendeskSourceLister() listersv1alpha1.ZendeskSourceLister
GetZendeskSourceLister returns a Lister for ZendeskSource objects.
type ServiceAccountCtorWithOptions ¶
type ServiceAccountCtorWithOptions func(...serviceAccountOption) *corev1.ServiceAccount
ServiceAccountCtorWithOptions returns a ServiceAccount constructor which accepts options.
func NewServiceAccount ¶
func NewServiceAccount(src kmeta.OwnerRefable) ServiceAccountCtorWithOptions
NewServiceAccount returns a ServiceAccountCtorWithOptions for the given source.