helpers

package
v0.32.1 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: Apache-2.0 Imports: 32 Imported by: 1

README

helpers

This package contains helper functions that are used in the actual tests. These functions can be referenced in other repositories (like inside the eventing-*** inside the knative-sandbox organization) for adding similar tests.

Documentation

Index

Constants

View Source
const (
	InjectionLabelKey          = "e2e.eventing.knative.dev/injection"
	InjectionEnabledLabelValue = "enabled"
)

Variables

This section is empty.

Functions

func BrokerChannelFlowWithTransformation added in v0.16.0

func BrokerChannelFlowWithTransformation(
	ctx context.Context,
	t *testing.T,
	brokerClass string,
	brokerVersion string,
	triggerVersion string,
	channelTestRunner testlib.ComponentsTestRunner,
	options ...testlib.SetupClientOption)

BrokerChannelFlowWithTransformation tests the following topology:

------------- ----------------------
|           | |                    |
v	       | v                    |

EventSource ---> Broker ---> Trigger1 -------> Service(Transformation)

|
|
|-------> Trigger2 -------> Service(Logger1)
|
|
|-------> Trigger3 -------> Channel --------> Subscription --------> Service(Logger2)

Explanation: Trigger1 filters the orignal event and transforms it to a new event, Trigger2 logs all events, Trigger3 filters the transformed event and sends it to Channel.

func BrokerRedelivery added in v0.17.0

func BrokerRedelivery(ctx context.Context, t *testing.T, creator BrokerCreatorWithRetries)

func ChannelChainTestHelper

func ChannelChainTestHelper(
	ctx context.Context,
	t *testing.T,
	subscriptionVersion SubscriptionVersion,
	channelTestRunner testlib.ComponentsTestRunner,
	options ...testlib.SetupClientOption)

ChannelChainTestHelper is the helper function for channel_chain_test Deprecated, use reconciler-test based tests.

func ChannelClusterDefaulterTestHelper

func ChannelClusterDefaulterTestHelper(
	ctx context.Context,
	t *testing.T,
	channelTestRunner testlib.ComponentsTestRunner,
	options ...testlib.SetupClientOption)

ChannelClusterDefaulterTestHelper is the helper function for channel_defaulter_test

func ChannelDeadLetterSinkDefaultTestHelper added in v0.20.0

func ChannelDeadLetterSinkDefaultTestHelper(
	ctx context.Context,
	t *testing.T,
	channelTestRunner testlib.ComponentsTestRunner,
	options ...testlib.SetupClientOption)

ChannelDeadLetterDefaultSinkTestHelper is the helper function for channel_deadlettersink_test, but setting the delivery from the channel spec Deprecated, use reconciler-test based tests.

func ChannelDeadLetterSinkTestHelper added in v0.11.0

func ChannelDeadLetterSinkTestHelper(
	ctx context.Context,
	t *testing.T,
	subscriptionVersion SubscriptionVersion,
	channelTestRunner testlib.ComponentsTestRunner,
	options ...testlib.SetupClientOption)

ChannelDeadLetterSinkTestHelper is the helper function for channel_deadlettersink_test Deprecated, use reconciler-test based tests.

func ChannelNamespaceDefaulterTestHelper

func ChannelNamespaceDefaulterTestHelper(
	ctx context.Context,
	t *testing.T,
	channelTestRunner testlib.ComponentsTestRunner,
	options ...testlib.SetupClientOption)

ChannelNamespaceDefaulterTestHelper is the helper function for channel_defaulter_test

func EventTransformationForSubscriptionTestHelper

func EventTransformationForSubscriptionTestHelper(
	ctx context.Context,
	t *testing.T,
	subscriptionVersion SubscriptionVersion,
	channelTestRunner testlib.ComponentsTestRunner,
	options ...testlib.SetupClientOption)

EventTransformationForSubscriptionTestHelper is the helper function for channel_event_transformation_test Deprecated, use reconciler-test based tests.

func EventTransformationForTriggerTestHelper

func EventTransformationForTriggerTestHelper(
	ctx context.Context,
	t *testing.T,
	brokerVersion string,
	triggerVersion string,
	creator BrokerCreator,
	options ...testlib.SetupClientOption)

EventTransformationForTriggerTestHelper tests the following scenario:

            5                 4
      ------------- ----------------------
      |           | |                    |
1     v	 2     | v        3           |

EventSource ---> Broker ---> Trigger1 -------> Service(Transformation)

|
| 6                   7
|-------> Trigger2 -------> Service(Logger)

Note: the number denotes the sequence of the event that flows in this test case.

func ParallelTestHelper added in v0.15.0

func ParallelTestHelper(
	ctx context.Context,
	t *testing.T,
	channelTestRunner testlib.ComponentsTestRunner,
	options ...testlib.SetupClientOption)

func ParallelV1TestHelper added in v0.16.0

func ParallelV1TestHelper(
	ctx context.Context,
	t *testing.T,
	channelTestRunner testlib.ComponentsTestRunner,
	options ...testlib.SetupClientOption)

func SequenceTestHelper added in v0.15.0

func SequenceTestHelper(
	ctx context.Context,
	t *testing.T,
	channelTestRunner testlib.ComponentsTestRunner,
	options ...testlib.SetupClientOption)

func SequenceV1TestHelper added in v0.16.0

func SequenceV1TestHelper(
	ctx context.Context,
	t *testing.T,
	channelTestRunner testlib.ComponentsTestRunner,
	options ...testlib.SetupClientOption)

func SingleEventForChannelTestHelper

func SingleEventForChannelTestHelper(
	ctx context.Context,
	t *testing.T, encoding cloudevents.Encoding,
	subscriptionVersion SubscriptionVersion,
	channelVersion string,
	channelTestRunner testlib.ComponentsTestRunner,
	options ...testlib.SetupClientOption)

SingleEventForChannelTestHelper is the helper function for channel_single_event_test channelVersion can be used to override which version you want to create the subscription against. For example, you could create a v1beta1 channel, but create a subscription to its v1alpha1 version by using channelVersion to override it. channelVersion == "" means that the version of the channel subscribed to is not modified. Deprecated, use reconciler-test based tests.

func TestBrokerWithManyTriggers added in v0.15.0

func TestBrokerWithManyTriggers(ctx context.Context, t *testing.T, brokerCreator BrokerCreator, shouldLabelNamespace bool)

If shouldLabelNamespace is set to true this test annotates the testing namespace so that a default broker is created. It then binds many triggers with different filtering patterns to the broker created by brokerCreator, and sends different events to the broker's address. Finally, it verifies that only the appropriate events are routed to the subscribers.

Types

type BrokerCreator added in v0.15.0

type BrokerCreator func(client *testlib.Client, version string) string

BrokerCreator creates a broker and returns its broker name. TestBrokerWithManyTriggers will wait for the broker to become ready.

func ChannelBasedBrokerCreator added in v0.15.0

func ChannelBasedBrokerCreator(channel metav1.TypeMeta, brokerClass string) BrokerCreator

ChannelBasedBrokerCreator creates a BrokerCreator that creates a broker based on the channel parameter.

type BrokerCreatorWithRetries added in v0.17.0

type BrokerCreatorWithRetries func(client *testlib.Client, numRetries int32) string

BrokerCreator creates a broker and returns its broker name.

type SubscriptionVersion added in v0.15.0

type SubscriptionVersion string
const (
	SubscriptionV1 SubscriptionVersion = "v1"
)

Jump to

Keyboard shortcuts

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