Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Kind represents the type definition of this config. Kind = "apitest" // APIVersion represents the supported config version. APIVersion = "v1alpha" )
Config descriptors.
Functions ¶
func FilterSuites ¶ added in v0.117.0
FilterSuites filters out suites in the project that don't match the given suite name.
func SetDefaults ¶
func SetDefaults(p *Project)
SetDefaults applies config defaults in case the user has left them blank.
Types ¶
type APITester ¶ added in v0.124.1
type APITester interface { GetProject(ctx context.Context, hookID string) (ProjectMeta, error) GetEventResult(ctx context.Context, hookID string, eventID string) (TestResult, error) GetTest(ctx context.Context, hookID string, testID string) (Test, error) GetProjects(ctx context.Context) ([]ProjectMeta, error) GetHooks(ctx context.Context, projectID string) ([]Hook, error) RunAllAsync(ctx context.Context, hookID string, buildID string, tunnel config.Tunnel, test TestRequest) (AsyncResponse, error) RunEphemeralAsync(ctx context.Context, hookID string, buildID string, tunnel config.Tunnel, taskID string, test TestRequest) (AsyncResponse, error) RunTestAsync(ctx context.Context, hookID string, testID string, buildID string, tunnel config.Tunnel, test TestRequest) (AsyncResponse, error) RunTagAsync(ctx context.Context, hookID string, testTag string, buildID string, tunnel config.Tunnel, test TestRequest) (AsyncResponse, error) }
type AsyncResponse ¶ added in v0.124.1
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 Hook ¶ added in v0.124.1
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 { config.TypeDef `yaml:",inline" mapstructure:",squash"` ConfigFilePath string `yaml:"-" json:"-"` Suites []Suite `yaml:"suites,omitempty"` Sauce config.SauceConfig `yaml:"sauce,omitempty"` RootDir string `yaml:"rootDir,omitempty"` Env map[string]string `yaml:"env,omitempty"` }
Project represents the apitest project configuration.
type ProjectMeta ¶ added in v0.124.1
ProjectMeta describes the metadata for an api testing project.
type Runner ¶
type Runner struct { Project Project Client APITester Region region.Region Reporters []report.Reporter Async bool TunnelService tunnel.Service }
Runner represents an executor for api tests
func (*Runner) ResolveHookIDs ¶ added in v0.122.0
ResolveHookIDs resolve, for each suite, the matching hookID.
func (*Runner) RunProject ¶
RunProject runs the tests defined in apitest.Project
type Suite ¶
type Suite struct { Timeout time.Duration `yaml:"timeout,omitempty"` Name string `yaml:"name,omitempty"` ProjectName string `yaml:"projectName,omitempty"` UseRemoteTests bool `yaml:"useRemoteTests,omitempty"` Tests []string `yaml:"tests,omitempty"` Tags []string `yaml:"tags,omitempty"` TestMatch []string `yaml:"testMatch,omitempty"` Env map[string]string `yaml:"env,omitempty"` // HookID is a technical ID unique to a project that's required by the APIs // that execute API tests. The HookID is retrieved dynamically based on // ProjectName before calling those endpoints. HookID string `yaml:"-"` // ProjectID is a technical ID unique to a project that's required by the // APIs that execute API tests. The ProjectID is retrieved dynamically based // on ProjectName before calling those endpoints. ProjectID string `yaml:"-"` }
Suite represents the apitest suite configuration.
type TestRequest ¶ added in v0.124.1
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 ¶ added in v0.124.1
type TestResult struct { EventID string `json:"_id,omitempty"` FailuresCount int `json:"failuresCount,omitempty"` Project ProjectMeta `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.