exporter

package
v0.0.0-...-a70aae3 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package exporter contains methods to export test results to BigQuery.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client provides methods to export test results 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 results 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.TestResultRow, dest ExportDestination) error

Insert inserts the given rows in BigQuery.

type ExportDestination

type ExportDestination struct {
	// A unique key for the export destination, using only characters [a-z\-].
	Key string
	// contains filtered or unexported fields
}
var ByDayTable ExportDestination

ByDayTable is a BigQuery table optimised for access by single partition day(s) at a time.

var ByMonthTable ExportDestination

ByMonthTable is a BigQuery table optimised for accessing many months of data for each test_id.

type Exporter

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

Exporter provides methods to stream test results to 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, verdicts []*rdbpb.RunTestVerdict, dest ExportDestination, opts Options) error

Export exports the test results in the given run verdicts to BigQuery.

type FakeClient

type FakeClient struct {
	// Insertions is the set of test results which were attempted
	// to be exported using the client.
	InsertionsByDestinationKey map[string][]*bqpb.TestResultRow
}

FakeClient represents a fake implementation of the test results exporter, for testing.

func NewFakeClient

func NewFakeClient() *FakeClient

NewFakeClient initialises a new client for exporting test results.

func (*FakeClient) Insert

func (fc *FakeClient) Insert(ctx context.Context, rows []*bqpb.TestResultRow, dest ExportDestination) error

Insert inserts the given rows.

type InsertClient

type InsertClient interface {
	// Insert inserts the given rows into BigQuery.
	Insert(ctx context.Context, rows []*bqpb.TestResultRow, dest ExportDestination) error
}

InsertClient defines an interface for inserting rows into BigQuery.

type Options

type Options struct {
	RootInvocationID string
	RootRealm        string
	PartitionTime    time.Time
	Parent           *rdbpb.Invocation
	Sources          *pb.Sources
}

Options captures context which will be exported alongside the test results.

Jump to

Keyboard shortcuts

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