framework

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

README

Some source files were originally from: k8s.io/kubernetes@/v1.21.0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateClient

func CreateClient() (client.Client, error)

func CreateClientSet

func CreateClientSet() (kubernetes.Interface, error)

func CreateKubeNamespace

func CreateKubeNamespace(name string, client client.Client) (*corev1.Namespace, error)

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

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 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 GetEdgeNodeNames

func GetEdgeNodeNames(cli client.Client) (sets.String, error)

func GetEndpointName

func GetEndpointName(clusterName, nodeName string) string

func ListCloudAndEdgePods

func ListCloudAndEdgePods(cli client.Client, opts ...client.ListOption) (cloudPods []corev1.Pod, edgePods []corev1.Pod, err error)

ListCloudAndEdgePods 根据条件返回Pod列表,但分为两类: 在云端节点的pod和在边缘节点的pod

func LoadConfig

func LoadConfig() (*rest.Config, error)

loadConfig loads a REST Config as per the rules specified in GetConfig

func Logf

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

Logf logs the info.

func NewTableReporter

func NewTableReporter(filename string) ginkgo.Reporter

func PrunedStack

func PrunedStack(skip int) string

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

func RegisterAndHandleFlags

func RegisterAndHandleFlags()

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 WaitForNamespacesDeleted

func WaitForNamespacesDeleted(client client.Client, namespaces []string, timeout time.Duration) 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().

type Context

type Context struct {
	KubeConfigsDir      string
	KubeConfig          string
	EdgeLabels          string
	GenReport           bool
	ReportFile          string
	WaitTimeout         int64
	PingTimeout         int64
	CurlTimeout         int64
	NetToolImage        string
	PreserveResources   string
	ReuseResource       bool
	ShowExecError       bool
	CreateEdgeCommunity bool
	IPv6Enabled         bool
}
var TestContext Context

func (Context) IsMultiClusterTest

func (c Context) IsMultiClusterTest() bool

type PreserveResourcesMode

type PreserveResourcesMode string
const (
	PreserveResourcesAlways    PreserveResourcesMode = "always"
	PreserveResourcesNever     PreserveResourcesMode = "never"
	PreserveResourcesOnFailure PreserveResourcesMode = "fail"
)

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