internal

package
v0.19.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidRequestType = fmt.Errorf("not a valid RequestType, try [%s]", strings.Join(_RequestTypeNames, ", "))
View Source
var ErrWalkError = errors.New("error walking directory")

Functions

func RequestTypeNames

func RequestTypeNames() []string

RequestTypeNames returns a list of possible string values of RequestType.

Types

type Assert added in v0.4.0

type Assert struct {
	JQ       string `yaml:"jq,omitempty"`
	Expected any    `yaml:"expected,omitempty"`
}

type Call

type Call struct {
	Name        string            `yaml:"name,omitempty"`
	Type        RequestType       `yaml:"type,omitempty"`
	Body        map[string]any    `yaml:"body,omitempty"`
	Headers     map[string]string `yaml:"headers,omitempty"`
	ServiceHost string            `yaml:"service-host,omitempty"`
	Url         string            `yaml:"url,omitempty"`
	Method      string            `yaml:"method,omitempty"`
	WantStatus  int               `yaml:"want-status,omitempty"`
	Exports     []Export          `yaml:"exports,omitempty"`
	Asserts     []Assert          `yaml:"asserts,omitempty"`
	Print       bool              `yaml:"print,omitempty"`
	SkipVerify  bool              `yaml:"skip-verify,omitempty"`
	FromImport  *ImportedCall     `yaml:"from-import,omitempty"`
}

func (*Call) GetType added in v0.7.0

func (c *Call) GetType() RequestType

type ExecuteResult added in v0.1.0

type ExecuteResult struct {
	StatusCode int
	Body       map[string]any
	Error      error
}

type Executor added in v0.1.0

type Executor interface {
	Execute(call Call) (*ExecuteResult, error)
}

type Export added in v0.4.0

type Export struct {
	JQ string `yaml:"jq,omitempty"`
	As string `yaml:"as,omitempty"`
}

type FSParser

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

func NewFSParser

func NewFSParser(opts FSParserOpts) *FSParser

func (*FSParser) Parse added in v0.3.0

func (f *FSParser) Parse(path string) (SequenceMap, error)

func (*FSParser) ParseSequences

func (f *FSParser) ParseSequences(root string) (SequenceMap, error)

func (*FSParser) ParseSingleSequence added in v0.2.1

func (f *FSParser) ParseSingleSequence(path string) (Sequence, error)

type FSParserOpts

type FSParserOpts struct {
	Logger zerolog.Logger
}

type GRPCExecutor added in v0.6.0

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

func NewGRPCExecutor added in v0.6.0

func NewGRPCExecutor(opts GRPCExecutorOpts) *GRPCExecutor

func (*GRPCExecutor) Execute added in v0.6.0

func (g *GRPCExecutor) Execute(call Call) (*ExecuteResult, error)

type GRPCExecutorOpts added in v0.6.0

type GRPCExecutorOpts struct {
	Logger zerolog.Logger
}

type HTTPExecutor added in v0.1.0

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

func NewHTTPExecutor added in v0.1.0

func NewHTTPExecutor(opts HTTPExecutorOpts) *HTTPExecutor

func (*HTTPExecutor) Execute added in v0.1.0

func (h *HTTPExecutor) Execute(call Call) (*ExecuteResult, error)

type HTTPExecutorOpts added in v0.1.0

type HTTPExecutorOpts struct {
	Logger zerolog.Logger
	Client IHttpClient
}

type HttpClient added in v0.19.0

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

func NewHttpClient added in v0.19.0

func NewHttpClient(conf HttpClientConfig) *HttpClient

func (*HttpClient) Do added in v0.19.0

func (h *HttpClient) Do(req *http.Request) (*http.Response, error)

func (*HttpClient) SetNoTLSVerify added in v0.19.0

func (h *HttpClient) SetNoTLSVerify()

func (*HttpClient) SetTimeout added in v0.19.0

func (h *HttpClient) SetTimeout(timeout time.Duration)

type HttpClientConfig added in v0.19.0

type HttpClientConfig struct {
	Logger zerolog.Logger
}

type IHttpClient added in v0.19.0

type IHttpClient interface {
	Do(req *http.Request) (*http.Response, error)
	SetNoTLSVerify()
	SetTimeout(timeout time.Duration)
}

type ImportedCall added in v0.18.0

type ImportedCall struct {
	Name string `yaml:"name"`
	Call string `yaml:"call"`
}

