e2e

package
v0.0.0-...-0010da6 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

README

End to end tests

Adding end to end tests

Knative Eventing e2e tests test the end to end functionality of the Knative Eventing API to verify the behavior of this specific implementation.

Requirements

The e2e tests are used to test whether the flow of Knative Eventing is performing as designed from start to finish.

The e2e tests MUST:

  1. Provide frequent output describing what actions they are undertaking, especially before performing long running operations.
  2. Follow Golang best practices.

Documentation

Index

Constants

View Source
const (
	DefaultTestNamespace = "e2etest-knative-eventing"
)

Variables

This section is empty.

Functions

func CreateBroker

func CreateBroker(clients *test.Clients, broker *v1alpha1.Broker, logf logging.FormatLogger, cleaner *test.Cleaner) error

CreateBroker will create a Broker.

func CreateChannel

func CreateChannel(clients *test.Clients, channel *v1alpha1.Channel, _ logging.FormatLogger, cleaner *test.Cleaner) error

CreateChannel will create a Channel

func CreateClusterRoleBinding

func CreateClusterRoleBinding(clients *test.Clients, crb *rbacv1.ClusterRoleBinding, _ logging.FormatLogger, cleaner *test.Cleaner) error

CreateClusterRoleBinding will create a service account binding

func CreateNamespaceIfNeeded

func CreateNamespaceIfNeeded(t *testing.T, clients *test.Clients, logf logging.FormatLogger) (string, func())

CreateNamespaceIfNeeded creates a new namespace if it does not exist

func CreatePod

func CreatePod(clients *test.Clients, pod *corev1.Pod, _ logging.FormatLogger, cleaner *test.Cleaner) error

CreatePod will create a Pod

func CreatePodAndServiceReady

func CreatePodAndServiceReady(clients *test.Clients, pod *corev1.Pod, svc *corev1.Service, ns string, logf logging.FormatLogger, cleaner *test.Cleaner) (*corev1.Pod, error)

CreatePodAndServiceReady will create a Pod and Service, and wait for them to become ready

func CreateService

func CreateService(clients *test.Clients, svc *corev1.Service, _ logging.FormatLogger, cleaner *test.Cleaner) error

CreateService will create a Service

func CreateServiceAccount

func CreateServiceAccount(clients *test.Clients, sa *corev1.ServiceAccount, _ logging.FormatLogger, cleaner *test.Cleaner) error

CreateServiceAccount will create a service account

func CreateServiceAccountAndBinding

func CreateServiceAccountAndBinding(clients *test.Clients, name string, logf logging.FormatLogger, cleaner *test.Cleaner) error

CreateServiceAccountAndBinding creates both ServiceAccount and ClusterRoleBinding with default cluster-admin role

func CreateSubscription

func CreateSubscription(clients *test.Clients, sub *v1alpha1.Subscription, _ logging.FormatLogger, cleaner *test.Cleaner) error

CreateSubscription will create a Subscription

func CreateTrigger

func CreateTrigger(clients *test.Clients, trigger *v1alpha1.Trigger, logf logging.FormatLogger, cleaner *test.Cleaner) error

CreateTrigger will create a Trigger.

func FindAnyLogContents

func FindAnyLogContents(clients *test.Clients, logf logging.FormatLogger, podName string, containerName string, namespace string, contents []string) (bool, error)

FindAnyLogContents attempts to find logs for given Pod/Container that has 'any' of the given contents. It returns an error if it couldn't retrieve the logs. In case 'any' of the contents are there, it returns true.

func LabelNamespace

func LabelNamespace(clients *test.Clients, logf logging.FormatLogger, labels map[string]string) error

LabelNamespace labels the test namespace with the labels map.

func SendFakeEventToChannel

func SendFakeEventToChannel(clients *test.Clients, event *test.CloudEvent, channel *v1alpha1.Channel, ns string, logf logging.FormatLogger, cleaner *test.Cleaner) error

SendFakeEventToChannel will create fake CloudEvent and send it to the given channel.

func Setup

func Setup(t *testing.T, logf logging.FormatLogger) (*test.Clients, *test.Cleaner)

Setup creates the client objects needed in the e2e tests.

func TearDown

func TearDown(clients *test.Clients, cleaner *test.Cleaner, _ logging.FormatLogger)

TearDown will delete created names using clients.

func WaitForAllTriggersReady

func WaitForAllTriggersReady(clients *test.Clients, logf logging.FormatLogger, namespace string) error

WaitForAllTriggersReady will wait until all triggers in the given namespace are ready.

func WaitForBrokerReady

func WaitForBrokerReady(clients *test.Clients, broker *v1alpha1.Broker) error

WaitForBrokerReady waits until the broker is Ready.

func WaitForLogContentCount

func WaitForLogContentCount(client *test.Clients, podName, containerName, content string, appearTimes int) error

WaitForLogContentCount checks if the number of substr occur times equals the given number. If the content does not appear the given times it returns error.

func WaitForLogContents

func WaitForLogContents(clients *test.Clients, logf logging.FormatLogger, podName string, containerName string, namespace string, contents []string) error

WaitForLogContents waits until logs for given Pod/Container include the given contents. If the contents are not present within timeout it returns error.

func WithBrokerReady

func WithBrokerReady(clients *test.Clients, broker *v1alpha1.Broker, logf logging.FormatLogger, cleaner *test.Cleaner) error

WithBrokerReady creates a Broker and waits until it is Ready.

func WithChannelsAndSubscriptionsReady

func WithChannelsAndSubscriptionsReady(clients *test.Clients, chans *[]*v1alpha1.Channel, subs *[]*v1alpha1.Subscription, logf logging.FormatLogger, cleaner *test.Cleaner) error

WithChannelsAndSubscriptionsReady creates Channels and Subscriptions and waits until all are Ready. When they are ready, chans and subs are altered to get the real Channels and Subscriptions.

func WithTriggerReady

func WithTriggerReady(clients *test.Clients, trigger *v1alpha1.Trigger, logf logging.FormatLogger, cleaner *test.Cleaner) error

WithTriggerReady creates a Trigger and waits until it is Ready.

Types

This section is empty.

Jump to

Keyboard shortcuts

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