framework

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PauseImage = "kubesphere/pause:3.6"

	// PodStartTimeout is how long to wait for the pod to be started.
	PodStartTimeout = 5 * time.Minute
)
View Source
const (
	NetworkFailure = 4
)
View Source
const (
	OpenELBNamespace = "openelb-testns"
)

Variables

View Source
var ErrFailure error = FailureError{}

ErrFailure is an empty error that can be wrapped to indicate that an error is a FailureError. It can also be used to test for a FailureError:.

return fmt.Errorf("some problem%w", ErrFailure)
...
err := someOperation()
if errors.Is(err, ErrFailure) {
    ...
}
View Source
var Fail = ginkgo.Fail

Fail is an alias for ginkgo.Fail.

Functions

func Do

func Do(address string) 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 ExpectFalse

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

ExpectFalse expects actual is false

func ExpectHaveKey

func ExpectHaveKey(actual interface{}, key interface{}, explain ...interface{})

ExpectHaveKey expects the actual map has the key in the keyset

func ExpectNil

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

ExpectNil expects actual is nil

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 ExpectNotNil

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

ExpectNotNil expects actual is not nil

func ExpectTrue

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

ExpectTrue expects actual is true

func Failf

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

Failf logs the fail info, including a stack trace starts with its direct caller (for example, for call chain f -> g -> Failf("foo", ...) error would be logged for "g").

func KubesphereDescribe

func KubesphereDescribe(text string, body func()) bool

KubesphereDescribe annotates the test with the SIG label.

func Logf

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

Logf logs the info.

func MakePod

func MakePod(ns, name string, labels, annotations map[string]string, image string, command, args []string) *corev1.Pod

func WaitDaemonsetPresentFitWith

func WaitDaemonsetPresentFitWith(client client.Client, namespace, name string, fit func(DaemonSetCondition *appsv1.DaemonSet) bool)

WaitDaemonsetPresentFitWith wait daemonset present on cluster sync with fit func.

func WaitDeploymentPresentFitWith

func WaitDeploymentPresentFitWith(client client.Client, namespace, name string, fit func(deployment *appsv1.Deployment) bool)

WaitDeploymentPresentFitWith wait deployment present on cluster sync with fit func.

func WaitForBGPEstablished

func WaitForBGPEstablished(timeout time.Duration, bgpClient *GobgpClient, num int) error

func WaitForRouterNum

func WaitForRouterNum(timeout time.Duration, ip string, bgpClient *GobgpClient, num int) error

func WaitServicePresentFitWith

func WaitServicePresentFitWith(client client.Client, namespace, name string, fit func(service *corev1.Service) bool)

WaitServicePresentFitWith wait service present on cluster sync with fit func.

Types

type BgpConfGlobal

type BgpConfGlobal struct {
	AS         uint32
	ListenPort int32
	RouterID   string
	Name       string
	Client     client.Client
}

func (*BgpConfGlobal) Create

func (b *BgpConfGlobal) Create(ctx context.Context) error

func (*BgpConfGlobal) Delete

func (b *BgpConfGlobal) Delete(ctx context.Context) error

func (*BgpConfGlobal) Update

func (b *BgpConfGlobal) Update(ctx context.Context, listenPort int32) error

type BgpPeer

type BgpPeer struct {
	Address string
	AS      uint32
	Port    uint32
	Name    string
	Client  client.Client
	Passive bool
}

func (*BgpPeer) Create

func (b *BgpPeer) Create(ctx context.Context) error

func (*BgpPeer) Delete

func (b *BgpPeer) Delete(ctx context.Context) error

func (*BgpPeer) Update

func (b *BgpPeer) Update(ctx context.Context) error

type FailureError

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

FailureError is an error where the error string is meant to be passed to ginkgo.Fail directly, i.e. adding some prefix like "unexpected error" is not necessary. It is also not necessary to dump the error struct.

func (FailureError) Backtrace

func (f FailureError) Backtrace() string

func (FailureError) Error

func (f FailureError) Error() string

func (FailureError) Is

func (f FailureError) Is(target error) bool

type Framework

type Framework struct {
	KubeConfig string
	*framework.Framework
	Scheme        *runtime.Scheme
	OpenELBClient client.Client
}

func NewDefaultFramework

func NewDefaultFramework(baseName string) *Framework

func (*Framework) BeforeEach

func (f *Framework) BeforeEach()

BeforeEach gets a openelb client

func (*Framework) PodClient

func (f *Framework) PodClient() *PodClient

func (*Framework) PodClientNS

func (f *Framework) PodClientNS(namespace string) *PodClient

type GobgpClient

type GobgpClient struct {
	gobgpapi.GobgpApiClient
}

func NewGobgpClient

func NewGobgpClient(ctx context.Context, pod *v1.Pod, port int) *GobgpClient

func (*GobgpClient) AddConfForGobgp

func (c *GobgpClient) AddConfForGobgp(routerid string, as uint32, port int32) error

func (*GobgpClient) AddPeerForGobgp

func (c *GobgpClient) AddPeerForGobgp(address string, as uint32, port int) error

func (*GobgpClient) DeletePeerForGobgp

func (c *GobgpClient) DeletePeerForGobgp(address string) error

func (*GobgpClient) GetAllPeers

func (c *GobgpClient) GetAllPeers() ([]*gobgpapi.Peer, error)

func (*GobgpClient) GetRoutersForGobgp

func (c *GobgpClient) GetRoutersForGobgp(ip string) (map[string]struct{}, error)

type PodClient

type PodClient struct {
	*e2epod.PodClient
	// contains filtered or unexported fields
}

func (*PodClient) Create

func (c *PodClient) Create(ctx context.Context, pod *corev1.Pod) *corev1.Pod

func (*PodClient) CreateSync

func (c *PodClient) CreateSync(ctx context.Context, pod *corev1.Pod) *corev1.Pod

func (*PodClient) Delete

func (c *PodClient) Delete(ctx context.Context, name string) error

func (*PodClient) DeleteSync

func (c *PodClient) DeleteSync(ctx context.Context, name string)

func (*PodClient) WaitForNotFound

func (c *PodClient) WaitForNotFound(ctx context.Context, name string)

func (*PodClient) WaitForRunning

func (c *PodClient) WaitForRunning(ctx context.Context, name string)

Jump to

Keyboard shortcuts

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