Documentation ¶
Overview ¶
Package testverdicts handles read and write test verdicts to BigQuery.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Changelist ¶
type Changelist struct { Host bigquery.NullString Change bigquery.NullInt64 Patchset bigquery.NullInt64 OwnerKind bigquery.NullString }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides methods to export test verdicts to BigQuery via the BigQuery Write API.
func NewClient ¶
NewClient creates a new client for exporting test verdicts via the BigQuery Write API.
type CommitWithVerdicts ¶
type CommitWithVerdicts struct { // Source position of this commit. Position int64 // Commit hash of this commit. CommitHash string // Represent a branch in the source control. Ref *Ref // Returns at most 20 test verdicts at this commit. TestVerdicts []*TestVerdict }
CommitWithVerdicts represents a commit with test verdicts.
type ExportOptions ¶
type ExportOptions struct { Payload *taskspb.IngestTestVerdicts Invocation *rdbpb.Invocation SourcesByID map[string]*pb.Sources }
ExportOptions captures context which will be exported alongside the test verdicts.
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
Exporter provides methods to stream test verdicts into BigQuery.
func NewExporter ¶
func NewExporter(client InsertClient) *Exporter
NewExporter instantiates a new Exporter. The given client is used to insert rows into BigQuery.
func (*Exporter) Export ¶
func (e *Exporter) Export(ctx context.Context, testVariants []*rdbpb.TestVariant, opts ExportOptions) error
Export exports the given test verdicts to BigQuery.
type FakeClient ¶
type FakeClient struct { // Insertions is the set of test verdicts which were attempted // to be exported using the client. Insertions []*bqp.TestVerdictRow }
FakeClient represents a fake implementation of the test verdicts exporter, for testing.
func NewFakeClient ¶
func NewFakeClient() *FakeClient
NewFakeClient initialises a new client for exporting test verdicts.
func (*FakeClient) Insert ¶
func (fc *FakeClient) Insert(ctx context.Context, rows []*bqp.TestVerdictRow) error
Insert inserts the given rows.
type FakeReadClient ¶
type FakeReadClient struct {
CommitsWithVerdicts []*CommitWithVerdicts
}
FakeReadClient represents a fake implementation of the client to read test verdicts from BigQuery, for testing.
func (*FakeReadClient) ReadTestVerdictsPerSourcePosition ¶
func (f *FakeReadClient) ReadTestVerdictsPerSourcePosition(ctx context.Context, options ReadTestVerdictsPerSourcePositionOptions) ([]*CommitWithVerdicts, error)
ReadTestVerdictsPerSourcePosition reads test verdicts per source position.
type Gitiles ¶
type Gitiles struct { Host bigquery.NullString Project bigquery.NullString Ref bigquery.NullString }
type InsertClient ¶
type InsertClient interface { // Insert inserts the given rows into BigQuery. Insert(ctx context.Context, rows []*bqpb.TestVerdictRow) error }
InsertClient defines an interface for inserting rows into BigQuery.
type ReadClient ¶
type ReadClient struct {
// contains filtered or unexported fields
}
ReadClient represents a client to read test verdicts from BigQuery.
func NewReadClient ¶
func NewReadClient(ctx context.Context, gcpProject string) (*ReadClient, error)
NewReadClient creates a new client for reading test verdicts.
func (*ReadClient) Close ¶
func (c *ReadClient) Close() error
Close releases any resources held by the client.
func (*ReadClient) ReadTestVerdictsPerSourcePosition ¶
func (c *ReadClient) ReadTestVerdictsPerSourcePosition(ctx context.Context, options ReadTestVerdictsPerSourcePositionOptions) ([]*CommitWithVerdicts, error)
ReadTestVerdictsPerSourcePosition returns commits with test verdicts in source position ascending order.
type ReadTestVerdictsPerSourcePositionOptions ¶
type ReadTestVerdictsPerSourcePositionOptions struct { Project string TestID string VariantHash string RefHash string // Only test verdicts with allowed invocation realms can be returned. AllowedRealms []string // All returned commits has source position greater than PositionMustGreater. PositionMustGreater int64 // The maximum number of commits to return. NumCommits int64 }