Documentation
¶
Overview ¶
Package bundleclient provides a client of test bundles.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LocalCommand ¶
LocalCommand creates a SSH command to run exec on the target specified by cc.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a gRPC protocol client to a test bundle.
func NewLocal ¶
func NewLocal(bundle, bundleDir string, proxy bool, cc *target.ConnCache, msgTimeout time.Duration) *Client
NewLocal creates a bundle client to the local bundle.
func (*Client) BundlePath ¶
BundlePath returns the bundle path.
func (*Client) RunFixture ¶
func (c *Client) RunFixture(ctx context.Context, name string, cfg *protocol.RunFixtureConfig, out RunFixtureOutput) (_ *FixtureTicket, retErr error)
RunFixture requests a test bundle to set up a fixture. After successful return of RunFixture, a caller must call FixtureTicket.TearDown to tear down the fixture.
func (*Client) RunTests ¶
func (c *Client) RunTests(ctx context.Context, bcfg *protocol.BundleConfig, rcfg *protocol.RunConfig, out RunTestsOutput, recursive bool)
RunTests requests to run tests according to the given RunConfig. Test execution events are streamed back via out. See RunTestsOutput for details.
type FixtureTicket ¶
type FixtureTicket struct {
// contains filtered or unexported fields
}
FixtureTicket tracks the state of a fixture set up by Client.RunFixture.
func (*FixtureTicket) StartFixtureState ¶
func (t *FixtureTicket) StartFixtureState() *protocol.StartFixtureState
StartFixtureState returns a StartFixtureState suitable to drive local test bundles.
type RunFixtureOutput ¶
type RunFixtureOutput interface { EntityLog(ctx context.Context, ev *protocol.EntityLogEvent) error EntityError(ctx context.Context, ev *protocol.EntityErrorEvent) error }
RunFixtureOutput is implemented by callers of RunFixture to receive fixture execution events.
type RunTestsOutput ¶
type RunTestsOutput interface { // RunStart is called exactly once at the beginning of an overall test // execution. RunStart(ctx context.Context) error // EntityStart is called when an entity starts. EntityStart(ctx context.Context, ev *protocol.EntityStartEvent) error // EntityLog is called with an entity log. EntityLog(ctx context.Context, ev *protocol.EntityLogEvent) error // EntityError is called with an entity error. EntityError(ctx context.Context, ev *protocol.EntityErrorEvent) error // EntityEnd is called when an entity finishes. EntityEnd(ctx context.Context, ev *protocol.EntityEndEvent) error // EntityCopyEnd is called when copy of output files completes after an entity // finishes. EntityCopyEnd(ctx context.Context, ev *protocol.EntityCopyEndEvent) error // RunLog is called with a log not associated with an entity. RunLog(ctx context.Context, ev *protocol.RunLogEvent) error // StackOperation is called to request remote fixture stack operation. // This is called when a local bundle needs remote fixture operation. StackOperation(ctx context.Context, req *protocol.StackOperationRequest) *protocol.StackOperationResponse // RunEnd is called exactly once at the end of an overall test execution. // If any other method returns a non-nil error, test execution is aborted // immediately and RunEnd is called with the error. RunEnd(ctx context.Context, err error) }
RunTestsOutput is implemented by callers of RunTests to receive test execution events.
Its methods (except RunStart and RunEnd) are called on receiving a corresponding test execution event. In case of errors, they can be called in an inconsistent way (e.g. EntityEnd is not called after EntityStart due to a test crash). RunTestsOutput implementations must be prepared to handle such error cases correctly.
All methods except RunEnd can return an error, which leads to immediate abort of the test execution and subsequent RunEnd call.