Documentation
¶
Index ¶
- Constants
- Variables
- func ExpectConsistOf(actual any, extra any, explain ...any)
- func ExpectContainElements(actual any, extra any, explain ...any)
- func ExpectContainSubstring(actual, substr string, explain ...any)
- func ExpectEmpty(actual any, explain ...any)
- func ExpectEqual(actual any, extra any, explain ...any)
- func ExpectEqualValues(actual any, extra any, explain ...any)
- func ExpectEqualValuesWithOffset(offset int, actual any, extra any, explain ...any)
- func ExpectError(err error, explain ...any)
- func ExpectErrorWithOffset(offset int, err error, explain ...any)
- func ExpectHaveKey(actual any, key any, explain ...any)
- func ExpectNoError(err error, explain ...any)
- func ExpectNoErrorWithOffset(offset int, err error, explain ...any)
- func ExpectNotContainElements(actual any, extra any, explain ...any)
- func ExpectNotEqual(actual any, extra any, explain ...any)
- func ExpectTrue(actual any, explain ...any)
- func ExpectTrueWithOffset(offset int, actual any, explain ...any)
- func Failf(format string, args ...any)
- func Logf(format string, args ...any)
- func NewHTTPRequest() *request.Request
- func NewRequest() *request.Request
- 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 Framework
- func (f *Framework) APIClientForFrpc(port int) *clientsdk.Client
- func (f *Framework) AfterEach()
- func (f *Framework) AllocPort() int
- func (f *Framework) BeforeEach()
- 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 ...any) *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 Fail = ginkgo.Fail
Fail is an alias for ginkgo.Fail.
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 ¶
ExpectConsistOf expects actual contains precisely the extra elements. The ordering of the elements does not matter.
func ExpectContainElements ¶ added in v0.37.1
func ExpectContainSubstring ¶ added in v0.56.0
func ExpectEqual ¶
ExpectEqual expects the specified two are the same, otherwise an exception raises
func ExpectEqualValues ¶
ExpectEqualValues expects the specified two are the same, it not strict about type
func ExpectEqualValuesWithOffset ¶ added in v0.37.1
func ExpectError ¶
ExpectError expects an error happens, otherwise an exception raises
func ExpectErrorWithOffset ¶ added in v0.37.1
func ExpectHaveKey ¶
ExpectHaveKey expects the actual map has the key in the keyset
func ExpectNoError ¶
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 ¶ added in v0.37.1
func ExpectNotEqual ¶
ExpectNotEqual expects the specified two are not the same, otherwise an exception raises
func ExpectTrue ¶
func ExpectTrueWithOffset ¶ added in v0.37.1
func Failf ¶
Failf logs the fail info, including a stack trace starts with its direct caller (for example, for call chain f -> g -> Failf("foo", ...) error would be logged for "g").
func NewHTTPRequest ¶ added in v0.37.1
func NewRequest ¶ added in v0.37.0
NewRequest return a default request with default timeout and content.
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 ¶ added in v0.37.1
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 ¶ added in v0.37.1
func ExpectResponseCode ¶ added in v0.37.1
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) APIClientForFrpc ¶ added in v0.56.0
func (*Framework) GenerateConfigFile ¶ added in v0.37.1
func (*Framework) PortByName ¶ added in v0.37.0
func (*Framework) ReleasePort ¶ added in v0.37.0
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.
func (*Framework) RunProcesses ¶
func (f *Framework) RunProcesses(serverTemplates []string, clientTemplates []string) ([]*process.Process, []*process.Process)
RunProcesses run multiple processes from templates. The first template should always be frps.
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) any
func (*MockServers) GetTemplateParams ¶
func (m *MockServers) GetTemplateParams() map[string]any
func (*MockServers) Run ¶
func (m *MockServers) Run() error
type RequestExpect ¶ added in v0.37.0
type RequestExpect struct {
// contains filtered or unexported fields
}
func NewRequestExpect ¶ added in v0.37.0
func NewRequestExpect(f *Framework) *RequestExpect
func (*RequestExpect) Ensure ¶ added in v0.37.0
func (e *RequestExpect) Ensure(fns ...EnsureFunc)
func (*RequestExpect) ExpectError ¶ added in v0.37.0
func (e *RequestExpect) ExpectError(expectErr bool) *RequestExpect
func (*RequestExpect) ExpectResp ¶ added in v0.37.0
func (e *RequestExpect) ExpectResp(resp []byte) *RequestExpect
func (*RequestExpect) Explain ¶ added in v0.37.0
func (e *RequestExpect) Explain(explain ...any) *RequestExpect
func (*RequestExpect) Port ¶ added in v0.37.1
func (e *RequestExpect) Port(port int) *RequestExpect
func (*RequestExpect) PortName ¶ added in v0.37.0
func (e *RequestExpect) PortName(name string) *RequestExpect
func (*RequestExpect) Protocol ¶ added in v0.37.1
func (e *RequestExpect) Protocol(protocol string) *RequestExpect
func (*RequestExpect) Request ¶ added in v0.37.1
func (e *RequestExpect) Request(req *request.Request) *RequestExpect
func (*RequestExpect) RequestModify ¶ added in v0.37.0
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