Documentation ¶
Overview ¶
Package protocoltest provides utilities for unit tests involving Tast gRPC protocol.
Index ¶
- Variables
- func ExtractEvent(res *protocol.RunTestsResponse) (protocol.Event, bool)
- func RunTestsForEvents(ctx context.Context, cl protocol.TestServiceClient, rcfg *protocol.RunConfig, ...) ([]protocol.Event, error)
- func RunTestsRecursiveForEvents(ctx context.Context, cl protocol.TestServiceClient, rcfg *protocol.RunConfig, ...) ([]protocol.Event, error)
- type Option
Constants ¶
This section is empty.
Variables ¶
var EventCmpOpts = []cmp.Option{ protocmp.Transform(), protocmp.IgnoreMessages(×tamp.Timestamp{}), protocmp.IgnoreFields(&protocol.EntityStartEvent{}, "out_dir"), protocmp.IgnoreFields(&protocol.EntityEndEvent{}, "timing_log"), protocmp.IgnoreFields(&protocol.Error{}, "location"), }
EventCmpOpts is a list of options to be passed to cmp.Diff to compare protocol.Event slices ignoring non-deterministic fields.
Functions ¶
func ExtractEvent ¶
func ExtractEvent(res *protocol.RunTestsResponse) (protocol.Event, bool)
ExtractEvent extracts Event from RunTestsResponse. It is useful in unit tests to compare received events against expectation.
func RunTestsForEvents ¶
func RunTestsForEvents(ctx context.Context, cl protocol.TestServiceClient, rcfg *protocol.RunConfig, opts ...Option) ([]protocol.Event, error)
RunTestsForEvents calls RunTests on cl with cfg and returns a slice of events. wantLogs specifies whether RunLogEvent and EntityLogEvent should be included in the result.
Types ¶
type Option ¶
type Option func(*config)
Option represents an option to RunTestsForEvents.
func WithEntityLogs ¶
func WithEntityLogs() Option
WithEntityLogs instructs to include EntityLogEvents to the result.
func WithRunLogs ¶
func WithRunLogs() Option
WithRunLogs instructs to include RunLogEvents to the result.