util

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultNamespaceDeletionTimeout is timeout duration for waiting for a namespace deletion.
	DefaultNamespaceDeletionTimeout = 5 * time.Minute

	// PodStartTimeout is how long to wait for the pod to be started.
	PodStartTimeout = 5 * time.Minute
)

Variables

View Source
var AccessKeyID = flag.String("access-key-id", "", "aliyun AccessKeyId  for ailunyun:ecs/ens")
View Source
var AccessKeySecret = flag.String("access-key-secret", "", "aliyun AccessKeySecret  for ailunyun:ecs/ens")
View Source
var EnableYurtAutonomy = flag.Bool("enable-yurt-autonomy", false, "switch of yurt node autonomy. If set to true, yurt node autonomy test can be run normally")
View Source
var Kubeconfig = flag.String("kubeconfig", "", "kubeconfig file path for OpenYurt cluster")
View Source
var NodeType = flag.String("node-type", "minikube", "node type such as ailunyun:ecs/ens, minikube and user_self")
View Source
var RegionID = flag.String("region-id", "", "aliyun region id for ailunyun:ecs/ens")
View Source
var ReportDir = flag.String("report-dir", "", "Path to the directory where the JUnit XML reports should be saved. Default is empty, which doesn't generate these reports.")

Functions

func BeEquivalentToError added in v1.3.0

func BeEquivalentToError(expected error) types.GomegaMatcher

BeEquivalentToError matches the error to take care of nil.

func CleanupNodePool added in v1.3.0

func CleanupNodePool(ctx context.Context, k8sClient client.Client) error

func CleanupNodePoolLabel added in v1.3.0

func CleanupNodePoolLabel(ctx context.Context, k8sClient client.Client) 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 InitNodeAndNodePool added in v1.3.0

func InitNodeAndNodePool(ctx context.Context, k8sClient client.Client, poolToNodesMap map[string]sets.String) error

func JSONMarshal added in v1.3.0

func JSONMarshal(o interface{}) []byte

JSONMarshal returns the JSON encoding

func LoadRESTClientConfigFromEnv added in v1.1.0

func LoadRESTClientConfigFromEnv(kubeconfig string) (*restclient.Config, error)

Load restClientConfig from env

func LoadRestConfigAndClientset

func LoadRestConfigAndClientset(kubeconfig string) (*restclient.Config, *clientset.Clientset, error)

LoadRestConfigAndClientset returns rest config and clientset for connecting to kubernetes clusters.

func SetYurtE2eCfg added in v1.1.0

func SetYurtE2eCfg() error

SetYurtE2eCfg for e2e-tests

func WaitForNamespacesDeleted

func WaitForNamespacesDeleted(c clientset.Interface, namespaces []string, timeout time.Duration) error

WaitForNamespacesDeleted waits for the namespaces to be deleted.

Types

type AlreadyExistMatcher added in v1.3.0

type AlreadyExistMatcher struct {
}

AlreadyExistMatcher matches the error to be already exist

func (AlreadyExistMatcher) FailureMessage added in v1.3.0

func (matcher AlreadyExistMatcher) FailureMessage(actual interface{}) (message string)

FailureMessage builds an error message.

func (AlreadyExistMatcher) Match added in v1.3.0

func (matcher AlreadyExistMatcher) Match(actual interface{}) (success bool, err error)

Match matches error.

func (AlreadyExistMatcher) NegatedFailureMessage added in v1.3.0

func (matcher AlreadyExistMatcher) NegatedFailureMessage(actual interface{}) (message string)

NegatedFailureMessage builds an error message.

type ErrorMatcher added in v1.3.0

type ErrorMatcher struct {
	ExpectedError error
}

ErrorMatcher matches errors.

func (ErrorMatcher) FailureMessage added in v1.3.0

func (matcher ErrorMatcher) FailureMessage(actual interface{}) (message string)

FailureMessage builds an error message.

func (ErrorMatcher) Match added in v1.3.0

func (matcher ErrorMatcher) Match(actual interface{}) (success bool, err error)

Match matches an error.

func (ErrorMatcher) NegatedFailureMessage added in v1.3.0

func (matcher ErrorMatcher) NegatedFailureMessage(actual interface{}) (message string)

NegatedFailureMessage builds an error message.

type NotFoundMatcher added in v1.3.0

type NotFoundMatcher struct {
}

NotFoundMatcher matches the error to be not found.

func (NotFoundMatcher) FailureMessage added in v1.3.0

func (matcher NotFoundMatcher) FailureMessage(actual interface{}) (message string)

FailureMessage builds an error message.

func (NotFoundMatcher) Match added in v1.3.0

func (matcher NotFoundMatcher) Match(actual interface{}) (success bool, err error)

Match matches the api error.

func (NotFoundMatcher) NegatedFailureMessage added in v1.3.0

func (matcher NotFoundMatcher) NegatedFailureMessage(actual interface{}) (message string)

NegatedFailureMessage builds an error message.

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