schema

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package schema provides the test scenario data schema for scenarigo.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bind

type Bind struct {
	Vars map[string]interface{} `yaml:"vars"`
}

Bind represents bindings of variables.

type Expect

type Expect struct {
	protocol.AssertionBuilder
	// contains filtered or unexported fields
}

Expect represents a expect response.

func (*Expect) Build

func (e *Expect) Build(ctx *context.Context) (assert.Assertion, error)

Build builds the assertion which asserts the response.

func (*Expect) UnmarshalYAML

func (e *Expect) UnmarshalYAML(bytes []byte) error

UnmarshalYAML implements yaml.Unmarshaler interface.

type Request

type Request struct {
	protocol.Invoker
	// contains filtered or unexported fields
}

Request represents a request.

func (*Request) Invoke

func (r *Request) Invoke(ctx *context.Context) (*context.Context, interface{}, error)

Invoke sends the request.

func (*Request) UnmarshalYAML

func (r *Request) UnmarshalYAML(bytes []byte) error

UnmarshalYAML implements yaml.Unmarshaler interface.

type RetryPolicy

type RetryPolicy struct {
	Constant    *RetryPolicyConstant    `yaml:"constant"`
	Exponential *RetryPolicyExponential `yaml:"exponential"`
}

RetryPolicy represents a retry policy.

func (*RetryPolicy) Build

func (p *RetryPolicy) Build() (backoff.Policy, error)

Build returns p as backoff.Policy. If p is nil, Build returns the policy which never retry.

type RetryPolicyConstant

type RetryPolicyConstant struct {
	Interval       string  `yaml:"interval"`
	MaxElapsedTime *string `yaml:"maxElapsedTime"`
	MaxRetries     *int    `yaml:"maxRetries"`
}

RetryPolicyConstant represents a constant retry policy.

func (*RetryPolicyConstant) Build

func (p *RetryPolicyConstant) Build() (backoff.Policy, error)

Build returns p as backoff.Policy.

type RetryPolicyExponential

type RetryPolicyExponential struct {
	InitialInterval *string  `yaml:"initialInterval"`
	Factor          *float64 `yaml:"factor"`
	JitterFactor    *float64 `yaml:"jitterFactor"`
	MaxInterval     *string  `yaml:"maxInterval"`
	MaxElapsedTime  *string  `yaml:"maxElapsedTime"`
	MaxRetries      *int     `yaml:"maxRetries"`
}

RetryPolicyExponential represents a exponential retry policy.

func (*RetryPolicyExponential) Build

Build returns p as backoff.Policy.

type Scenario

type Scenario struct {
	Title       string                 `yaml:"title"`
	Description string                 `yaml:"description"`
	Plugins     map[string]string      `yaml:"plugins"`
	Vars        map[string]interface{} `yaml:"vars"`
	Steps       []*Step                `yaml:"steps"`

	// The strict YAML decoder fails to decode if finds an unknown field.
	// Anchors is the field for enabling to define YAML anchors by avoiding the error.
	// This field doesn't need to hold some data because anchors expand by the decoder.
	Anchors anchors `yaml:"anchors"`
	// contains filtered or unexported fields
}

Scenario represents a test scenario.

func LoadScenarios

func LoadScenarios(path string) ([]*Scenario, error)

LoadScenarios loads test scenarios from path.

func (*Scenario) Filepath

func (s *Scenario) Filepath() string

Filepath returns YAML filepath of s.

type Step

type Step struct {
	Title       string                 `yaml:"title"`
	Description string                 `yaml:"description"`
	Vars        map[string]interface{} `yaml:"vars"`
	Protocol    string                 `yaml:"protocol"`
	Request     Request                `yaml:"request"`
	Expect      Expect                 `yaml:"expect"`
	Include     string                 `yaml:"include"`
	Ref         string                 `yaml:"ref"`
	Bind        Bind                   `yaml:"bind"`
	Retry       *RetryPolicy           `yaml:"retry"`
}

Step represents a step of scenario.

func (*Step) UnmarshalYAML

func (s *Step) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler interface.

Jump to

Keyboard shortcuts

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