testvariants

package
v0.0.0-...-04ac5cb Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DefaultResponseLimitBytes is the default soft limit on the number of bytes
	// that should be returned by a Test Variants query.
	DefaultResponseLimitBytes = 20 * 1000 * 1000 // 20 MB
)

Variables

View Source
var AllFields = mask.All(&pb.TestVariant{})

AllFields is a field mask that selects all TestVariant fields.

Functions

func AdjustResultLimit

func AdjustResultLimit(resultLimit int32) int

AdjustResultLimit takes the given requested resultLimit and adjusts as necessary.

func QueryMask

func QueryMask(readMask *field_mask.FieldMask) (*mask.Mask, error)

QueryMask returns mask.Mask converted from field_mask.FieldMask. It returns a default mask with all fields if readMask is empty.

func ValidateResultLimit

func ValidateResultLimit(resultLimit int32) error

ValidateResultLimit returns a non-nil error if resultLimit is invalid. Returns nil if resultLimit is 0.

Types

type AccessLevel

type AccessLevel int
const (
	// The access level is invalid; either an error occurred when checking the
	// caller's access, or the caller does not have any kind of access to data in
	// the realms of the invocations being queried.
	AccessLevelInvalid AccessLevel = iota
	// Limited access. The caller has access to metadata only, such as
	// pass/fail status of tests, test IDs and sanitised failure reasons.
	AccessLevelLimited
	// The caller has access to all data in the realms of the invocations being
	// queried.
	AccessLevelUnrestricted
)

type Page

type Page struct {
	// TestVariants are the test variants in the page.
	TestVariants []*pb.TestVariant
	// DistinctSources are the sources referenced by each test variant's
	// source_id, stored by their ID. The ID itself should be treated
	// as an opaque value; its generation is an implementation detail.
	DistinctSources map[string]*pb.Sources
	// NextPageToken is used to iterate to the next page of results.
	NextPageToken string
}

Page represents a page of test variants fetched in response to a query.

type Query

type Query struct {
	ReachableInvocations graph.ReachableInvocations
	Predicate            *pb.TestVariantPredicate
	// ResultLimit is a limit on the number of test results returned
	// per test variant. Must be postiive.
	ResultLimit int
	// PageSize is a limit on the number of test variants returned
	// per page. The actual number of test variants returned may be
	// less than this, or even zero. (It may be zero even if there are
	// more test variants in later pages). Must be positive.
	PageSize int
	// ResponseLimitBytes is the soft limit on the number of bytes returned
	// by a query. The soft limit is on JSON-serialised form of the
	// result. A page will be truncated once it exceeds this value.
	// Must be positive.
	ResponseLimitBytes int
	// Consists of test variant status, test id and variant hash.
	PageToken string
	Mask      *mask.Mask
	TestIDs   []string
	// The level of access the user has to test results and test exoneration data.
	AccessLevel AccessLevel
	// contains filtered or unexported fields
}

Query specifies test variants to fetch.

func (*Query) Fetch

func (q *Query) Fetch(ctx context.Context) (Page, error)

Fetch returns a page of test variants matching q. Returned test variants are ordered by test variant status, test ID and variant hash.

Jump to

Keyboard shortcuts

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