testverdicts

package
v0.0.0-...-d3da680 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package testverdicts handles read and write test verdicts to BigQuery.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BQChangelist

type BQChangelist struct {
	Host      bigquery.NullString
	Change    bigquery.NullInt64
	Patchset  bigquery.NullInt64
	OwnerKind bigquery.NullString
}

type BQGitiles

type BQGitiles struct {
	Host    bigquery.NullString
	Project bigquery.NullString
	Ref     bigquery.NullString
}

type BQRef

type BQRef struct {
	Gitiles *BQGitiles
}

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

func NewClient(ctx context.Context, projectID string) (s *Client, reterr error)

NewClient creates a new client for exporting test verdicts via the BigQuery Write API.

func (*Client) Close

func (c *Client) Close() (reterr error)

Close releases resources held by the client.

func (*Client) Insert

func (c *Client) Insert(ctx context.Context, rows []*bqpb.TestVerdictRow) error

Insert inserts the given rows in BigQuery.

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 {
	SourceVerdictAfterPosition *SourceVerdict
}

FakeReadClient represents a fake implementation of the client to read test verdicts from BigQuery, for testing.

func (*FakeReadClient) ReadTestVerdictAfterPosition

func (f *FakeReadClient) ReadTestVerdictAfterPosition(ctx context.Context, options ReadVerdictAtOrAfterPositionOptions) (*SourceVerdict, error)

ReadTestVerdictAfterPosition reads the source veridct at or after the given source position.

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 from test verdicts BigQuery table.

func (*ReadClient) Close

func (c *ReadClient) Close() error

Close releases any resources held by the client.

func (*ReadClient) ReadTestVerdictAfterPosition

func (c *ReadClient) ReadTestVerdictAfterPosition(ctx context.Context, options ReadVerdictAtOrAfterPositionOptions) (*SourceVerdict, error)

ReadTestVerdictAfterPosition returns the first source verdict after the given position on the given branch.

type ReadVerdictAtOrAfterPositionOptions

type ReadVerdictAtOrAfterPositionOptions struct {
	// The LUCI Project.
	Project string
	// The test identifier.
	TestID string
	// The variant hash, 16 hex characters.
	VariantHash string
	// The source ref hash, 16 hex characters.
	RefHash string
	// The source position along the ref to search for.
	// The first verdict at or after this position will be returned.
	AtOrAfterPosition int64
	// The start of the partition time range to search, inclusive.
	PartitionTimeStart time.Time
	// The end of the parition time range to search, exclusive.
	PartitionTimeEnd time.Time
	// The LUCI realms we are allowed to access.
	AllowedRealms []string
}

type SourceVerdict

type SourceVerdict struct {
	// Source position of this commit.
	Position int64
	// Commit hash of this commit.
	CommitHash string
	// The variant, as a JSON blob.
	Variant string
	// The location of the test, if available.
	TestLocation *TestLocation
	// Represent a branch in the source control.
	Ref *BQRef
	// A selection of test results at the position.
	// May contain 0 or 1 items.
	Results []TestResult
}

type TestLocation

type TestLocation struct {
	// The repository, e.g. "https://chromium.googlesource.com/chromium/src".
	Repo string
	// The file name in the repository, e.g.
	// "//third_party/blink/web_tests/external/wpt/html/semantics/scripting-1/the-script-element/json-module-assertions/load-error-events.html".
	FileName string
}

type TestResult

type TestResult struct {
	ParentInvocationID string
	ResultID           string
	Expected           bool
	// One of the analysispb.TestResultStatus values.
	Status               string
	PrimaryFailureReason bigquery.NullString
}

Jump to

Keyboard shortcuts

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