lib

package
v0.17.5 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2020 License: Apache-2.0 Imports: 64 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PubSubServiceName           = "pubsub.googleapis.com"
	PubSubCreateTopicMethodName = "google.pubsub.v1.Publisher.CreateTopic"
)
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"

	BrokerEventCountMetricType = "knative.dev/eventing/broker/event_count"
	BrokerMetricResourceType   = "knative_broker"

	TriggerEventCountMetricType       = "knative.dev/eventing/trigger/event_count"
	TriggerEventDispatchLatencyType   = "knative.dev/eventing/trigger/event_dispatch_latencies"
	TriggerEventProcessingLatencyType = "knative.dev/eventing/trigger/event_processing_latencies"
	TriggerMonitoredResourceType      = "knative_trigger"

	EventType          = "type"
	EventSource        = "source"
	EventSubject       = "subject"
	EventSubjectPrefix = "subject-prefix"
	EventID            = "id"
	EventData          = "data"

	E2ERespEventIDPrefix    = "e2e-testing-resp-event-id"
	E2EPubSubRespEventID    = E2ERespEventIDPrefix + "-pubsub"
	E2EBuildRespEventID     = E2ERespEventIDPrefix + "-build"
	E2EStorageRespEventID   = E2ERespEventIDPrefix + "-storage"
	E2EAuditLogsRespEventID = E2ERespEventIDPrefix + "-auditlogs"
	E2ESchedulerRespEventID = E2ERespEventIDPrefix + "-scheduler"
	E2EDummyRespEventID     = E2ERespEventIDPrefix + "-dummy"

	E2ERespEventTypePrefix  = "e2e-testing-resp-event-type"
	E2EPubSubRespEventType  = E2ERespEventTypePrefix + "-pubsub"
	E2EBuildRespEventType   = E2ERespEventTypePrefix + "-build"
	E2EStorageRespEventType = E2ERespEventTypePrefix + "-storage"
	E2EAuditLogsRespType    = E2ERespEventTypePrefix + "-auditlogs"
	E2ESchedulerRespType    = E2ERespEventTypePrefix + "-scheduler"
	E2EDummyRespEventType   = E2ERespEventTypePrefix + "-dummy"

	// Used in ../../test_images/sender, ../../test_images/receiver and ../../test_images/receiver
	// E2EDummyEventID is the id of the event sent by image `sender`
	E2EDummyEventID = "e2e-dummy-event-id"
	// E2EDummyEventType is the type of the event sent by image `sender`
	E2EDummyEventType = "e2e-dummy-event-type"
	// E2EDummyEventSource is the source of the event sent by image `sender`
	E2EDummyEventSource = "e2e-dummy-event-source"
	// E2EDummyRespEventSource is the source of the resp event sent by image `receiver`
	E2EDummyRespEventSource = "e2e-dummy-resp-event-source"
)

Variables

View Source
var BrokerGVK = metav1.GroupVersionKind{
	Group:   "eventing.knative.dev",
	Version: "v1beta1",
	Kind:    "Broker"}
View Source
var ChannelTypeMeta = messagingTypeMeta(resources.ChannelKind)
View Source
var CloudAuditLogsSourceV1TypeMeta = eventsV1TypeMeta(resources.CloudAuditLogsSourceKind)
View Source
var CloudAuditLogsSourceV1alpha1TypeMeta = eventsV1alpha1TypeMeta(resources.CloudAuditLogsSourceKind)
View Source
var CloudAuditLogsSourceV1beta1TypeMeta = eventsV1beta1TypeMeta(resources.CloudAuditLogsSourceKind)
View Source
var CloudBuildSourceV1alpha1TypeMeta = eventsV1alpha1TypeMeta(resources.CloudBuildSourceKind)
View Source
var CloudBuildSourceV1beta1TypeMeta = eventsV1beta1TypeMeta(resources.CloudBuildSourceKind)
View Source
var CloudPubSubSourceV1TypeMeta = eventsV1TypeMeta(resources.CloudPubSubSourceKind)
View Source
var CloudPubSubSourceV1alpha1TypeMeta = eventsV1alpha1TypeMeta(resources.CloudPubSubSourceKind)
View Source
var CloudPubSubSourceV1beta1TypeMeta = eventsV1beta1TypeMeta(resources.CloudPubSubSourceKind)
View Source
var CloudSchedulerSourceV1TypeMeta = eventsV1TypeMeta(resources.CloudSchedulerSourceKind)
View Source
var CloudSchedulerSourceV1alpha1TypeMeta = eventsV1alpha1TypeMeta(resources.CloudSchedulerSourceKind)
View Source
var CloudSchedulerSourceV1beta1TypeMeta = eventsV1beta1TypeMeta(resources.CloudSchedulerSourceKind)
View Source
var CloudStorageSourceV1TypeMeta = eventsV1TypeMeta(resources.CloudStorageSourceKind)
View Source
var CloudStorageSourceV1alpha1TypeMeta = eventsV1alpha1TypeMeta(resources.CloudStorageSourceKind)
View Source
var CloudStorageSourceV1beta1TypeMeta = eventsV1beta1TypeMeta(resources.CloudStorageSourceKind)
View Source
var JobTypeMeta = batchTypeMeta(resources.JobKind)
View Source
var KsvcTypeMeta = servingTypeMeta(resources.KServiceKind)
View Source
var PullSubscriptionV1TypeMeta = inteventsV1TypeMeta(resources.PullSubscriptionKind)
View Source
var PullSubscriptionV1alpha1TypeMeta = inteventsV1alpha1TypeMeta(resources.PullSubscriptionKind)
View Source
var PullSubscriptionV1beta1TypeMeta = inteventsV1beta1TypeMeta(resources.PullSubscriptionKind)
View Source
var ServiceGVK = metav1.GroupVersionKind{
	Version: "v1",
	Kind:    "Service"}

