apitesting

package
v0.124.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncResponse

type AsyncResponse struct {
	ContextIDs []string `json:"contextIds,omitempty"`
	EventIDs   []string `json:"eventIds,omitempty"`
	TaskID     string   `json:"taskId,omitempty"`
	TestIDs    []string `json:"testIds,omitempty"`
}

AsyncResponse describes the json response from the async api endpoints.

type Client

type Client struct {
	HTTPClient *http.Client
	URL        string
	Username   string
	AccessKey  string
}

Client describes an interface to the api-testing rest endpoints.

func New

func New(url string, username string, accessKey string, timeout time.Duration) Client

New returns a apitesting.Client

func (*Client) GetEventResult added in v0.115.0

func (c *Client) GetEventResult(ctx context.Context, hookID string, eventID string) (TestResult, error)

func (*Client) GetHooks added in v0.122.0

func (c *Client) GetHooks(ctx context.Context, projectID string) ([]Hook, error)

GetHooks returns the list of hooks available.

func (*Client) GetProject

func (c *Client) GetProject(ctx context.Context, hookID string) (Project, error)

GetProject returns Project metadata for a given hookID.

func (*Client) GetProjects added in v0.122.0

func (c *Client) GetProjects(ctx context.Context) ([]Project, error)

GetProjects returns the list of Project available.

func (*Client) GetTest added in v0.115.0

func (c *Client) GetTest(ctx context.Context, hookID string, testID string) (Test, error)

func (*Client) RunAllAsync

func (c *Client) RunAllAsync(ctx context.Context, hookID string, buildID string, tunnel config.Tunnel, test TestRequest) (AsyncResponse, error)

RunAllAsync runs all the tests for the project described by hookID and returns without waiting for their results.

func (*Client) RunEphemeralAsync added in v0.116.0

func (c *Client) RunEphemeralAsync(ctx context.Context, hookID string, buildID string, tunnel config.Tunnel, taskID string, test TestRequest) (AsyncResponse, error)

RunEphemeralAsync runs the tests for the project described by hookID and returns without waiting for their results.

func (*Client) RunTagAsync

func (c *Client) RunTagAsync(ctx context.Context, hookID string, testTag string, buildID string, tunnel config.Tunnel, test TestRequest) (AsyncResponse, error)

RunTagAsync runs all the tests for a testTag for a project described by hookID and returns without waiting for results.

func (*Client) RunTestAsync

func (c *Client) RunTestAsync(ctx context.Context, hookID string, testID string, buildID string, tunnel config.Tunnel, test TestRequest) (AsyncResponse, error)

RunTestAsync runs a single test described by testID for the project described by hookID and returns without waiting for results.

type Hook added in v0.122.0

type Hook struct {
	Identifier string `json:"identifier,omitempty"`
	Name       string `json:"name,omitempty"`
}

Hook describes the metadata for a hook.

type Project

type Project struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

Project describes the metadata for an api testing project.

type PublishedTest added in v0.115.0

type PublishedTest struct {
	Published Test
}

PublishedTest describes a published test.

type Test

type Test struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

Test describes a single test.

type TestRequest added in v0.116.0

type TestRequest struct {
	Name   string            `json:"name"`
	Tags   []string          `json:"tags"`
	Input  string            `json:"input"`
	Unit   string            `json:"unit"`
	Params map[string]string `json:"params"`
}

TestRequest represent a test to be executed

type TestResult

type TestResult struct {
	EventID              string  `json:"_id,omitempty"`
	FailuresCount        int     `json:"failuresCount,omitempty"`
	Project              Project `json:"project,omitempty"`
	Test                 Test    `json:"test,omitempty"`
	ExecutionTimeSeconds int     `json:"executionTimeSeconds,omitempty"`
	Async                bool    `json:"-"`
	TimedOut             bool    `json:"-"`
}

TestResult describes the result from running an api test.

Jump to

Keyboard shortcuts

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