type MockExecutor added in v0.3.0

type MockExecutor struct {
	mock.Mock
}

MockExecutor is an autogenerated mock type for the Executor type

func NewMockExecutor added in v0.3.0

func NewMockExecutor(t mockConstructorTestingTNewMockExecutor) *MockExecutor

NewMockExecutor creates a new instance of MockExecutor. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockExecutor) EXPECT added in v0.3.0

func (_m *MockExecutor) EXPECT() *MockExecutor_Expecter

func (*MockExecutor) Execute added in v0.3.0

func (_m *MockExecutor) Execute(call Call) (*ExecuteResult, error)

Execute provides a mock function with given fields: call

type MockExecutor_Execute_Call added in v0.3.0

type MockExecutor_Execute_Call struct {
	*mock.Call
}

MockExecutor_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'

func (*MockExecutor_Execute_Call) Return added in v0.3.0

func (*MockExecutor_Execute_Call) Run added in v0.3.0

func (_c *MockExecutor_Execute_Call) Run(run func(call Call)) *MockExecutor_Execute_Call

func (*MockExecutor_Execute_Call) RunAndReturn added in v0.3.0

type MockExecutor_Expecter added in v0.3.0

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

func (*MockExecutor_Expecter) Execute added in v0.3.0

func (_e *MockExecutor_Expecter) Execute(call interface{}) *MockExecutor_Execute_Call

Execute is a helper method to define mock.On call

  • call Call

type MockIHttpClient added in v0.19.0

type MockIHttpClient struct {
	mock.Mock
}

MockIHttpClient is an autogenerated mock type for the IHttpClient type

func NewMockIHttpClient added in v0.19.0

func NewMockIHttpClient(t mockConstructorTestingTNewMockIHttpClient) *MockIHttpClient

NewMockIHttpClient creates a new instance of MockIHttpClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockIHttpClient) Do added in v0.19.0

func (_m *MockIHttpClient) Do(req *http.Request) (*http.Response, error)

Do provides a mock function with given fields: req

func (*MockIHttpClient) EXPECT added in v0.19.0

func (*MockIHttpClient) SetNoTLSVerify added in v0.19.0

func (_m *MockIHttpClient) SetNoTLSVerify()

SetNoTLSVerify provides a mock function with given fields:

func (*MockIHttpClient) SetTimeout added in v0.19.0

func (_m *MockIHttpClient) SetTimeout(timeout time.Duration)

SetTimeout provides a mock function with given fields: timeout

type MockIHttpClient_Do_Call added in v0.19.0

type MockIHttpClient_Do_Call struct {
	*mock.Call
}

MockIHttpClient_Do_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Do'

func (*MockIHttpClient_Do_Call) Return added in v0.19.0

func (*MockIHttpClient_Do_Call) Run added in v0.19.0

func (*MockIHttpClient_Do_Call) RunAndReturn added in v0.19.0

type MockIHttpClient_Expecter added in v0.19.0

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

func (*MockIHttpClient_Expecter) Do added in v0.19.0

func (_e *MockIHttpClient_Expecter) Do(req interface{}) *MockIHttpClient_Do_Call

Do is a helper method to define mock.On call

  • req *http.Request

func (*MockIHttpClient_Expecter) SetNoTLSVerify added in v0.19.0

SetNoTLSVerify is a helper method to define mock.On call

func (*MockIHttpClient_Expecter) SetTimeout added in v0.19.0

func (_e *MockIHttpClient_Expecter) SetTimeout(timeout interface{}) *MockIHttpClient_SetTimeout_Call

SetTimeout is a helper method to define mock.On call

  • timeout time.Duration

type MockIHttpClient_SetNoTLSVerify_Call added in v0.19.0

type MockIHttpClient_SetNoTLSVerify_Call struct {
	*mock.Call
}

MockIHttpClient_SetNoTLSVerify_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetNoTLSVerify'

func (*MockIHttpClient_SetNoTLSVerify_Call) Return added in v0.19.0

func (*MockIHttpClient_SetNoTLSVerify_Call) Run added in v0.19.0

func (*MockIHttpClient_SetNoTLSVerify_Call) RunAndReturn added in v0.19.0

type MockIHttpClient_SetTimeout_Call added in v0.19.0

type MockIHttpClient_SetTimeout_Call struct {
	*mock.Call
}

