Documentation ¶
Overview ¶
Package runner responsible for excute the test case
Package runner provides the common expr style functions
Index ¶
- Variables
- func DeepCopy(src, dist interface{}) (err error)
- func ExprFuncHTTPReady(params ...interface{}) (res interface{}, err error)
- func ExprFuncSleep(params ...interface{}) (res interface{}, err error)
- func IsJSONCompatileType(contentType string) bool
- func RegisterRunner(kind string, runner RunnerCreator) error
- func Verify(expect testing.Response, data map[string]any) (err error)
- type BodyGetter
- type BodyVerifier
- type ContextKey
- type FormatPrinter
- type GithubPRCommentOption
- type LevelWriter
- type LogLevel
- type Mutator
- type ReportRecord
- type ReportResult
- type ReportResultSlice
- type ReportResultWithTotal
- type ReportResultWriter
- func NewDiscardResultWriter() ReportResultWriter
- func NewGRPCResultWriter(ctx context.Context, url string) ReportResultWriter
- func NewGithubPRCommentWriter(opt *GithubPRCommentOption) (ReportResultWriter, error)
- func NewHTMLResultWriter(writer io.Writer) ReportResultWriter
- func NewHTTPResultWriter(requestType string, url string, parameters map[string]string, ...) ReportResultWriter
- func NewJSONResultWriter(writer io.Writer) ReportResultWriter
- func NewMarkdownResultWriter(writer io.Writer) ReportResultWriter
- func NewPDFResultWriter(writer io.Writer) ReportResultWriter
- func NewResultWriter(writer io.Writer) ReportResultWriter
- type ResourceUsage
- type ResponseRecord
- type RunnerCreator
- type SimpleResponse
- type TemplateOption
- type TestCaseRunner
- func GetTestSuiteRunner(suite *testing.TestSuite) TestCaseRunner
- func NewGRPCTestCaseRunner(host string, proto testing.RPCDesc) TestCaseRunner
- func NewGraphQLRunner(parent TestCaseRunner) TestCaseRunner
- func NewReverseHTTPRunner(normal TestCaseRunner) TestCaseRunner
- func NewSimpleTestCaseRunner() TestCaseRunner
- type TestReporter
- type UnimplementedRunner
- func (r *UnimplementedRunner) GetSuggestedAPIs(suite *testing.TestSuite, api string) (result []*testing.TestCase, err error)
- func (r *UnimplementedRunner) RunTestCase(testcase *testing.TestCase, dataContext interface{}, ctx context.Context) (output interface{}, err error)
- func (r *UnimplementedRunner) WithAPISuggestLimit(int)
- func (r *UnimplementedRunner) WithExecer(execer fakeruntime.Execer)
- func (r *UnimplementedRunner) WithOutputWriter(writer io.Writer)
- func (r *UnimplementedRunner) WithSecure(secure *testing.Secure)
- func (s *UnimplementedRunner) WithSuite(suite *testing.TestSuite)
- func (r *UnimplementedRunner) WithTestReporter(reporter TestReporter)
- func (r *UnimplementedRunner) WithWriteLevel(level string)
Constants ¶
This section is empty.
Variables ¶
var RunnersNum = promauto.NewGauge(prometheus.GaugeOpts{
Name: "atest_runners_count",
Help: "The total number of runners",
})
Functions ¶
func ExprFuncHTTPReady ¶ added in v0.0.14
func ExprFuncHTTPReady(params ...interface{}) (res interface{}, err error)
ExprFuncHTTPReady is an expr function for reading status from a HTTP server
func ExprFuncSleep ¶ added in v0.0.12
func ExprFuncSleep(params ...interface{}) (res interface{}, err error)
ExprFuncSleep is an expr function for sleeping
func IsJSONCompatileType ¶ added in v0.0.18
func RegisterRunner ¶ added in v0.0.16
func RegisterRunner(kind string, runner RunnerCreator) error
Types ¶
type BodyGetter ¶ added in v0.0.15
type BodyVerifier ¶ added in v0.0.15
func NewBodyVerify ¶ added in v0.0.15
func NewBodyVerify(contentType string, body BodyGetter) BodyVerifier
type ContextKey ¶ added in v0.0.12
type ContextKey string
ContextKey is the alias type of string for context key
func NewContextKeyBuilder ¶ added in v0.0.12
func NewContextKeyBuilder() ContextKey
NewContextKeyBuilder returns an emtpy context key
func (ContextKey) GetContextValueOrEmpty ¶ added in v0.0.12
func (c ContextKey) GetContextValueOrEmpty(ctx context.Context) string
GetContextValueOrEmpty returns the value of the context key, if not exist, return empty string
func (ContextKey) ParentDir ¶ added in v0.0.12
func (c ContextKey) ParentDir() ContextKey
ParentDir returns the key of the parsent directory
type FormatPrinter ¶ added in v0.0.9
type FormatPrinter interface {
Fprintf(w io.Writer, level, format string, a ...any) (n int, err error)
}
FormatPrinter represents a formart printer with level
type GithubPRCommentOption ¶ added in v0.0.15
type LevelWriter ¶ added in v0.0.9
type LevelWriter interface { Info(format string, a ...any) Debug(format string, a ...any) Trace(format string, a ...any) }
LevelWriter represents a writer with level
func NewDefaultLevelWriter ¶ added in v0.0.9
func NewDefaultLevelWriter(level string, writer io.Writer) LevelWriter
NewDefaultLevelWriter creates a default LevelWriter instance
type ReportRecord ¶ added in v0.0.4
type ReportRecord struct { Group string Name string Method string API string Body string BeginTime time.Time EndTime time.Time Error error }
ReportRecord represents the raw data of a request
func NewReportRecord ¶ added in v0.0.4
func NewReportRecord() *ReportRecord
NewReportRecord creates a record, and set the begin time to be now
func (*ReportRecord) Duration ¶ added in v0.0.4
func (r *ReportRecord) Duration() time.Duration
Duration returns the duration between begin and end time
func (*ReportRecord) ErrorCount ¶ added in v0.0.4
func (r *ReportRecord) ErrorCount() int
ErrorCount returns the count number of errors
func (*ReportRecord) GetErrorMessage ¶ added in v0.0.12
func (r *ReportRecord) GetErrorMessage() string
GetErrorMessage returns the error message
type ReportResult ¶ added in v0.0.4
type ReportResult struct { Name string API string Count int Average time.Duration Max time.Duration Min time.Duration QPS int Error int LastErrorMessage string }
ReportResult represents the report result of a set of the same API requests
type ReportResultSlice ¶ added in v0.0.4
type ReportResultSlice []ReportResult
ReportResultSlice is the alias type of ReportResult slice
func (ReportResultSlice) Len ¶ added in v0.0.4
func (r ReportResultSlice) Len() int
Len returns the count of slice items
func (ReportResultSlice) Less ¶ added in v0.0.4
func (r ReportResultSlice) Less(i, j int) bool
Less returns if i bigger than j
func (ReportResultSlice) Swap ¶ added in v0.0.4
func (r ReportResultSlice) Swap(i, j int)
Swap swaps the items
type ReportResultWithTotal ¶ added in v0.0.4
type ReportResultWithTotal struct { ReportResult Total time.Duration First time.Time Last time.Time }
ReportResultWithTotal holds the total duration base on ReportResult
type ReportResultWriter ¶ added in v0.0.4
type ReportResultWriter interface { Output([]ReportResult) error WithAPIConverage(apiConverage apispec.APIConverage) ReportResultWriter WithResourceUsage([]ResourceUsage) ReportResultWriter }
ReportResultWriter is the interface of the report writer
func NewDiscardResultWriter ¶ added in v0.0.4
func NewDiscardResultWriter() ReportResultWriter
NewDiscardResultWriter creates a report result writer which discard everything
func NewGRPCResultWriter ¶ added in v0.0.17
func NewGRPCResultWriter(ctx context.Context, url string) ReportResultWriter
NewGRPCResultWriter creates a new grpcResultWriter
func NewGithubPRCommentWriter ¶ added in v0.0.15
func NewGithubPRCommentWriter(opt *GithubPRCommentOption) (ReportResultWriter, error)
func NewHTMLResultWriter ¶ added in v0.0.12
func NewHTMLResultWriter(writer io.Writer) ReportResultWriter
NewHTMLResultWriter creates a new htmlResultWriter
func NewHTTPResultWriter ¶ added in v0.0.17
func NewHTTPResultWriter(requestType string, url string, parameters map[string]string, templateFile *TemplateOption) ReportResultWriter
NewHTTPResultWriter creates a new httpResultWriter
func NewJSONResultWriter ¶ added in v0.0.13
func NewJSONResultWriter(writer io.Writer) ReportResultWriter
NewJSONResultWriter creates a new jsonResultWriter
func NewMarkdownResultWriter ¶ added in v0.0.4
func NewMarkdownResultWriter(writer io.Writer) ReportResultWriter
NewMarkdownResultWriter creates the Markdown writer
func NewPDFResultWriter ¶ added in v0.0.13
func NewPDFResultWriter(writer io.Writer) ReportResultWriter
NewPDFResultWriter creates a new PDFResultWriter
func NewResultWriter ¶ added in v0.0.4
func NewResultWriter(writer io.Writer) ReportResultWriter
NewResultWriter creates a result writer with the specific io.Writer
type ResourceUsage ¶ added in v0.0.15
type ResponseRecord ¶ added in v0.0.14
type ResponseRecord interface {
GetResponseRecord() SimpleResponse
}
HTTPResponseRecord represents a http response record
type RunnerCreator ¶ added in v0.0.16
type RunnerCreator func(suite *testing.TestSuite) TestCaseRunner
type SimpleResponse ¶ added in v0.0.13
SimpleResponse represents a simple response
type TemplateOption ¶ added in v0.0.17
type TemplateOption struct {
// contains filtered or unexported fields
}
func NewTemplateOption ¶ added in v0.0.17
func NewTemplateOption(filename string, fileType string) *TemplateOption
type TestCaseRunner ¶ added in v0.0.4
type TestCaseRunner interface { RunTestCase(testcase *testing.TestCase, dataContext interface{}, ctx context.Context) (output interface{}, err error) GetSuggestedAPIs(suite *testing.TestSuite, api string) ([]*testing.TestCase, error) WithSecure(secure *testing.Secure) WithOutputWriter(io.Writer) WithWriteLevel(level string) WithTestReporter(TestReporter) WithExecer(fakeruntime.Execer) WithSuite(*testing.TestSuite) WithAPISuggestLimit(int) }
TestCaseRunner represents a test case runner
func GetTestSuiteRunner ¶ added in v0.0.13
func GetTestSuiteRunner(suite *testing.TestSuite) TestCaseRunner
GetTestSuiteRunner returns a proper runner according to the given test suite.
func NewGRPCTestCaseRunner ¶ added in v0.0.13
func NewGRPCTestCaseRunner(host string, proto testing.RPCDesc) TestCaseRunner
func NewGraphQLRunner ¶ added in v0.0.16
func NewGraphQLRunner(parent TestCaseRunner) TestCaseRunner
func NewReverseHTTPRunner ¶ added in v0.0.16
func NewReverseHTTPRunner(normal TestCaseRunner) TestCaseRunner
func NewSimpleTestCaseRunner ¶ added in v0.0.4
func NewSimpleTestCaseRunner() TestCaseRunner
NewSimpleTestCaseRunner creates the instance of the simple test case runner
type TestReporter ¶ added in v0.0.4
type TestReporter interface { PutRecord(*ReportRecord) GetAllRecords() []*ReportRecord ExportAllReportResults() (ReportResultSlice, error) GetResourceUsage() []ResourceUsage }
TestReporter is the interface of the report
func NewDiscardTestReporter ¶ added in v0.0.4
func NewDiscardTestReporter() TestReporter
NewDiscardTestReporter creates a test reporter which discard everything
func NewMemoryTestReporter ¶ added in v0.0.5
func NewMemoryTestReporter(resMonitor monitor.MonitorClient, monitorTarget string) TestReporter
NewMemoryTestReporter creates a memory based test reporter
func NewPrometheusWriter ¶ added in v0.0.14
func NewPrometheusWriter(remote string, sync bool) TestReporter
NewPrometheusWriter creates a new PrometheusWriter
type UnimplementedRunner ¶ added in v0.0.13
type UnimplementedRunner struct { Secure *testing.Secure // contains filtered or unexported fields }
UnimplementedRunner implements interface TestCaseRunner except method RunTestCase.
Generally, this struct can be inherited directly when implementing a new runner. It is recommended to use NewDefaultUnimplementedRunner to initalize rather than to fill it manully.
func NewDefaultUnimplementedRunner ¶ added in v0.0.13
func NewDefaultUnimplementedRunner() UnimplementedRunner
NewDefaultUnimplementedRunner initializes an unimplementedRunner using the default values.
func (*UnimplementedRunner) GetSuggestedAPIs ¶ added in v0.0.16
func (*UnimplementedRunner) RunTestCase ¶ added in v0.0.13
func (*UnimplementedRunner) WithAPISuggestLimit ¶ added in v0.0.18
func (r *UnimplementedRunner) WithAPISuggestLimit(int)
func (*UnimplementedRunner) WithExecer ¶ added in v0.0.13
func (r *UnimplementedRunner) WithExecer(execer fakeruntime.Execer)
WithExecer sets the execer
func (*UnimplementedRunner) WithOutputWriter ¶ added in v0.0.13
func (r *UnimplementedRunner) WithOutputWriter(writer io.Writer)
WithOutputWriter sets the io.Writer
func (*UnimplementedRunner) WithSecure ¶ added in v0.0.14
func (r *UnimplementedRunner) WithSecure(secure *testing.Secure)
WithSecure sets the secure option.
func (*UnimplementedRunner) WithSuite ¶ added in v0.0.18
func (s *UnimplementedRunner) WithSuite(suite *testing.TestSuite)
func (*UnimplementedRunner) WithTestReporter ¶ added in v0.0.13
func (r *UnimplementedRunner) WithTestReporter(reporter TestReporter)
WithTestReporter sets the TestReporter
func (*UnimplementedRunner) WithWriteLevel ¶ added in v0.0.13
func (r *UnimplementedRunner) WithWriteLevel(level string)
WithWriteLevel sets the level writer
Source Files ¶
- doc.go
- expr_function.go
- graphql.go
- grpc.go
- http.go
- http_reverse.go
- logger.go
- reporter.go
- reporter_discard.go
- reporter_memory.go
- reporter_prometheus.go
- runner.go
- runner_factory.go
- verify.go
- writer.go
- writer_github_pr_comment.go
- writer_grpc.go
- writer_html.go
- writer_http.go
- writer_json.go
- writer_markdown.go
- writer_pdf.go
- writer_std.go
Directories ¶
Path | Synopsis |
---|---|
Package kubernetes provides a low level client for small footprint consideration
|
Package kubernetes provides a low level client for small footprint consideration |