Documentation ¶
Overview ¶
Package lowlatency contains methods for accessing the low-latency test results table in Spanner.
Index ¶
- Variables
- func SetForTesting(ctx context.Context, t testing.TB, results []*TestResult) error
- type ReadSourceVerdictsOptions
- type RunStatus
- type SourceVerdict
- type SourceVerdictTestVerdict
- type TestResult
- type TestResultBuilder
- func (b TestResultBuilder) Build() *TestResult
- func (b TestResultBuilder) WithInvocationID(invID string) TestResultBuilder
- func (b TestResultBuilder) WithIsUnexpected(isUnexpected bool) TestResultBuilder
- func (b TestResultBuilder) WithPartitionTime(partitionTime time.Time) TestResultBuilder
- func (b TestResultBuilder) WithProject(project string) TestResultBuilder
- func (b TestResultBuilder) WithResultID(resultID string) TestResultBuilder
- func (b TestResultBuilder) WithRootInvocationID(rootInvID string) TestResultBuilder
- func (b TestResultBuilder) WithSources(sources testresults.Sources) TestResultBuilder
- func (b TestResultBuilder) WithStatus(status pb.TestResultStatus) TestResultBuilder
- func (b TestResultBuilder) WithSubRealm(subRealm string) TestResultBuilder
- func (b TestResultBuilder) WithTestID(testID string) TestResultBuilder
- func (b TestResultBuilder) WithVariantHash(variantHash string) TestResultBuilder
- type TestVerdictBuilder
Constants ¶
This section is empty.
Variables ¶
var TestResultSaveCols = []string{
"Project", "TestId", "VariantHash", "SourceRefHash", "SourcePosition",
"RootInvocationId", "InvocationId", "ResultId", "PartitionTime", "SubRealm",
"IsUnexpected", "Status", "ChangelistHosts", "ChangelistChanges",
"ChangelistPatchsets", "ChangelistOwnerKinds", "HasDirtySources",
}
TestResultSaveCols is the set of columns written to in a test result save. Allocated here once to avoid reallocating on every test result save.
Functions ¶
func SetForTesting ¶
SetForTesting replaces the stored test results with the given list. For use in unit/integration tests only.
Types ¶
type ReadSourceVerdictsOptions ¶
type ReadSourceVerdictsOptions struct { // The LUCI Project. Project string TestID string VariantHash string RefHash []byte // Only test verdicts with allowed invocation realms can be returned. AllowedSubrealms []string // The maximum source position to return, inclusive. StartSourcePosition int64 // The minimum source position to return, exclusive. EndSourcePosition int64 // The earliest partition time to include in the results, inclusive. StartPartitionTime time.Time }
type SourceVerdict ¶
type SourceVerdict struct { // The source position. Position int64 // Test verdicts at the position. Limited to 20. Verdicts []SourceVerdictTestVerdict }
SourceVerdict aggregates all test results at a source position.
func ReadSourceVerdicts ¶
func ReadSourceVerdicts(ctx context.Context, opts ReadSourceVerdictsOptions) ([]SourceVerdict, error)
ReadSourceVerdicts reads source verdicts for a test variant branch for a given range of source positions. Must be called in a spanner transactional context.
type SourceVerdictTestVerdict ¶
type SourceVerdictTestVerdict struct { // The root invocation for the verdict. RootInvocationID string // Partition time of the test verdict. PartitionTime time.Time // Status is one of SKIPPED, EXPECTED, UNEXPECTED, FLAKY. Status pb.QuerySourceVerdictsResponse_VerdictStatus // Changelists tested by the verdict. Changelists []testresults.Changelist }
SourceVerdictTestVerdict is a test verdict that is part of a source verdict.
type TestResult ¶
type TestResult struct { Project string TestID string VariantHash string Sources testresults.Sources RootInvocationID string InvocationID string ResultID string PartitionTime time.Time SubRealm string IsUnexpected bool Status pb.TestResultStatus }
TestResult represents a row in the TestResultsBySourcePosition table.
func ReadAllForTesting ¶
func ReadAllForTesting(ctx context.Context) ([]*TestResult, error)
ReadAllForTesting reads all test results from the TestResultsBySourcePosition table for testing. Must be called in a spanner transactional context.
func (*TestResult) SaveUnverified ¶
func (tr *TestResult) SaveUnverified() *spanner.Mutation
SaveUnverified prepare a mutation to insert the test result into the TestResultsBySourcePosition table. The test result is not validated.
type TestResultBuilder ¶
type TestResultBuilder struct {
// contains filtered or unexported fields
}
TestResultBuilder provides methods to build a test result for testing.
func NewTestResult ¶
func NewTestResult() TestResultBuilder
func (TestResultBuilder) Build ¶
func (b TestResultBuilder) Build() *TestResult
func (TestResultBuilder) WithInvocationID ¶
func (b TestResultBuilder) WithInvocationID(invID string) TestResultBuilder
func (TestResultBuilder) WithIsUnexpected ¶
func (b TestResultBuilder) WithIsUnexpected(isUnexpected bool) TestResultBuilder
WithIsUnexpected specifies whether the test result is unexpected.
func (TestResultBuilder) WithPartitionTime ¶
func (b TestResultBuilder) WithPartitionTime(partitionTime time.Time) TestResultBuilder
WithPartitionTime specifies the partition time of the test result.
func (TestResultBuilder) WithProject ¶
func (b TestResultBuilder) WithProject(project string) TestResultBuilder
func (TestResultBuilder) WithResultID ¶
func (b TestResultBuilder) WithResultID(resultID string) TestResultBuilder
func (TestResultBuilder) WithRootInvocationID ¶
func (b TestResultBuilder) WithRootInvocationID(rootInvID string) TestResultBuilder
func (TestResultBuilder) WithSources ¶
func (b TestResultBuilder) WithSources(sources testresults.Sources) TestResultBuilder
func (TestResultBuilder) WithStatus ¶
func (b TestResultBuilder) WithStatus(status pb.TestResultStatus) TestResultBuilder
WithStatus specifies the status of the test result.
func (TestResultBuilder) WithSubRealm ¶
func (b TestResultBuilder) WithSubRealm(subRealm string) TestResultBuilder
WithSubRealm specifies the subrealm of the test result.
func (TestResultBuilder) WithTestID ¶
func (b TestResultBuilder) WithTestID(testID string) TestResultBuilder
func (TestResultBuilder) WithVariantHash ¶
func (b TestResultBuilder) WithVariantHash(variantHash string) TestResultBuilder
type TestVerdictBuilder ¶
type TestVerdictBuilder struct {
// contains filtered or unexported fields
}
TestVerdictBuilder provides methods to build a test variant for testing.
func NewTestVerdict ¶
func NewTestVerdict() *TestVerdictBuilder
func (*TestVerdictBuilder) Build ¶
func (b *TestVerdictBuilder) Build() []*TestResult
func (*TestVerdictBuilder) WithBaseTestResult ¶
func (b *TestVerdictBuilder) WithBaseTestResult(testResult *TestResult) *TestVerdictBuilder
WithBaseTestResult specifies a test result to use as the template for the test variant's test results.
func (*TestVerdictBuilder) WithRunStatus ¶
func (b *TestVerdictBuilder) WithRunStatus(runStatuses ...RunStatus) *TestVerdictBuilder
WithRunStatus specifies the status of runs of the test verdict.