Documentation ¶
Index ¶
- func EmitCloudEvents(ctx context.Context, object runtime.Object)
- func EmitCloudEventsWhenConditionChange(ctx context.Context, beforeCondition *apis.Condition, ...)
- func EventForObjectWithCondition(ctx context.Context, runObject objectWithCondition) (*cloudevents.Event, error)
- func GetCloudEventDeliveryCompareOptions() []cmp.Option
- func SendCloudEventWithRetries(ctx context.Context, object runtime.Object) error
- func ToContext(ctx context.Context, cec CEClient) context.Context
- func WithFakeClient(ctx context.Context, behaviour *FakeClientBehaviour, expectedEventCount int) context.Context
- type CEClient
- type CloudClient
- type FakeClient
- func (c *FakeClient) CheckCloudEventsUnordered(t *testing.T, testName string, wantEvents []string)
- func (c FakeClient) Request(ctx context.Context, event cloudevents.Event) (*cloudevents.Event, protocol.Result)
- func (c FakeClient) Send(ctx context.Context, event cloudevents.Event) protocol.Result
- func (c FakeClient) StartReceiver(ctx context.Context, fn interface{}) error
- type FakeClientBehaviour
- type TektonCloudEventData
- type TektonEventType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmitCloudEvents ¶
EmitCloudEvents emits CloudEvents (only) for object
func EmitCloudEventsWhenConditionChange ¶
func EmitCloudEventsWhenConditionChange(ctx context.Context, beforeCondition *apis.Condition, afterCondition *apis.Condition, object runtime.Object)
EmitCloudEventsWhenConditionChange emits CloudEvents when there is a change in condition
func EventForObjectWithCondition ¶
func EventForObjectWithCondition(ctx context.Context, runObject objectWithCondition) (*cloudevents.Event, error)
EventForObjectWithCondition creates a new event based for an objectWithCondition, or returns an error if not possible.
func GetCloudEventDeliveryCompareOptions ¶
GetCloudEventDeliveryCompareOptions returns compare options to sort and compare a list of CloudEventDelivery
func SendCloudEventWithRetries ¶
SendCloudEventWithRetries sends a cloud event for the specified resource. It does not block and it perform retries with backoff using the cloudevents sdk-go capabilities. It accepts a runtime.Object to avoid making objectWithCondition public since it's only used within the events/cloudevents packages.
func WithFakeClient ¶
func WithFakeClient(ctx context.Context, behaviour *FakeClientBehaviour, expectedEventCount int) context.Context
WithFakeClient adds to the context a fake client with the desired behaviour and expectedEventCount
Types ¶
type CEClient ¶
type CEClient interface { cloudevents.Client // contains filtered or unexported methods }
CEClient wraps the `Client` interface from github.com/cloudevents/sdk-go/v2/cloudevents and has methods to count the cloud events being sent, those methods are for testing purposes.
type CloudClient ¶
type CloudClient struct {
// contains filtered or unexported fields
}
CloudClient is a wrapper of CloudEvents client and implements addCount and decreaseCount
func (CloudClient) Request ¶
func (c CloudClient) Request(ctx context.Context, event event.Event) (*cloudevents.Event, protocol.Result)
Request invokes client.Request
func (CloudClient) Send ¶
func (c CloudClient) Send(ctx context.Context, event cloudevents.Event) protocol.Result
Send invokes call client.Send
func (CloudClient) StartReceiver ¶
func (c CloudClient) StartReceiver(ctx context.Context, fn interface{}) error
StartReceiver invokes client.StartReceiver
type FakeClient ¶
type FakeClient struct {
// contains filtered or unexported fields
}
FakeClient is a fake CloudEvent client for unit testing Holding a pointer to the behaviour allows to change the behaviour of a client
func (*FakeClient) CheckCloudEventsUnordered ¶
func (c *FakeClient) CheckCloudEventsUnordered(t *testing.T, testName string, wantEvents []string)
CheckCloudEventsUnordered checks that all events in wantEvents, and no others, were received via the given chan, in any order. Block until all events have been sent.
func (FakeClient) Request ¶
func (c FakeClient) Request(ctx context.Context, event cloudevents.Event) (*cloudevents.Event, protocol.Result)
Request fakes the Request method from cloudevents.Client
func (FakeClient) Send ¶
func (c FakeClient) Send(ctx context.Context, event cloudevents.Event) protocol.Result
Send fakes the Send method from cloudevents.Client
func (FakeClient) StartReceiver ¶
func (c FakeClient) StartReceiver(ctx context.Context, fn interface{}) error
StartReceiver fakes StartReceiver method from cloudevents.Client
type FakeClientBehaviour ¶
type FakeClientBehaviour struct {
SendSuccessfully bool
}
FakeClientBehaviour defines how the client will behave
type TektonCloudEventData ¶
type TektonCloudEventData struct { TaskRun *v1beta1.TaskRun `json:"taskRun,omitempty"` PipelineRun *v1beta1.PipelineRun `json:"pipelineRun,omitempty"` CustomRun *v1beta1.CustomRun `json:"customRun,omitempty"` }
TektonCloudEventData type is used to marshal and unmarshal the payload of a Tekton cloud event. It can include a TaskRun or a PipelineRun
type TektonEventType ¶
type TektonEventType string
TektonEventType holds the types of cloud events sent by Tekton
const ( // TaskRunStartedEventV1 is sent for TaskRuns with "ConditionSucceeded" "Unknown" // the first time they are picked up by the reconciler TaskRunStartedEventV1 TektonEventType = "dev.tekton.event.taskrun.started.v1" // TaskRunRunningEventV1 is sent for TaskRuns with "ConditionSucceeded" "Unknown" // once the TaskRun is validated and Pod created TaskRunRunningEventV1 TektonEventType = "dev.tekton.event.taskrun.running.v1" // TaskRunUnknownEventV1 is sent for TaskRuns with "ConditionSucceeded" "Unknown" // It can be used as a confirmation that the TaskRun is still running. TaskRunUnknownEventV1 TektonEventType = "dev.tekton.event.taskrun.unknown.v1" // TaskRunSuccessfulEventV1 is sent for TaskRuns with "ConditionSucceeded" "True" TaskRunSuccessfulEventV1 TektonEventType = "dev.tekton.event.taskrun.successful.v1" // TaskRunFailedEventV1 is sent for TaskRuns with "ConditionSucceeded" "False" TaskRunFailedEventV1 TektonEventType = "dev.tekton.event.taskrun.failed.v1" // PipelineRunStartedEventV1 is sent for PipelineRuns with "ConditionSucceeded" "Unknown" // the first time they are picked up by the reconciler PipelineRunStartedEventV1 TektonEventType = "dev.tekton.event.pipelinerun.started.v1" // PipelineRunRunningEventV1 is sent for PipelineRuns with "ConditionSucceeded" "Unknown" // once the PipelineRun is validated and Pod created PipelineRunRunningEventV1 TektonEventType = "dev.tekton.event.pipelinerun.running.v1" // PipelineRunUnknownEventV1 is sent for PipelineRuns with "ConditionSucceeded" "Unknown" // It can be used as a confirmation that the PipelineRun is still running. PipelineRunUnknownEventV1 TektonEventType = "dev.tekton.event.pipelinerun.unknown.v1" // PipelineRunSuccessfulEventV1 is sent for PipelineRuns with "ConditionSucceeded" "True" PipelineRunSuccessfulEventV1 TektonEventType = "dev.tekton.event.pipelinerun.successful.v1" // PipelineRunFailedEventV1 is sent for PipelineRuns with "ConditionSucceeded" "False" PipelineRunFailedEventV1 TektonEventType = "dev.tekton.event.pipelinerun.failed.v1" // CustomRunStartedEventV1 is sent for CustomRuns with "ConditionSucceeded" "Unknown" // the first time they are picked up by the reconciler CustomRunStartedEventV1 TektonEventType = "dev.tekton.event.customrun.started.v1" // CustomRunRunningEventV1 is sent for CustomRuns with "ConditionSucceeded" "Unknown" // once the CustomRun is validated and Pod created CustomRunRunningEventV1 TektonEventType = "dev.tekton.event.customrun.running.v1" // CustomRunSuccessfulEventV1 is sent for CustomRuns with "ConditionSucceeded" "True" CustomRunSuccessfulEventV1 TektonEventType = "dev.tekton.event.customrun.successful.v1" // CustomRunFailedEventV1 is sent for CustomRuns with "ConditionSucceeded" "False" CustomRunFailedEventV1 TektonEventType = "dev.tekton.event.customrun.failed.v1" )
func (TektonEventType) String ¶
func (t TektonEventType) String() string