runner

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResultTypeStatic   = "static"
	ResultTypeFile     = "file"
	ResultTypeRedirect = "redirect"
)
View Source
View Source
const (
	FileResultTypeJson = "json"
)
View Source
const VERSION = "0.1.0"

Variables

This section is empty.

Functions

func WrapGaosError

func WrapGaosError(cause error, message string) error

Types

type Action

type Action struct {
	Direct string `json:"direct"`
	Status int    `json:"status"`
	Result Result `json:"result"`
	// contains filtered or unexported fields
}

func (*Action) Execute

func (a *Action) Execute(ctx *fasthttp.RequestCtx) error

type Done

type Done <-chan bool

type Duration

type Duration struct {
	// contains filtered or unexported fields
}

func NewDuration

func NewDuration(s Scenario) *Duration

func (*Duration) Execute

func (d *Duration) Execute() (Done, error)

type Executable

type Executable func() (Done, error)

type FileResult

type FileResult struct {
	Path string `json:"path"`
	Type string `json:"type"`
}

type GaosError

type GaosError struct {
	Message string `json:"message"`
	Cause   error  `json:"cause"`
}

func (GaosError) Error

func (e GaosError) Error() string

type Latency

type Latency struct {
	// contains filtered or unexported fields
}

func NewLatency

func NewLatency(s Scenario) *Latency

func (*Latency) Execute

func (d *Latency) Execute() (Done, error)

type Limit

type Limit struct {
	// contains filtered or unexported fields
}

func NewLimit

func NewLimit(s Scenario) *Limit

func (*Limit) Execute

func (l *Limit) Execute() (Done, error)

type Method

type Method struct {
	Scenario
	// contains filtered or unexported fields
}

func (*Method) Execute

func (m *Method) Execute() (Action, []Done)

func (*Method) Handler

func (m *Method) Handler() fasthttp.RequestHandler

type Metrics added in v0.2.0

type Metrics struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*Metrics) GetEndpointCallCount added in v0.2.0

func (metrics *Metrics) GetEndpointCallCount(httpMethod, url string) int

type Path

type Path struct {
	Scenario string `json:"scenario"`
	Method   string `json:"method"`
}

type Rate

type Rate struct {
	// contains filtered or unexported fields
}

func NewRate

func NewRate(s Scenario) *Rate

func (*Rate) Execute

func (r *Rate) Execute() (Done, error)

type RedirectResult

type RedirectResult struct {
	Host string `json:"host"`
}

type Result

type Result struct {
	Type    string      `json:"type"`
	Content interface{} `json:"content"`
}

type Runner

type Runner struct {
	Service  map[string]*Service  `json:"service"`
	Scenario map[string]*Scenario `json:"scenario"`

	Metrics Metrics
	// contains filtered or unexported fields
}

func New

func New(path string) (*Runner, error)

func (*Runner) ErrorHandler

func (g *Runner) ErrorHandler(ctx *fasthttp.RequestCtx, cause error)

func (*Runner) Run

func (g *Runner) Run(services ...string)

type Scenario

type Scenario struct {
	Name     string `json:"name"`
	Duration string `json:"duration"`
	Latency  string `json:"latency"`
	Status   int    `json:"status"`
	Rate     int    `json:"rate"`
	Random   int    `json:"random"`
	Limit    int    `json:"limit"`
	Start    string `json:"start"`
	End      string `json:"end"`
	Accept   Action `json:"accept"`
	Ignore   Action `json:"ignore"`
	// contains filtered or unexported fields
}

type Service

type Service struct {
	Port int32           `json:"port"`
	Path map[string]Path `json:"path"`
}

type Span

type Span struct {
	// contains filtered or unexported fields
}

func NewSpan

func NewSpan(s Scenario) *Span

func (*Span) Execute

func (d *Span) Execute() (Done, error)

Jump to

Keyboard shortcuts

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