framework

package
v0.34.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TCPEchoServerPort = "TCPEchoServerPort"
	UDPEchoServerPort = "UDPEchoServerPort"
	UDSEchoServerAddr = "UDSEchoServerAddr"
)

Variables

View Source
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

func ExpectNoErrorWithOffset(offset int, err error, explain ...interface{})

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 ExpectRequest(protocol string, port int, in, out []byte, timeout time.Duration, explain ...interface{})

func ExpectRequestError

func ExpectRequestError(protocol string, port int, in []byte, timeout time.Duration, explain ...interface{})

func ExpectTCPRequest

func ExpectTCPRequest(port int, in, out []byte, timeout time.Duration, explain ...interface{})

func ExpectTCPRequestError

func ExpectTCPRequestError(port int, in []byte, timeout time.Duration, explain ...interface{})

func ExpectTrue

func ExpectTrue(actual interface{}, explain ...interface{})

func ExpectUDPRequest

func ExpectUDPRequest(port int, in, out []byte, timeout time.Duration, explain ...interface{})

func ExpectUDPRequestError

func ExpectUDPRequestError(port int, in []byte, timeout time.Duration, explain ...interface{})

func Fail

func Fail(msg string, callerSkip ...int)

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

func FailfWithOffset(offset int, format string, args ...interface{})

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 GenPortName(name string) string

func GenerateConfigFile

func GenerateConfigFile(path string, content string) error

func Logf

func Logf(format string, args ...interface{})

Logf logs the info.

func PrunedStack

func PrunedStack(skip int) []byte

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:

func RegisterCommonFlags

func RegisterCommonFlags(flags *flag.FlagSet)

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 FRPClient

type FRPClient struct {
	// contains filtered or unexported fields
}

type Framework

type Framework struct {
	TempDirectory string
	UsedPorts     map[string]int
	// contains filtered or unexported fields
}

func NewDefaultFramework

func NewDefaultFramework() *Framework

func NewFramework

func NewFramework(opt Options) *Framework

func (*Framework) AfterEach

func (f *Framework) AfterEach()

func (*Framework) BeforeEach

func (f *Framework) BeforeEach()

BeforeEach create a temp directory.

func (*Framework) FRPClient

func (f *Framework) FRPClient(port int) *FRPClient

func (*Framework) RenderTemplates

func (f *Framework) RenderTemplates(templates []string) (outs []string, ports map[string]int, err error)

func (*Framework) RunProcesses

func (f *Framework) RunProcesses(serverTemplates []string, clientTemplates []string)

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 Options

type Options struct {
	TotalParallelNode int
	CurrentNodeIndex  int
	FromPortIndex     int
	ToPortIndex       int
}

type TestContextType

type TestContextType struct {
	FRPClientPath string
	FRPServerPath string
	LogLevel      string
	Debug         bool
}
var TestContext TestContextType

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL