Documentation ¶
Index ¶
- Constants
- func CreateTestWorkSpace(client client.Client, baseName string) string
- func ExpectConsistOf(actual interface{}, extra interface{}, explain ...interface{})
- func ExpectEmpty(actual interface{}, explain ...interface{})
- func ExpectEqual(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 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 ParseFlags()
- func PrunedStack(skip int) []byte
- type Framework
- func (f *Framework) AfterEach()
- func (f *Framework) BeforeEach()
- func (f *Framework) CreateNamespace(name string) string
- func (f *Framework) GenericClient(userAgent string) client.Client
- func (f *Framework) GetNamespaceNames() []string
- func (f *Framework) GetScheme() *runtime.Scheme
- func (f *Framework) KubeSphereSystemNamespace() string
- func (f *Framework) RestClient(userAgent string) *restclient.RestClient
- func (f *Framework) TestWorkSpaceName() string
- type KubeSphereFramework
- type TestContextType
Constants ¶
const ( // Using the same interval as integration should be fine given the // minimal load that the apiserver is likely to be under. PollInterval = 50 * time.Millisecond // How long to try single API calls (like 'get' or 'list'). Used to prevent // transient failures from failing tests. DefaultSingleCallTimeout = 30 * time.Second )
Variables ¶
This section is empty.
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 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 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 ParseFlags ¶
func ParseFlags()
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
Types ¶
type Framework ¶
type Framework struct { BaseName string Workspace string Namespaces []string Scheme *runtime.Scheme }
func (*Framework) CreateNamespace ¶
func (*Framework) GetNamespaceNames ¶
func (*Framework) KubeSphereSystemNamespace ¶
func (*Framework) RestClient ¶
func (f *Framework) RestClient(userAgent string) *restclient.RestClient
func (*Framework) TestWorkSpaceName ¶
type KubeSphereFramework ¶
type KubeSphereFramework interface { GenericClient(userAgent string) client.Client RestClient(userAgent string) *restclient.RestClient KubeSphereSystemNamespace() string // Name of the workspace for the current test to target TestWorkSpaceName() string // Create a Namespace under current Worksapce CreateNamespace(name string) string // Get Names of the namespaces for the current test to target GetNamespaceNames() []string GetScheme() *runtime.Scheme }
KubeSphereFramework provides an interface to a test control plane so that the implementation can vary without affecting tests.
func NewKubeSphereFramework ¶
func NewKubeSphereFramework(baseName string) KubeSphereFramework
type TestContextType ¶
var TestContext *TestContextType = &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. |