Functions

func AddRandomFile added in v0.13.0

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

func AssertMetrics added in v0.13.0

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

func BuildWithConfigFile added in v0.16.0

func BuildWithConfigFile(t *testing.T, imageName string) string

func CloudBuildImage added in v0.16.0

func CloudBuildImage(project, imageName string) string

func DeleteBucket added in v0.16.0

func DeleteBucket(ctx context.Context, t *testing.T, bucketName 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 GetCredential added in v0.14.0

func GetCredential(client *eventingtestlib.Client, workloadIdentity bool)

func GetTopic

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

func MakeAuditLogsJobOrDie added in v0.13.0

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

func MakeAuditLogsOrDie added in v0.13.0

func MakeAuditLogsOrDie(client *Client, config AuditLogsConfig)

func MakeAuditLogsV1alpha1OrDie added in v0.17.0

func MakeAuditLogsV1alpha1OrDie(client *Client, config AuditLogsConfig)

func MakeAuditLogsV1beta1OrDie added in v0.17.0

func MakeAuditLogsV1beta1OrDie(client *Client, config AuditLogsConfig)

func MakeBucket added in v0.13.0

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 MakeBuildOrDie added in v0.16.0

func MakeBuildOrDie(client *Client, config BuildConfig)

func MakeBuildTargetJobOrDie added in v0.16.0

func MakeBuildTargetJobOrDie(client *Client, images, targetName, eventType string)

func MakeBuildV1alpha1OrDie added in v0.17.0

func MakeBuildV1alpha1OrDie(client *Client, config BuildConfig)

func MakePubSubOrDie added in v0.13.0

func MakePubSubOrDie(client *Client, config PubSubConfig)

func MakePubSubTargetJobOrDie added in v0.15.0

func MakePubSubTargetJobOrDie(client *Client, source, targetName, eventType string)

func MakePubSubV1alpha1OrDie added in v0.17.0

func MakePubSubV1alpha1OrDie(client *Client, config PubSubConfig)

func MakePubSubV1beta1OrDie added in v0.17.0

func MakePubSubV1beta1OrDie(client *Client, config PubSubConfig)

func MakePullSubscriptionOrDie added in v0.17.0

func MakePullSubscriptionOrDie(client *Client, config PullSubscriptionConfig)

func MakePullSubscriptionV1alpha1OrDie added in v0.17.0

func MakePullSubscriptionV1alpha1OrDie(client *Client, config PullSubscriptionConfig)

func MakePullSubscriptionV1beta1OrDie added in v0.17.0

func MakePullSubscriptionV1beta1OrDie(client *Client, config PullSubscriptionConfig)

func MakeSchedulerJobOrDie added in v0.13.0

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

func MakeSchedulerOrDie added in v0.13.0

func MakeSchedulerOrDie(client *Client, config SchedulerConfig)

func MakeSchedulerV1alpha1OrDie added in v0.17.0

func MakeSchedulerV1alpha1OrDie(client *Client, config SchedulerConfig)

func MakeSchedulerV1beta1OrDie added in v0.17.0

func MakeSchedulerV1beta1OrDie(client *Client, config SchedulerConfig)

func MakeStorageJobOrDie added in v0.13.0

func MakeStorageJobOrDie(client *Client, source, subject, targetName, eventType string)

func MakeStorageOrDie added in v0.13.0

func MakeStorageOrDie(client *Client, config StorageConfig)

func MakeStorageV1alpha1OrDie added in v0.17.0

func MakeStorageV1alpha1OrDie(client *Client, config StorageConfig)

func MakeStorageV1beta1OrDie added in v0.17.0

func MakeStorageV1beta1OrDie(client *Client, config StorageConfig)

func MakeTopicOrDie

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

func MakeTopicWithNameIfItDoesNotExist added in v0.16.0

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

func MakeTopicWithNameOrDie

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

func NotificationExists added in v0.16.0

func NotificationExists(t *testing.T, bucketName, notificationID string) bool

func SchedulerJobExists added in v0.16.0

func SchedulerJobExists(t *testing.T, jobName string) bool

func SetTracingToZipkin added in v0.14.0

func SetTracingToZipkin(client *eventingtestlib.Client)

func StackdriverSinkExists added in v0.16.0

func StackdriverSinkExists(t *testing.T, sinkID string) bool

func SubscriptionExists added in v0.16.0

func SubscriptionExists(t *testing.T, subID string) bool

func TearDown

func TearDown(client *Client)

TearDown runs the TearDown in the common eventing test framework.

func TopicExists added in v0.16.0

func TopicExists(t *testing.T, topicID string) bool

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 AuditLogsConfig added in v0.16.0

type AuditLogsConfig struct {
	SinkGVK            metav1.GroupVersionKind
	SinkName           string
	AuditlogsName      string
	MethodName         string
	Project            string
	ResourceName       string
	ServiceName        string
	ServiceAccountName string
}

type AuthConfig added in v0.14.0

type AuthConfig struct {
	WorkloadIdentity   bool
	ServiceAccountName string
}

type BrokerMetricAssertion added in v0.16.0

type BrokerMetricAssertion struct {
	ProjectID       string
	BrokerName      string
	BrokerNamespace string
	StartTime       time.Time
	CountPerType    map[string]int64
}

func (BrokerMetricAssertion) Assert added in v0.16.0

func (BrokerMetricAssertion) StackdriverFilter added in v0.16.0

func (a BrokerMetricAssertion) StackdriverFilter() string

type BuildConfig added in v0.16.0

type BuildConfig struct {
	SinkGVK            metav1.GroupVersionKind
	BuildName          string
	SinkName           string
	ServiceAccountName string
}

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, workloadIdentity bool) *Client