MockIHttpClient_SetTimeout_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetTimeout'

func (*MockIHttpClient_SetTimeout_Call) Return added in v0.19.0

func (*MockIHttpClient_SetTimeout_Call) Run added in v0.19.0

func (*MockIHttpClient_SetTimeout_Call) RunAndReturn added in v0.19.0

type MockParser added in v0.3.0

type MockParser struct {
	mock.Mock
}

MockParser is an autogenerated mock type for the Parser type

func NewMockParser added in v0.3.0

func NewMockParser(t mockConstructorTestingTNewMockParser) *MockParser

NewMockParser creates a new instance of MockParser. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockParser) EXPECT added in v0.3.0

func (_m *MockParser) EXPECT() *MockParser_Expecter

func (*MockParser) Parse added in v0.3.0

func (_m *MockParser) Parse(path string) (SequenceMap, error)

Parse provides a mock function with given fields: path

func (*MockParser) ParseSingleSequence added in v0.18.0

func (_m *MockParser) ParseSingleSequence(path string) (Sequence, error)

ParseSingleSequence provides a mock function with given fields: path

type MockParser_Expecter added in v0.3.0

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

func (*MockParser_Expecter) Parse added in v0.3.0

func (_e *MockParser_Expecter) Parse(path interface{}) *MockParser_Parse_Call

Parse is a helper method to define mock.On call

  • path string

func (*MockParser_Expecter) ParseSingleSequence added in v0.18.0

func (_e *MockParser_Expecter) ParseSingleSequence(path interface{}) *MockParser_ParseSingleSequence_Call

ParseSingleSequence is a helper method to define mock.On call

  • path string

type MockParser_ParseSingleSequence_Call added in v0.18.0

type MockParser_ParseSingleSequence_Call struct {
	*mock.Call
}

MockParser_ParseSingleSequence_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ParseSingleSequence'

func (*MockParser_ParseSingleSequence_Call) Return added in v0.18.0

func (*MockParser_ParseSingleSequence_Call) Run added in v0.18.0

func (*MockParser_ParseSingleSequence_Call) RunAndReturn added in v0.18.0

type MockParser_Parse_Call added in v0.3.0

type MockParser_Parse_Call struct {
	*mock.Call
}

MockParser_Parse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Parse'

func (*MockParser_Parse_Call) Return added in v0.3.0

func (*MockParser_Parse_Call) Run added in v0.3.0

func (_c *MockParser_Parse_Call) Run(run func(path string)) *MockParser_Parse_Call

func (*MockParser_Parse_Call) RunAndReturn added in v0.3.0

func (_c *MockParser_Parse_Call) RunAndReturn(run func(string) (SequenceMap, error)) *MockParser_Parse_Call

type Parser

type Parser interface {
	Parse(path string) (SequenceMap, error)
	ParseSingleSequence(path string) (Sequence, error)
}

type RequestType

type RequestType string

ENUM( http grpc )

const (
	// RequestTypeHttp is a RequestType of type http.
	RequestTypeHttp RequestType = "http"
	// RequestTypeGrpc is a RequestType of type grpc.
	RequestTypeGrpc RequestType = "grpc"
)

func ParseRequestType

func ParseRequestType(name string) (RequestType, error)

ParseRequestType attempts to convert a string to a RequestType.

func (RequestType) IsValid

func (x RequestType) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (RequestType) MarshalText

func (x RequestType) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (RequestType) String

func (x RequestType) String() string

String implements the Stringer interface.

func (*RequestType) UnmarshalText

func (x *RequestType) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type Runner added in v0.1.0

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

func NewRunner added in v0.1.0

func NewRunner(opts RunnerOpts) *Runner

func (*Runner) Run added in v0.3.0

func (r *Runner) Run(path string) error

type RunnerOpts added in v0.1.0

type RunnerOpts struct {
	Logger       zerolog.Logger
	HttpExecutor Executor
	GrpcExecutor Executor
	Parser       Parser
	Output       io.Writer
	FailFast     bool
}

type Sequence

type Sequence struct {
	Vars    map[string]any    `yaml:"vars"`
	Imports map[string]string `yaml:"imports"`
	Calls   []Call            `yaml:"calls"`
	// contains filtered or unexported fields
}

type SequenceMap added in v0.3.0

type SequenceMap map[string]Sequence

Jump to

Keyboard shortcuts

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