client

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 29, 2020 License: Apache-2.0, MIT Imports: 21 Imported by: 1

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

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 New

func New(cfg *config.EnvConfig) *Client

New initializes a new API client

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) Close

func (c *Client) Close() error

Close the transport used by the client

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.

Jump to

Keyboard shortcuts

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