Setup runs the Setup in the common eventing test framework.

func (*Client) CreateAuditLogsOrFail

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

func (*Client) CreateAuditLogsV1alpha1OrFail added in v0.17.0

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

func (*Client) CreateAuditLogsV1beta1OrFail added in v0.17.0

func (c *Client) CreateAuditLogsV1beta1OrFail(auditlogs *eventsv1beta1.CloudAuditLogsSource)

func (*Client) CreateBuildOrFail added in v0.16.0

func (c *Client) CreateBuildOrFail(build *eventsv1beta1.CloudBuildSource)

func (*Client) CreateBuildV1alpha1OrFail added in v0.17.0

func (c *Client) CreateBuildV1alpha1OrFail(build *eventsv1alpha1.CloudBuildSource)

func (*Client) CreateChannelOrFail

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

func (*Client) CreateGCPBrokerV1Beta1OrFail added in v0.16.0

func (c *Client) CreateGCPBrokerV1Beta1OrFail(name string, options ...knativegcptestresources.BrokerV1Beta1Option) *v1beta1.Broker

CreateGCPBrokerV1Beta1OrFail will create a GCP Broker or fail the test if there is an error.

func (*Client) CreateJobOrFail

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

func (*Client) CreatePubSubOrFail

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

func (*Client) CreatePubSubV1alpha1OrFail added in v0.17.0

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

func (*Client) CreatePubSubV1beta1OrFail added in v0.17.0

func (c *Client) CreatePubSubV1beta1OrFail(pubsub *eventsv1beta1.CloudPubSubSource)

func (*Client) CreatePullSubscriptionOrFail

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

func (*Client) CreatePullSubscriptionV1alpha1OrFail added in v0.17.0

func (c *Client) CreatePullSubscriptionV1alpha1OrFail(pullsubscription *inteventsv1alpha1.PullSubscription)

func (*Client) CreatePullSubscriptionV1beta1OrFail added in v0.17.0

func (c *Client) CreatePullSubscriptionV1beta1OrFail(pullsubscription *inteventsv1beta1.PullSubscription)

func (*Client) CreateSchedulerOrFail

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

func (*Client) CreateSchedulerV1alpha1OrFail added in v0.17.0

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

