Documentation
¶
Index ¶
- Constants
- Variables
- func Connect(ctx context.Context, serviceAccountPath string) (*grpc.ClientConn, error)
- func Files(fs []File) []*resultstore.File
- func URL(resourceName string) string
- func UUID() string
- type Action
- type Actions
- type Case
- type Client
- func (c Client) Actions(configuredTargetName string) Actions
- func (c Client) Configurations(invocationName string) Configurations
- func (c Client) ConfiguredTargets(targetName, configID string) ConfiguredTargets
- func (c Client) Invocations() Invocations
- func (c Client) Targets(invocationName string) Targets
- func (c *Client) WithContext(ctx context.Context) *Client
- func (c *Client) WithSecret(authorizationToken Secret) *Client
- type Configurations
- type ConfiguredTargets
- type Error
- type Failure
- type File
- type Invocation
- type Invocations
- func (i Invocations) Create(inv Invocation) (string, error)
- func (i Invocations) Finish(name string) error
- func (i Invocations) Get(name string, fields ...string) (*Invocation, error)
- func (i Invocations) Search(ctx context.Context, projectID string, query string, fields ...string) ([]*Invocation, error)
- func (i Invocations) Update(inv Invocation, fields ...string) error
- type Property
- type Result
- type Secret
- type Status
- type Suite
- type Target
- type Targets
- type Test
Constants ¶
const ( // BuildLog appears in the invocation log BuildLog = "build.log" // Stdout of a build action, which isn't useful right now. Stdout = "stdout" // Stderr of a build action, which also isn't useful. Stderr = "stderr" // TestLog appears in the Target Log tab. TestLog = "test.log" // TestXml causes ResultStore to process this junit.xml to add cases automatically (we aren't using). TestXml = "test.xml" // TestCov provides line coverage, currently we're not using this. TestCov = "test.lcov" // BaselineCov provides original line coverage, currently we're not using this. BaselineCov = "baseline.lcov" )
The following logs cause ResultStore to do additional processing
const ( // InvocationLog is a more obvious name for the invocation log InvocationLog = BuildLog // TargetLog is a more obvious name for the target log. TargetLog = TestLog )
ResultStore will display the following logs inline.
const ( // Completed cases finished, producing failures if it failed. Completed = resultstore.TestCase_COMPLETED // Cancelled cases did not complete (should have an error). Cancelled = resultstore.TestCase_CANCELLED // Skipped cases did not run. Skipped = resultstore.TestCase_SKIPPED )
Common constants.
const ( // Running means incomplete. Running = resultstore.Status_TESTING // Passed means successful. Passed = resultstore.Status_PASSED // Failed means unsuccessful. Failed = resultstore.Status_FAILED )
Common statuses
const (
// Default is the expected single-configuration id.
Default = "default"
)
Variables ¶
var TestFields = [...]string{
"actions.name",
"actions.test_action",
"actions.description",
"actions.timing",
}
TestFields represent all fields this client cares about.
Functions ¶
Types ¶
type Action ¶
type Action struct {
// StatusAttributes
// Description of the status.
Description string
// Status indicates whether the action completed successfully.
Status Status
// Timing
// Start of the action.
Start time.Time
// Duration of the action.
Duration time.Duration
// Node or machine on which the test ran.
Node string
// ExitCode of the command
ExitCode int
}
Action rerepresents a step in the target, such as a container or command.
type Actions ¶
type Actions struct {
Client
// contains filtered or unexported fields
}
Actions client.
type Case ¶
type Case struct {
// Name identifies the test within its class.
Name string
// Class is the container holding one or more names.
Class string
// Result indicates whether it ran and to completion.
Result Result
// Duration of the case.
Duration time.Duration
// Errors preventing the case from completing.
Errors []Error
// Failures encountered upon completion.
Failures []Failure
// Files specific to this case
Files []File
// Properties of the case
Properties []Property
// Start time of the case.
Start time.Time
}
Case represents the completion of a test case/method.
func (Case) To ¶
func (c Case) To() *resultstore.TestCase
To converts the case to the corresponding ResultStore TestCase proto.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides ResultStore CRUD methods.
func NewClient ¶
func NewClient(conn *grpc.ClientConn) *Client
NewClient uses the specified gRPC connection to connect to ResultStore.
func (Client) Configurations ¶
func (c Client) Configurations(invocationName string) Configurations
Configurations provides CRUD methods for an invocation's configurations.
func (Client) ConfiguredTargets ¶
func (c Client) ConfiguredTargets(targetName, configID string) ConfiguredTargets
ConfiguredTargets provides CRUD methods for a target's configured targets.
func (Client) Invocations ¶
func (c Client) Invocations() Invocations
Invocations provides Invocation CRUD methods.
func (*Client) WithContext ¶
WithContext uses the specified context for all RPCs.
func (*Client) WithSecret ¶
WithSecret applies the specified secret to all requests.
type Configurations ¶
type Configurations struct {
Client
// contains filtered or unexported fields
}
Configurations client.
type ConfiguredTargets ¶
type ConfiguredTargets struct {
Client
// contains filtered or unexported fields
}
ConfiguredTargets client.
type Error ¶
type Error struct {
// Message of the error
Message string
// Type of error, currently useless.
Type string
// Stack trace, separated by new lines.
Stack string
}
Error describes what prevented completion.
func (Error) To ¶
func (e Error) To() *resultstore.TestError
Error returns the corresponding ResultStore TestError message
type Failure ¶
type Failure struct {
// Message is the failure message.
Message string
// Type is the type/type/class of error, currently appears useless.
Type string
// Stack represents the call stack, separated by new lines.
Stack string
// Expected represents what we expected, often just one value.
Expected []string
// Actual represents what we actually got.
Actual []string
}
Failure describes the encountered problem.
func (Failure) To ¶
func (f Failure) To() *resultstore.TestFailure
To converts the failure into a ResultStore TestFailure proto
type File ¶
type File struct {
// Unique name within the set
ID string
// ContentType tells the browser how to render
ContentType string
// Length if complete and known
Length int64
// URL to file in Google Cloud Storage, such as gs://bucket/path/foo
URL string
}
File represents a file stored in GCS
func (File) To ¶
func (f File) To() *resultstore.File
To converts the file to the corresponding ResultStore File proto.
type Invocation ¶
type Invocation struct {
// Name of the invocation, immutable after creation.
Name string
// Project in GCP that owns this invocation.
Project string
// Details describing the invocation.
Details string
// Duration of the invocation
Duration time.Duration
// Start time of the invocation
Start time.Time
// Files for this invocation (InvocationLog in particular)
Files []File
// Properties of the invocation, currently appears to be useless.
Properties []Property
// Status indicating whether the invocation completed successfully.
Status Status
// Description of the status.
Description string
}
Invocation represents a flatted ResultStore invocation
func (Invocation) To ¶
func (i Invocation) To() *resultstore.Invocation
To converts the invocation into a ResultStore Invoation proto.
type Invocations ¶
type Invocations struct {
Client
}
Invocations client.
func (Invocations) Create ¶
func (i Invocations) Create(inv Invocation) (string, error)
Create a new invocation (project must be specified).
func (Invocations) Finish ¶
func (i Invocations) Finish(name string) error
Finish an invocation, preventing further updates. TODO(fejta): consider renaming this to Finalize()
func (Invocations) Get ¶
func (i Invocations) Get(name string, fields ...string) (*Invocation, error)
Get an existing invocation at name.
func (Invocations) Search ¶ added in v0.0.9
func (i Invocations) Search(ctx context.Context, projectID string, query string, fields ...string) ([]*Invocation, error)
Search finds all the invocations that satisfies the query condition within a project.
func (Invocations) Update ¶
func (i Invocations) Update(inv Invocation, fields ...string) error
Update a pre-existing invocation at name.
type Property ¶
type Property = resultstore.Property
Property represents a key-value pairing.
func Properties ¶
Properties converts key, value pairs into a property list.
type Secret ¶
type Secret string
Secret represents a secret authorization uuid to protect invocations.
type Status ¶
type Status = resultstore.Status
Status represents the status of the action/target/invocation.
type Suite ¶
type Suite struct {
// Name of the suite, such as the tested class.
Name string
// Cases holds details about each case in the suite.
Cases []Case
// Duration of the entire suite.
Duration time.Duration
// Errors that prevented the suite from completing.
Errors []Error
// Failures detected during the suite.
Failures []Failure
// Files outputted by the suite.
Files []File
// Properties of the suite.
Properties []Property
// Result determines whether the suite ran and finished.
Result Result
// Time the suite started
Start time.Time
// Suites hold details about child suites.
Suites []Suite
}
Suite represents testing details.
func (Suite) To ¶
func (s Suite) To() *resultstore.TestSuite
To converts a suite into the corresponding ResultStore TestSuite proto.
type Target ¶
type Target struct {
// Name of the target, immutable.
Name string
// Start time of the target.
Start time.Time
// Duration the target ran.
Duration time.Duration
// Status specifying whether the target completed successfully.
Status Status
// Description of the status
Description string
// Tags are metadata for the target (like github labels).
Tags []string
// Properties of the target
Properties []Property
}
Target represents a set of commands run inside the same pod.
func (Target) To ¶
func (t Target) To() *resultstore.Target
To converts a target into the corresponding ResultStore Target proto.
type Targets ¶
type Targets struct {
Client
// contains filtered or unexported fields
}
Targets client.
type Test ¶
type Test struct {
// Action holds generic metadata about the test
Action
// Suite holds a variety of case and sub-suite data.
Suite
// Warnings, appear to be useless.
Warnings []string
}
Test represents a test action, containing action, suite and warnings.
func (Test) To ¶
func (t Test) To() *resultstore.Action
To converts the test into the corresponding ResultStore Action proto