Documentation
¶
Overview ¶
Package client provides a type-safe client for the Testground server.
Testground uses a client-server architecture. The Testground client talks to the Testground daemon, which builds, and runs your test plans.
The Testground client and daemon can run on the same system, or you can connect a Testground client to a remote Testground daemon.
Currently all commands to Testground, but the `daemon` command, are client-side commands.
Index ¶
- func ParseBuildResponse(r io.ReadCloser) (api.BuildResponse, error)
- func ParseCollectResponse(r io.ReadCloser, file io.Writer) (api.CollectResponse, error)
- func ParseHealthcheckResponse(r io.ReadCloser) (api.HealthcheckResponse, error)
- func ParseRunResponse(r io.ReadCloser) (api.RunResponse, error)
- func ParseTerminateRequest(r io.ReadCloser) error
- type Client
- func (c *Client) Build(ctx context.Context, r *api.BuildRequest, plandir string, sdkdir string) (io.ReadCloser, error)
- func (c *Client) Close() error
- func (c *Client) CollectOutputs(ctx context.Context, r *api.OutputsRequest) (io.ReadCloser, error)
- func (c *Client) Healthcheck(ctx context.Context, r *api.HealthcheckRequest) (io.ReadCloser, error)
- func (c *Client) Run(ctx context.Context, r *api.RunRequest) (io.ReadCloser, error)
- func (c *Client) Terminate(ctx context.Context, r *api.TerminateRequest) (io.ReadCloser, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseBuildResponse ¶
func ParseBuildResponse(r io.ReadCloser) (api.BuildResponse, error)
ParseBuildResponse parses a response from a `build` call
func ParseCollectResponse ¶
func ParseCollectResponse(r io.ReadCloser, file io.Writer) (api.CollectResponse, error)
ParseCollectResponse parses a response from a `collect` call
func ParseHealthcheckResponse ¶
func ParseHealthcheckResponse(r io.ReadCloser) (api.HealthcheckResponse, error)
ParseHealthcheckResponse parses a response from a 'healthcheck' call
func ParseRunResponse ¶
func ParseRunResponse(r io.ReadCloser) (api.RunResponse, error)
ParseRunResponse parses a response from a `run` call
func ParseTerminateRequest ¶
func ParseTerminateRequest(r io.ReadCloser) error
ParseTerminateRequest parses a response from a 'terminate' call
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the API client that performs all operations against a Testground server.
func (*Client) Build ¶
func (c *Client) Build(ctx context.Context, r *api.BuildRequest, plandir string, sdkdir string) (io.ReadCloser, error)
Build sends a multipart `build` request to the daemon.
A build request comprises the following parts:
- Part 1 (Content-Type: application/json): composition json.
- Part 2 (Content-Type: application/zip): test plan source.
- Part 3 (optional, Content-Type: application/zip): linked sdk.
The Body in the response implements an io.ReadCloser and it's up to the caller to close it.
The response is a stream of `Msg` protocol messages. See `ParseBuildResponse()` for specifics.
func (*Client) CollectOutputs ¶
func (c *Client) CollectOutputs(ctx context.Context, r *api.OutputsRequest) (io.ReadCloser, error)
CollectOutputs sends a `collectOutputs` request to the daemon.
The Body in the response implement an io.ReadCloser and it's up to the caller to close it.
func (*Client) Healthcheck ¶
func (c *Client) Healthcheck(ctx context.Context, r *api.HealthcheckRequest) (io.ReadCloser, error)
Healthcheck sends a `healthcheck` request to the daemon.
func (*Client) Run ¶
func (c *Client) Run(ctx context.Context, r *api.RunRequest) (io.ReadCloser, error)
Run sends `run` request to the daemon. The Body in the response implement an io.ReadCloser and it's up to the caller to close it. The response is a stream of `Msg` protocol messages.
func (*Client) Terminate ¶
func (c *Client) Terminate(ctx context.Context, r *api.TerminateRequest) (io.ReadCloser, error)
Terminate sends a `terminate` request to the daemon.