Documentation ¶
Index ¶
- Constants
- Variables
- func ExpectConsistOf(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 ExpectError(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 ExpectNotEqual(actual interface{}, extra interface{}, explain ...interface{})
- func ExpectRequest(protocol string, port int, in, out []byte, timeout time.Duration, ...)
- func ExpectRequestError(protocol string, port int, in []byte, timeout time.Duration, ...)
- func ExpectTCPRequest(port int, in, out []byte, timeout time.Duration, explain ...interface{})
- func ExpectTCPRequestError(port int, in []byte, timeout time.Duration, explain ...interface{})
- func ExpectTrue(actual interface{}, explain ...interface{})
- func ExpectUDPRequest(port int, in, out []byte, timeout time.Duration, explain ...interface{})
- func ExpectUDPRequestError(port int, in []byte, timeout time.Duration, explain ...interface{})
- func Fail(msg string, callerSkip ...int)
- func Failf(format string, args ...interface{})
- func FailfWithOffset(offset int, format string, args ...interface{})
- func GenPortName(name string) string
- func GenerateConfigFile(path string, content string) error
- func Logf(format string, args ...interface{})
- func PrunedStack(skip int) []byte
- func RegisterCommonFlags(flags *flag.FlagSet)
- func RemoveCleanupAction(p CleanupActionHandle)
- func RunCleanupActions()
- func ValidateTestContext(t *TestContextType) error
- type CleanupActionHandle
- type FRPClient
- type Framework
- func (f *Framework) AfterEach()
- func (f *Framework) BeforeEach()
- func (f *Framework) FRPClient(port int) *FRPClient
- func (f *Framework) RenderTemplates(templates []string) (outs []string, ports map[string]int, err error)
- func (f *Framework) RunProcesses(serverTemplates []string, clientTemplates []string)
- type MockServers
- type Options
- type TestContextType
Constants ¶
const ( TCPEchoServerPort = "TCPEchoServerPort" UDPEchoServerPort = "UDPEchoServerPort" UDSEchoServerAddr = "UDSEchoServerAddr" )
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 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 ExpectError ¶
func ExpectError(err error, explain ...interface{})
ExpectError expects an error happens, otherwise an exception raises
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 ExpectNotEqual ¶
func ExpectNotEqual(actual interface{}, extra interface{}, explain ...interface{})
ExpectNotEqual expects the specified two are not the same, otherwise an exception raises
func ExpectRequest ¶
func ExpectRequestError ¶
func ExpectTCPRequest ¶
func ExpectTCPRequestError ¶
func ExpectTrue ¶
func ExpectTrue(actual interface{}, explain ...interface{})
func ExpectUDPRequest ¶
func ExpectUDPRequestError ¶
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 GenPortName ¶
func GenerateConfigFile ¶
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 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 Framework ¶
type Framework struct { TempDirectory string UsedPorts map[string]int // contains filtered or unexported fields }
func NewDefaultFramework ¶
func NewDefaultFramework() *Framework
func NewFramework ¶
func (*Framework) RenderTemplates ¶
func (*Framework) RunProcesses ¶
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) interface{}
func (*MockServers) GetTemplateParams ¶
func (m *MockServers) GetTemplateParams() map[string]interface{}
func (*MockServers) Run ¶
func (m *MockServers) Run() error
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. |