lib

package
v0.0.0-...-c52b3dd Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2020 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProwProjectKey = "E2E_PROJECT_ID"

	EventCountMetricType     = "custom.googleapis.com/cloud.google.com/source/event_count"
	GlobalMetricResourceType = "global"
	StorageResourceGroup     = "storages.events.cloud.google.com"
	PubsubResourceGroup      = "pubsubs.events.cloud.google.com"
)

Variables

View Source
var ChannelTypeMeta = messagingTypeMeta(resources.ChannelKind)
View Source
var CloudAuditLogsSourceTypeMeta = eventsTypeMeta(resources.CloudAuditLogsSourceKind)
View Source
var CloudPubSubSourceTypeMeta = eventsTypeMeta(resources.CloudPubSubSourceKind)
View Source
var CloudSchedulerSourceTypeMeta = eventsTypeMeta(resources.CloudSchedulerSourceKind)
View Source
var CloudStorageSourceTypeMeta = eventsTypeMeta(resources.CloudStorageSourceKind)
View Source
var JobTypeMeta = batchTypeMeta(resources.JobKind)
View Source
var KsvcTypeMeta = servingTypeMeta(resources.KServiceKind)
View Source
var PullSubscriptionTypeMeta = pubsubTypeMeta(resources.PullSubscriptionKind)
View Source
var ServiceGVK = metav1.GroupVersionKind{
	Version: "v1",
	Kind:    "Service"}

Functions

func AddRandomFile

func AddRandomFile(ctx context.Context, t *testing.T, bucketName, fileName, project string)

func AssertMetrics

func AssertMetrics(t *testing.T, client *Client, topicName, psName string)

func DeleteTopicOrDie

func DeleteTopicOrDie(t *testing.T, topicName string)

func DuplicatePubSubSecret

func DuplicatePubSubSecret(client *eventingtestlib.Client)

DuplicatePubSubSecret duplicates the PubSub secret to the test namespace.

func GetTopic

func GetTopic(t *testing.T, topicName string) *pubsub.Topic

func MakeAuditLogsJobOrDie

func MakeAuditLogsJobOrDie(client *Client, methodName, project, resourceName, serviceName, targetName string)

func MakeAuditLogsOrDie

func MakeAuditLogsOrDie(client *Client,
	auditlogsName, methodName, project, resourceName, serviceName, targetName string,
	so ...kngcptesting.CloudAuditLogsSourceOption,
)

func MakeBucket

func MakeBucket(ctx context.Context, t *testing.T, project string) string

MakeBucket retrieves the bucket name for the test. If it does not exist, it will create it.

func MakePubSubOrDie

func MakePubSubOrDie(client *Client,
	gvk metav1.GroupVersionKind,
	psName, targetName, topicName string,
	so ...kngcptesting.CloudPubSubSourceOption,
)

func MakeSchedulerJobOrDie

func MakeSchedulerJobOrDie(client *Client, data, targetName string)

func MakeSchedulerOrDie

func MakeSchedulerOrDie(client *Client,
	sName, data, targetName string,
	so ...kngcptesting.CloudSchedulerSourceOption,
)

func MakeStorageJobOrDie

func MakeStorageJobOrDie(client *Client, fileName, targetName string)

func MakeStorageOrDie

func MakeStorageOrDie(client *Client,
	bucketName, storageName, targetName string,
	so ...kngcptesting.CloudStorageSourceOption,
)

func MakeTopicOrDie

func MakeTopicOrDie(t *testing.T) (string, func())

func MakeTopicWithNameOrDie

func MakeTopicWithNameOrDie(t *testing.T, topicName string) (string, func())

func TearDown

func TearDown(client *Client)

TearDown runs the TearDown in the common eventing test framework.

func WithServiceForJob

func WithServiceForJob(name string) func(*batchv1.Job, *Client) error

WithServiceForJob returns an option that creates a Service binded with the given job.

Types

type Client

type Client struct {
	Core *lib.Client

	KnativeGCP *knativegcp.Clientset
	Namespace  string
	T          *testing.T
	Tracker    *lib.Tracker
}

Client holds instances of interfaces for making requests to Knative.

func Setup

func Setup(t *testing.T, runInParallel bool) *Client

Setup runs the Setup in the common eventing test framework.

func (*Client) CreateAuditLogsOrFail

func (c *Client) CreateAuditLogsOrFail(auditlogs *eventsv1alpha1.CloudAuditLogsSource)

func (*Client) CreateChannelOrFail

func (c *Client) CreateChannelOrFail(channel *messagingv1alpha1.Channel)

func (*Client) CreateJobOrFail

func (c *Client) CreateJobOrFail(job *batchv1.Job, options ...func(*batchv1.Job, *Client) error)

func (*Client) CreatePubSubOrFail

func (c *Client) CreatePubSubOrFail(pubsub *eventsv1alpha1.CloudPubSubSource)

func (*Client) CreatePullSubscriptionOrFail

func (c *Client) CreatePullSubscriptionOrFail(pullsubscription *pubsubv1alpha1.PullSubscription)

func (*Client) CreateSchedulerOrFail

func (c *Client) CreateSchedulerOrFail(scheduler *eventsv1alpha1.CloudSchedulerSource)

func (*Client) CreateStorageOrFail

func (c *Client) CreateStorageOrFail(storage *eventsv1alpha1.CloudStorageSource)

func (*Client) CreateUnstructuredObjOrFail

func (c *Client) CreateUnstructuredObjOrFail(spec *unstructured.Unstructured)

func (*Client) LogsFor

func (c *Client) LogsFor(namespace, name string, tm *metav1.TypeMeta) (string, error)

TODO(chizhg): move this function to knative/pkg/test or knative/eventing/test

func (*Client) SetupStackDriverMetrics

func (c *Client) SetupStackDriverMetrics(t *testing.T)

func (*Client) StackDriverEventCountMetricFor

func (c *Client) StackDriverEventCountMetricFor(namespace, projectID, filter string) (*int64, error)

TODO make this function more generic.

func (*Client) WaitUntilJobDone

func (c *Client) WaitUntilJobDone(namespace, name string) (string, error)

TODO(chizhg): move this function to knative/pkg/test or knative/eventing/test WaitForResourceReady waits until the specified resource in the given namespace are ready.

type TargetOutput

type TargetOutput struct {
	Success bool `json:"success"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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