Documentation ¶
Overview ¶
Package types defines types used by aloe TODO(liubog2008): split runtime object types and static config object types
Index ¶
Constants ¶
const (
// ContextFile defines default filename of spec
ContextFile = "context.yaml"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Case ¶
type Case struct { // Summary describes the test case Summary string `json:"summary,omitempty"` // Labels defines case labels for selector Labels []string `json:"labels,omitempty"` // Flow defines test flow of a test case Flow []RoundTrip `json:"flow,omitempty"` }
Case defines a test case
type CleanerConfig ¶
type CleanerConfig struct { // Name defines name of cleaner Name string `json:"name"` // ForEach defines whether cleaner will clean context for each cases ForEach bool `json:"forEach"` // Args defines cleaner args Args map[string]Template `json:"args,omitempty"` }
CleanerConfig defines config of cleaner
type Context ¶
type Context struct { // Summary used to display message in // ginkgo.Describe or ginkgo.Context Summary string `json:"summary"` // Presetters preset some common fields of round-trip in context Presetters []PresetConfig `json:"presetters,omitempty"` // Flow will be called to construct context Flow []RoundTrip `json:"flow,omitempty"` // Exports defines variables which can be access by children Exports []Var `json:"exports,omitempty"` // Cleaners defines cleaner of the context Cleaners []CleanerConfig `json:"cleaners,omitempty"` }
Context defines some configs for ginkgo.Describe or ginkgo.Context
type Definition ¶
type Definition struct { Var `json:",inline"` // Type defines variable from // enum ["body", "status", "header"] // default is body Type string `json:"type,omitempty"` }
Definition defines new variable from response
type Duration ¶
Duration defines duration can be unmarshal from json
func (*Duration) MarshalJSON ¶
MarshalJSON implements json.Marshaler
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON implements json.Marshaler
type Eventually ¶
type Eventually struct { // Timeout defines deadline of checking Timeout *Duration `json:"timeout,omitempty"` // Interval defines interval of polling and checking // Default interval is 1 second Interval *Duration `json:"interval,omitempty"` }
Eventually defines config for eventually
type PresetConfig ¶
type PresetConfig struct { // Name defines name of presetter Name string `json:"name"` // Args defines preset args Args map[string]Template `json:"args,omitempty"` }
PresetConfig defines config of presetter
type Request ¶
type Request struct { // Host defines request host Host *Template `json:"host"` // Scheme defines request scheme // Default is http Scheme *Template `json:"scheme"` // API is a http verb + http path // e.g GET /api/v1/users API *Template `json:"api"` // Headers defines http header of request // NOTE(liubog2008): whether to use map[string][]string Headers map[string]Template `json:"headers,omitempty"` // Body defines a template with variable Body *Template `json:"body,omitempty"` }
Request defines a part template of http request
type Response ¶
type Response struct { // StatusCode checks response code StatusCode int `json:"statusCode"` // Headers defines http header of request // NOTE(liubog2008): whether to use map[string][]string Headers map[string]Template `json:"headers,omitempty"` // Body is also a template like request body // It can be used to generate a matcher which // can test response body Body *Template `json:"body,omitempty"` // Eventually defines an async checker for response // It means response will eventually be matched Eventually *Eventually `json:"eventually,omitempty"` }
Response defines a http response checker
type RoundTrip ¶
type RoundTrip struct { // Description describe the round trip Description string `json:"description,omitempty"` // Client defines http client used by this roundtrip // if it's empty, default client will be used Client string `json:"client,omitempty"` // Loop defines RoundTrip loop times // If it is > 1 , an iterator variable will be defined // and all definitions will be defined as an array Loop int `json:"loop,omitempty"` // When defines when round trip will run When *When `json:"when,omitempty"` // Request defines a http request template Request Request `json:"request,omitempty"` // Response defines a http response checker Response Response `json:"response,omitempty"` // Definitions defines new variables from response Definitions []Definition `json:"definitions,omitempty"` }
RoundTrip defines a test case It usually means one http request and response
type Template ¶
Template is used to get template from json
func (*Template) MarshalJSON ¶
MarshalJSON implements json.Marshaler
func (*Template) UnmarshalJSON ¶
UnmarshalJSON implements json.Marshaler