Documentation ¶
Index ¶
- Constants
- Variables
- func ExpectConsistOf(actual interface{}, extra interface{}, explain ...interface{})
- func ExpectContainElements(actual interface{}, extra interface{}, explain ...interface{})
- func ExpectEmpty(actual interface{}, explain ...interface{})
- func ExpectEqual(actual interface{}, extra interface{}, explain ...interface{})
- func ExpectEqualValues(actual interface{}, extra interface{}, explain ...interface{})
- func ExpectEqualValuesWithOffset(offset int, actual interface{}, extra interface{}, explain ...interface{})
- func ExpectError(err error, explain ...interface{})
- func ExpectErrorWithOffset(offset int, err error, explain ...interface{})
- func ExpectHaveKey(actual interface{}, key interface{}, explain ...interface{})
- func ExpectNoError(err error, explain ...interface{})
- func ExpectNoErrorWithOffset(offset int, err error, explain ...interface{})
- func ExpectNotContainElements(actual interface{}, extra interface{}, explain ...interface{})
- func ExpectNotEqual(actual interface{}, extra interface{}, explain ...interface{})
- func ExpectTrue(actual interface{}, explain ...interface{})
- func ExpectTrueWithOffset(offset int, actual interface{}, explain ...interface{})
- func Fail(msg string, callerSkip ...int)
- func Failf(format string, args ...interface{})
- func FailfWithOffset(offset int, format string, args ...interface{})
- func Logf(format string, args ...interface{})
- func NewHTTPRequest() *request.Request
- func NewRequest() *request.Request
- func PrunedStack(skip int) []byte
- func RegisterCommonFlags(flags *flag.FlagSet)
- func RemoveCleanupAction(p CleanupActionHandle)
- func RunCleanupActions()
- func SpecifiedHTTPBodyHandler(body []byte) http.HandlerFunc
- func ValidateTestContext(t *TestContextType) error
- type CleanupActionHandle
- type EnsureFunc
- type FRPClient
- type Framework
- func (f *Framework) AfterEach()
- func (f *Framework) AllocPort() int
- func (f *Framework) BeforeEach()
- func (f *Framework) FRPClient(port int) *FRPClient
- func (f *Framework) GenerateConfigFile(content string) string
- func (f *Framework) PortByName(name string) int
- func (f *Framework) ReleasePort(port int)
- func (f *Framework) RenderTemplates(templates []string) (outs []string, ports map[string]int, err error)
- func (f *Framework) RunFrpc(args ...string) (*process.Process, string, error)
- func (f *Framework) RunFrps(args ...string) (*process.Process, string, error)
- func (f *Framework) RunProcesses(serverTemplates []string, clientTemplates []string) ([]*process.Process, []*process.Process)
- func (f *Framework) RunServer(portName string, s server.Server)
- func (f *Framework) SetEnvs(envs []string)
- func (f *Framework) WriteTempFile(name string, content string) string
- type MockServers
- type Options
- type RequestExpect
- func (e *RequestExpect) Do() (*request.Response, error)
- func (e *RequestExpect) Ensure(fns ...EnsureFunc)
- func (e *RequestExpect) ExpectError(expectErr bool) *RequestExpect
- func (e *RequestExpect) ExpectResp(resp []byte) *RequestExpect
- func (e *RequestExpect) Explain(explain ...interface{}) *RequestExpect
- func (e *RequestExpect) Port(port int) *RequestExpect
- func (e *RequestExpect) PortName(name string) *RequestExpect
- func (e *RequestExpect) Protocol(protocol string) *RequestExpect
- func (e *RequestExpect) Request(req *request.Request) *RequestExpect
- func (e *RequestExpect) RequestModify(f func(r *request.Request)) *RequestExpect
- type TestContextType
Constants ¶
const ( TCPEchoServerPort = "TCPEchoServerPort" UDPEchoServerPort = "UDPEchoServerPort" UDSEchoServerAddr = "UDSEchoServerAddr" HTTPSimpleServerPort = "HTTPSimpleServerPort" )
Variables ¶
var RunID string
RunID is a unique identifier of the e2e run. Beware that this ID is not the same for all tests in the e2e run, because each Ginkgo node creates it separately.
Functions ¶
func ExpectConsistOf ¶
func ExpectConsistOf(actual interface{}, extra interface{}, explain ...interface{})
ExpectConsistOf expects actual contains precisely the extra elements. The ordering of the elements does not matter.
func ExpectContainElements ¶
func ExpectContainElements(actual interface{}, extra interface{}, explain ...interface{})
func ExpectEmpty ¶
func ExpectEmpty(actual interface{}, explain ...interface{})
ExpectEmpty expects actual is empty
func ExpectEqual ¶
func ExpectEqual(actual interface{}, extra interface{}, explain ...interface{})
ExpectEqual expects the specified two are the same, otherwise an exception raises
func ExpectEqualValues ¶
func ExpectEqualValues(actual interface{}, extra interface{}, explain ...interface{})
ExpectEqualValues expects the specified two are the same, it not strict about type
func ExpectEqualValuesWithOffset ¶
func ExpectEqualValuesWithOffset(offset int, actual interface{}, extra interface{}, explain ...interface{})
func ExpectError ¶
func ExpectError(err error, explain ...interface{})
ExpectError expects an error happens, otherwise an exception raises
func ExpectErrorWithOffset ¶
func ExpectHaveKey ¶
func ExpectHaveKey(actual interface{}, key interface{}, explain ...interface{})
ExpectHaveKey expects the actual map has the key in the keyset
func ExpectNoError ¶
func ExpectNoError(err error, explain ...interface{})
ExpectNoError checks if "err" is set, and if so, fails assertion while logging the error.
func ExpectNoErrorWithOffset ¶
ExpectNoErrorWithOffset checks if "err" is set, and if so, fails assertion while logging the error at "offset" levels above its caller (for example, for call chain f -> g -> ExpectNoErrorWithOffset(1, ...) error would be logged for "f").
func ExpectNotContainElements ¶
func ExpectNotContainElements(actual interface{}, extra interface{}, explain ...interface{})
func ExpectNotEqual ¶
func ExpectNotEqual(actual interface{}, extra interface{}, explain ...interface{})
ExpectNotEqual expects the specified two are not the same, otherwise an exception raises
func ExpectTrue ¶
func ExpectTrue(actual interface{}, explain ...interface{})
func ExpectTrueWithOffset ¶
func ExpectTrueWithOffset(offset int, actual interface{}, explain ...interface{})
func Fail ¶
Fail is a replacement for ginkgo.Fail which logs the problem as it occurs together with a stack trace and then calls ginkgowrapper.Fail.
func Failf ¶
func Failf(format string, args ...interface{})
Failf logs the fail info, including a stack trace.
func FailfWithOffset ¶
FailfWithOffset calls "Fail" and logs the error with a stack trace that starts at "offset" levels above its caller (for example, for call chain f -> g -> FailfWithOffset(1, ...) error would be logged for "f").
func NewHTTPRequest ¶
func NewRequest ¶
NewRequest return a default request with default timeout and content.
func PrunedStack ¶
PrunedStack is a wrapper around debug.Stack() that removes information about the current goroutine and optionally skips some of the initial stack entries. With skip == 0, the returned stack will start with the caller of PruneStack. From the remaining entries it automatically filters out useless ones like entries coming from Ginkgo.
This is a modified copy of PruneStack in https://github.com/onsi/ginkgo/blob/f90f37d87fa6b1dd9625e2b1e83c23ffae3de228/internal/codelocation/code_location.go#L25:
- simplified API and thus renamed (calls debug.Stack() instead of taking a parameter)
- source code filtering updated to be specific to Kubernetes
- optimized to use bytes and in-place slice filtering from https://github.com/golang/go/wiki/SliceTricks#filter-in-place
func RegisterCommonFlags ¶
RegisterCommonFlags registers flags common to all e2e test suites. The flag set can be flag.CommandLine (if desired) or a custom flag set that then gets passed to viperconfig.ViperizeFlags.
The other Register*Flags methods below can be used to add more test-specific flags. However, those settings then get added regardless whether the test is actually in the test suite.
func RemoveCleanupAction ¶
func RemoveCleanupAction(p CleanupActionHandle)
RemoveCleanupAction removes a function that was installed by AddCleanupAction.
func RunCleanupActions ¶
func RunCleanupActions()
RunCleanupActions runs all functions installed by AddCleanupAction. It does not remove them (see RemoveCleanupAction) but it does run unlocked, so they may remove themselves.
func SpecifiedHTTPBodyHandler ¶
func SpecifiedHTTPBodyHandler(body []byte) http.HandlerFunc
func ValidateTestContext ¶
func ValidateTestContext(t *TestContextType) error
Types ¶
type CleanupActionHandle ¶
type CleanupActionHandle *int
CleanupActionHandle is an integer pointer type for handling cleanup action
func AddCleanupAction ¶
func AddCleanupAction(fn func()) CleanupActionHandle
AddCleanupAction installs a function that will be called in the event of the whole test being terminated. This allows arbitrary pieces of the overall test to hook into SynchronizedAfterSuite(). The hooks are called in last-in-first-out order.
type EnsureFunc ¶
func ExpectResponseCode ¶
func ExpectResponseCode(code int) EnsureFunc
type Framework ¶
type Framework struct { TempDirectory string // contains filtered or unexported fields }
func NewDefaultFramework ¶
func NewDefaultFramework() *Framework
func NewFramework ¶
func (*Framework) GenerateConfigFile ¶
func (*Framework) PortByName ¶
func (*Framework) ReleasePort ¶
func (*Framework) RenderTemplates ¶
func (f *Framework) RenderTemplates(templates []string) (outs []string, ports map[string]int, err error)
RenderTemplates alloc all ports for port names placeholder.
type MockServers ¶
type MockServers struct {
// contains filtered or unexported fields
}
func NewMockServers ¶
func NewMockServers(portAllocator *port.Allocator) *MockServers
func (*MockServers) Close ¶
func (m *MockServers) Close()
func (*MockServers) GetParam ¶
func (m *MockServers) GetParam(key string) interface{}
func (*MockServers) GetTemplateParams ¶
func (m *MockServers) GetTemplateParams() map[string]interface{}
func (*MockServers) Run ¶
func (m *MockServers) Run() error
type RequestExpect ¶
type RequestExpect struct {
// contains filtered or unexported fields
}
func NewRequestExpect ¶
func NewRequestExpect(f *Framework) *RequestExpect
func (*RequestExpect) Ensure ¶
func (e *RequestExpect) Ensure(fns ...EnsureFunc)
func (*RequestExpect) ExpectError ¶
func (e *RequestExpect) ExpectError(expectErr bool) *RequestExpect
func (*RequestExpect) ExpectResp ¶
func (e *RequestExpect) ExpectResp(resp []byte) *RequestExpect
func (*RequestExpect) Explain ¶
func (e *RequestExpect) Explain(explain ...interface{}) *RequestExpect
func (*RequestExpect) Port ¶
func (e *RequestExpect) Port(port int) *RequestExpect
func (*RequestExpect) PortName ¶
func (e *RequestExpect) PortName(name string) *RequestExpect
func (*RequestExpect) Protocol ¶
func (e *RequestExpect) Protocol(protocol string) *RequestExpect
func (*RequestExpect) Request ¶
func (e *RequestExpect) Request(req *request.Request) *RequestExpect
func (*RequestExpect) RequestModify ¶
func (e *RequestExpect) RequestModify(f func(r *request.Request)) *RequestExpect
type TestContextType ¶
type TestContextType struct { FRPClientPath string FRPServerPath string LogLevel string Debug bool }
var TestContext TestContextType
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package ginkgowrapper wraps Ginkgo Fail and Skip functions to panic with structured data instead of a constant string.
|
Package ginkgowrapper wraps Ginkgo Fail and Skip functions to panic with structured data instead of a constant string. |