Documentation ¶
Overview ¶
Package api provides an API client for the Test Plan API.
Index ¶
- Variables
- type BillingError
- type Client
- func (c Client) CreateTestPlan(ctx context.Context, suiteSlug string, params TestPlanParams) (plan.TestPlan, error)
- func (c *Client) DoWithRetry(ctx context.Context, reqOptions httpRequest, v interface{}) (*http.Response, error)
- func (c Client) FetchFilesTiming(ctx context.Context, suiteSlug string, files []string) (map[string]time.Duration, error)
- func (c Client) FetchTestPlan(ctx context.Context, suiteSlug string, identifier string, jobRetryCount int) (*plan.TestPlan, error)
- func (c Client) FilterTests(ctx context.Context, suiteSlug string, params FilterTestsParams) ([]FilteredTest, error)
- func (c Client) PostTestPlanMetadata(ctx context.Context, suiteSlug string, identifier string, ...) error
- type ClientConfig
- type FilterTestsParams
- type FilteredTest
- type TestPlanMetadataParams
- type TestPlanParams
- type TestPlanParamsTest
- type Timeline
Constants ¶
This section is empty.
Variables ¶
var ErrRetryTimeout = errors.New("request retry timeout")
Functions ¶
This section is empty.
Types ¶
type BillingError ¶
type BillingError struct {
Message string
}
func (*BillingError) Error ¶
func (e *BillingError) Error() string
type Client ¶
type Client struct { OrganizationSlug string ServerBaseUrl string // contains filtered or unexported fields }
client is a client for the test plan API. It contains the organization slug, server base URL, and an HTTP client.
func NewClient ¶
func NewClient(cfg ClientConfig) *Client
NewClient creates a new client for the test plan API with the given configuration. It also creates an HTTP client with an authTransport middleware.
func (Client) CreateTestPlan ¶
func (c Client) CreateTestPlan(ctx context.Context, suiteSlug string, params TestPlanParams) (plan.TestPlan, error)
CreateTestPlan creates a test plan from the server. ErrRetryTimeout is returned if the client failed to communicate with the server after exceeding the retry limit.
func (*Client) DoWithRetry ¶
func (c *Client) DoWithRetry(ctx context.Context, reqOptions httpRequest, v interface{}) (*http.Response, error)
DoWithRetry sends http request with retries. Successful API response (status code 200) is JSON decoded and stored in the value pointed to by v. The request will be retried when the server returns 429 or 5xx status code, or when there is a network error. After reaching the retry timeout, the function will return ErrRetryTimeout. The request will not be retried when the server returns 4xx status code, and the error message will be returned as an error.
func (Client) FetchFilesTiming ¶
func (c Client) FetchFilesTiming(ctx context.Context, suiteSlug string, files []string) (map[string]time.Duration, error)
FetchFilesTiming fetches the timing of the requested files from the server. The server only returns timings for the files that has been run before. ErrRetryTimeout is returned if the client failed to communicate with the server after exceeding the retry limit.
func (Client) FetchTestPlan ¶
func (c Client) FetchTestPlan(ctx context.Context, suiteSlug string, identifier string, jobRetryCount int) (*plan.TestPlan, error)
FetchTestPlan fetchs a test plan from the server. ErrRetryTimeout is returned if the client failed to communicate with the server after exceeding the retry limit.
func (Client) FilterTests ¶
func (c Client) FilterTests(ctx context.Context, suiteSlug string, params FilterTestsParams) ([]FilteredTest, error)
FilterTests filters tests from the server. It returns a list of tests that need to be split by example. Currently, it only filters tests that are slow.
func (Client) PostTestPlanMetadata ¶
type ClientConfig ¶
type ClientConfig struct { AccessToken string OrganizationSlug string ServerBaseUrl string Version string }
ClientConfig is the configuration for the test plan API client.
type FilterTestsParams ¶
type FilteredTest ¶
type FilteredTest struct {
Path string `json:"path"`
}
type TestPlanMetadataParams ¶
type TestPlanParams ¶
type TestPlanParams struct { Runner string `json:"runner"` Identifier string `json:"identifier"` Parallelism int `json:"parallelism"` Branch string `json:"branch"` Tests TestPlanParamsTest `json:"tests"` }
TestPlanParams represents the config params sent when fetching a test plan.