test

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FTWTest

type FTWTest struct {
	FileName string
	Meta     struct {
		Author      string `yaml:"author,omitempty"`
		Enabled     bool   `yaml:"enabled,omitempty"`
		Name        string `yaml:"name,omitempty"`
		Description string `yaml:"description,omitempty"`
	} `yaml:"meta"`
	Tests []Test `yaml:"tests"`
}

FTWTest is the base type used when unmarshaling

func GetTestFromYaml

func GetTestFromYaml(testYaml []byte) (ftwTest FTWTest, err error)

GetTestFromYaml will get the tests to be processed from a YAML string.

func GetTestsFromFiles

func GetTestsFromFiles(globPattern string) ([]FTWTest, error)

GetTestsFromFiles will get the files to be processed. If some file has yaml error, will stop processing and return the error with the partial list of files read.

func (*FTWTest) GetLinesFromTest

func (f *FTWTest) GetLinesFromTest(testName string) (int, error)

GetLinesFromTest get the output lines from a test name, to show in errors

type Input

type Input struct {
	DestAddr       *string        `yaml:"dest_addr,omitempty" koanf:"dest_addr,omitempty"`
	Port           *int           `yaml:"port,omitempty" koanf:"port,omitempty"`
	Protocol       *string        `yaml:"protocol,omitempty" koanf:"protocol,omitempty"`
	URI            *string        `yaml:"uri,omitempty" koanf:"uri,omitempty"`
	Version        *string        `yaml:"version,omitempty" koanf:"version,omitempty"`
	Headers        ftwhttp.Header `yaml:"headers,omitempty" koanf:"headers,omitempty"`
	Method         *string        `yaml:"method,omitempty" koanf:"method,omitempty"`
	Data           *string        `yaml:"data,omitempty" koanf:"data,omitempty"`
	SaveCookie     bool           `yaml:"save_cookie,omitempty" koanf:"save_cookie,omitempty"`
	StopMagic      bool           `yaml:"stop_magic" koanf:"stop_magic,omitempty"`
	EncodedRequest string         `yaml:"encoded_request,omitempty" koanf:"encoded_request,omitempty"`
	RAWRequest     string         `yaml:"raw_request,omitempty" koanf:"raw_request,omitempty"`
}

Input represents the input request in a stage The fields `Version`, `Method` and `URI` we want to explicitly now when they are set to ""

func (*Input) GetDestAddr

func (i *Input) GetDestAddr() string

GetDestAddr returns the proper semantic when the field is empty

func (*Input) GetMethod

func (i *Input) GetMethod() string

GetMethod returns the proper semantic when the field is empty

func (*Input) GetPort

func (i *Input) GetPort() int

GetPort returns the proper semantic when the field is empty

func (*Input) GetProtocol

func (i *Input) GetProtocol() string

GetProtocol returns the proper semantic when the field is empty

func (*Input) GetRawRequest

func (i *Input) GetRawRequest() ([]byte, error)

GetRawRequest returns the proper raw data, and error if there was none

func (*Input) GetURI

func (i *Input) GetURI() string

GetURI returns the proper semantic when the field is empty

func (*Input) GetVersion

func (i *Input) GetVersion() string

GetVersion returns the proper semantic when the field is empty

func (*Input) ParseData

func (i *Input) ParseData() []byte

ParseData returns the data from the test. Will parse and interpret Go text/template inside it.

type Output

type Output struct {
	Status           []int  `yaml:"status,flow,omitempty"`
	ResponseContains string `yaml:"response_contains,omitempty"`
	LogContains      string `yaml:"log_contains,omitempty"`
	NoLogContains    string `yaml:"no_log_contains,omitempty"`
	ExpectError      bool   `yaml:"expect_error,omitempty"`
}

Output is the response expected from the test

type Stage

type Stage struct {
	Input  Input  `yaml:"input"`
	Output Output `yaml:"output"`
}

Stage is an individual test stage

type Test

type Test struct {
	TestTitle       string `yaml:"test_title"`
	TestDescription string `yaml:"desc,omitempty"`
	Stages          []struct {
		Stage Stage `yaml:"stage"`
	} `yaml:"stages"`
}

Test is an individual test

Jump to

Keyboard shortcuts

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