func (*Client) CreateSchedulerV1beta1OrFail added in v0.17.0

func (c *Client) CreateSchedulerV1beta1OrFail(scheduler *eventsv1beta1.CloudSchedulerSource)

func (*Client) CreateStorageOrFail

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

func (*Client) CreateStorageV1alpha1OrFail added in v0.17.0

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

func (*Client) CreateStorageV1beta1OrFail added in v0.17.0

func (c *Client) CreateStorageV1beta1OrFail(storage *eventsv1beta1.CloudStorageSource)

func (*Client) CreateUnstructuredObjOrFail

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

func (*Client) DeleteAuditLogsOrFail added in v0.16.0

func (c *Client) DeleteAuditLogsOrFail(name string)

func (*Client) DeleteBuildOrFail added in v0.16.0

func (c *Client) DeleteBuildOrFail(name string)

func (*Client) DeleteGCPBrokerOrFail added in v0.16.0

func (c *Client) DeleteGCPBrokerOrFail(name string)

func (*Client) DeletePubSubOrFail added in v0.16.0

func (c *Client) DeletePubSubOrFail(name string)

func (*Client) DeleteSchedulerOrFail added in v0.16.0

func (c *Client) DeleteSchedulerOrFail(name string)

func (*Client) DeleteStorageOrFail added in v0.16.0

func (c *Client) DeleteStorageOrFail(name string)

func (*Client) GetAuditLogsOrFail added in v0.16.0

func (c *Client) GetAuditLogsOrFail(name string) *eventsv1.CloudAuditLogsSource

func (*Client) GetBuildOrFail added in v0.16.0

func (c *Client) GetBuildOrFail(name string) *eventsv1beta1.CloudBuildSource

func (*Client) GetPubSubOrFail added in v0.16.0

func (c *Client) GetPubSubOrFail(name string) *eventsv1.CloudPubSubSource

func (*Client) GetSchedulerOrFail added in v0.16.0

func (c *Client) GetSchedulerOrFail(name string) *eventsv1.CloudSchedulerSource

func (*Client) GetStorageOrFail added in v0.16.0

func (c *Client) GetStorageOrFail(name string) *eventsv1.CloudStorageSource

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) SetupStackDriverMetricsInNamespace added in v0.16.0

func (c *Client) SetupStackDriverMetricsInNamespace(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 Output added in v0.16.0

type Output interface {
	Successful() bool
}

type PropPair added in v0.15.0

type PropPair struct {
	Expected string
	Received string
}

type PubSubConfig added in v0.16.0

type PubSubConfig struct {
	SinkGVK            metav1.GroupVersionKind
	PubSubName         string
	SinkName           string
	TopicName          string
	ServiceAccountName string
}

type PullSubscriptionConfig added in v0.17.0

type PullSubscriptionConfig struct {
	SinkGVK              metav1.GroupVersionKind
	PullSubscriptionName string
	SinkName             string
	TopicName            string
	ServiceAccountName   string
}

type SchedulerConfig added in v0.16.0

type SchedulerConfig struct {
	SinkGVK            metav1.GroupVersionKind
	SchedulerName      string
	Data               string
	SinkName           string
	ServiceAccountName string
}

type SenderOutput added in v0.16.0

type SenderOutput struct {
	TraceID string `json:"traceid"`
	// contains filtered or unexported fields
}

func (*SenderOutput) Successful added in v0.16.0

func (o *SenderOutput) Successful() bool

type StorageConfig added in v0.16.0

type StorageConfig struct {
	SinkGVK            metav1.GroupVersionKind
	BucketName         string
	StorageName        string
	SinkName           string
	ServiceAccountName string
	Options            []reconcilertestingv1.CloudStorageSourceOption
}

type TargetOutput

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

func (*TargetOutput) Successful added in v0.16.0

func (o *TargetOutput) Successful() bool

type TriggerAssertionKey added in v0.16.0

type TriggerAssertionKey struct {
	Name string
	// If not provided, it means the assertion doesn't care about response code.
	RespCode int
}

type TriggerMetricAssertion added in v0.16.0

type TriggerMetricAssertion struct {
	ProjectID                   string
	BrokerNamespace             string
	BrokerName                  string
	StartTime                   time.Time
	CountPerTriggerWithRespCode map[TriggerAssertionKey]int64
	CountPerTriggerNoRespCode   map[TriggerAssertionKey]int64
}

func (TriggerMetricAssertion) Assert added in v0.16.0

func (TriggerMetricAssertion) StackdriverFilter added in v0.16.0

func (a TriggerMetricAssertion) StackdriverFilter(metric string) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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