Documentation
¶
Index ¶
- Constants
- Variables
- func ExpectContainElements(actual any, extra any, explain ...any)
- func ExpectContainSubstring(actual, substr string, 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 ExpectErrorWithOffset(offset int, err error, 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 SpecifiedHTTPBodyHandler(body []byte) http.HandlerFunc
- func ValidateTestContext(t *TestContextType) error
- func WaitForTCPReady(addr string, timeout time.Duration) error
- func WaitForTCPUnreachable(addr string, interval, timeout time.Duration) error
- type EnsureFunc
- type Framework
- func (f *Framework) APIClientForFrpc(port int) *clientsdk.Client
- func (f *Framework) AfterEach()
- func (f *Framework) AllocPort() int
- func (f *Framework) AllocPortExcludingRanges(ranges ...[2]int) int
- func (f *Framework) BeforeEach()
- func (f *Framework) GenerateConfigFile(content string) string
- func (f *Framework) PortByName(name string) 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(serverTemplate string, clientTemplates []string) (*process.Process, []*process.Process)
- func (f *Framework) RunProcessesWithBinaries(serverBinaryPath string, clientBinaryPath string, serverTemplate 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) 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 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 ExpectErrorWithOffset ¶ added in v0.37.1
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 SpecifiedHTTPBodyHandler ¶ added in v0.37.1
func SpecifiedHTTPBodyHandler(body []byte) http.HandlerFunc
func ValidateTestContext ¶
func ValidateTestContext(t *TestContextType) error
func WaitForTCPReady ¶ added in v0.68.0
WaitForTCPReady polls a TCP address until a connection succeeds or timeout.
Types ¶
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) AllocPortExcludingRanges ¶ added in v0.68.1
func (*Framework) GenerateConfigFile ¶ added in v0.37.1
func (*Framework) PortByName ¶ 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(serverTemplate string, clientTemplates []string) (*process.Process, []*process.Process)
RunProcesses starts one frps and zero or more frpc processes from templates.
func (*Framework) RunProcessesWithBinaries ¶ added in v0.69.0
func (f *Framework) RunProcessesWithBinaries( serverBinaryPath string, clientBinaryPath string, serverTemplate string, clientTemplates []string, ) (*process.Process, []*process.Process)
RunProcessesWithBinaries starts one frps and zero or more frpc processes with explicit binary paths.
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) 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