framework

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PauseImage   = "kubeovn/pause:3.2"
	BusyBoxImage = "busybox:stable"
	AgnhostImage = "kubeovn/agnhost:2.40"
)
View Source
const (
	KubeOvnNamespace = "kube-system"
	DaemonSetOvsOvn  = "ovs-ovn"
)

Variables

This section is empty.

Functions

func ConformanceIt added in v1.11.0

func ConformanceIt(text string, body interface{}) bool

ConformanceIt is wrapper function for ginkgo It. Adds "[Conformance]" tag and makes static analysis easier.

func Describe added in v1.11.0

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

func ExpectConsistOf added in v1.11.0

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 ExpectContainElement added in v1.11.0

func ExpectContainElement(actual interface{}, extra interface{}, explain ...interface{})

ExpectContainElement expects actual contains the extra elements.

func ExpectEmpty added in v1.11.0

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

ExpectEmpty expects actual is empty

func ExpectEqual added in v1.11.0

func ExpectEqual(actual interface{}, extra interface{}, explain ...interface{})

ExpectEqual expects the specified two are the same, otherwise an exception raises

func ExpectError added in v1.11.0

func ExpectError(err error, explain ...interface{})

ExpectError expects an error happens, otherwise an exception raises

func ExpectFalse added in v1.11.0

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

ExpectFalse expects actual is false

func ExpectHaveKey added in v1.11.0

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

ExpectHaveKey expects the actual map has the key in the keyset

func ExpectHaveKeyWithValue added in v1.11.0

func ExpectHaveKeyWithValue(actual interface{}, key, value interface{}, explain ...interface{})

ExpectHaveKeyWithValue expects the actual map has the passed in key/value pair.

func ExpectHaveLen added in v1.11.0

func ExpectHaveLen(actual interface{}, count int, explain ...interface{})

ExpectHaveLen expects actual has the passed-in length

func ExpectIPInCIDR added in v1.11.0

func ExpectIPInCIDR(ip, cidr string)

ExpectIPInCIDR expects that the given IP address in within the CIDR.

func ExpectMAC added in v1.11.0

func ExpectMAC(s string)

ExpectMAC expects that the given string is a MAC address.

func ExpectNil added in v1.11.0

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

ExpectNil expects actual is nil

func ExpectNoError added in v1.11.0

func ExpectNoError(err error, explain ...interface{})

ExpectNoError checks if "err" is set, and if so, fails assertion while logging the error.

func ExpectNoErrorWithOffset added in v1.11.0

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 ExpectNotContainElement added in v1.11.0

func ExpectNotContainElement(actual interface{}, extra interface{}, explain ...interface{})

ExpectNotContainElement expects actual does not contain the extra elements.

func ExpectNotEmpty added in v1.11.0

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

ExpectNotEmpty expects actual is not empty

func ExpectNotEqual added in v1.11.0

func ExpectNotEqual(actual interface{}, extra interface{}, explain ...interface{})

ExpectNotEqual expects the specified two are not the same, otherwise an exception raises

func ExpectNotHaveKey added in v1.11.0

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

ExpectNotHaveKey expects the actual map does not have the key in the keyset

func ExpectNotNil added in v1.11.0

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

ExpectNotNil expects actual is not nil

func ExpectNotZero added in v1.11.0

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

ExpectNotZero expects actual is not nil nor the zero value for its type.

func ExpectTrue added in v1.11.0

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

ExpectTrue expects actual is true

func ExpectUUID added in v1.11.0

func ExpectUUID(s string)

ExpectUUID expects that the given string is an UUID.

func ExpectZero added in v1.11.0

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

ExpectZero expects actual actual is the zero value for its type or actual is nil.

func Fail added in v1.11.0

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 added in v1.11.0

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 GetKubeOvnImage added in v1.11.0

func GetKubeOvnImage(cs clientset.Interface) string

func GetOvsPodOnNode added in v1.11.0

func GetOvsPodOnNode(cs clientset.Interface, node string) *corev1.Pod

func GetPodOnNodeForDaemonSet added in v1.11.0

func GetPodOnNodeForDaemonSet(cs clientset.Interface, ds *appsv1.DaemonSet, node string) (*corev1.Pod, error)

func GetPodsForDaemonSet added in v1.11.0

func GetPodsForDaemonSet(cs clientset.Interface, ds *appsv1.DaemonSet) (*corev1.PodList, error)

func IsProviderNetworkConditionSetAsExpected added in v1.11.0

func IsProviderNetworkConditionSetAsExpected(pn *apiv1.ProviderNetwork, node string, conditionType apiv1.ConditionType, wantTrue bool) bool

IsProviderNetworkConditionSetAsExpected returns a wantTrue value if the subnet has a match to the conditionType, otherwise returns an opposite value of the wantTrue with detailed logging.

func IsSubnetConditionSetAsExpected added in v1.11.0

func IsSubnetConditionSetAsExpected(subnet *apiv1.Subnet, conditionType apiv1.ConditionType, wantTrue bool) bool

IsSubnetConditionSetAsExpected returns a wantTrue value if the subnet has a match to the conditionType, otherwise returns an opposite value of the wantTrue with detailed logging.

func IsTimeout added in v1.11.0

func IsTimeout(err error) bool

func KubectlExec added in v1.11.0

func KubectlExec(namespace, pod string, cmd ...string) (stdout, stderr []byte, err error)

func Logf added in v1.11.0

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

Logf logs the info.

func MakePod added in v1.11.0

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

func MakeProviderNetwork added in v1.11.0

func MakeProviderNetwork(name string, exchangeLinkName bool, defaultInterface string, customInterfaces map[string][]string, excludeNodes []string) *apiv1.ProviderNetwork

func MakeService added in v1.11.0

func MakeService(name string, svcType corev1.ServiceType, annotations, selector map[string]string, ports []corev1.ServicePort, affinity corev1.ServiceAffinity) *corev1.Service

func MakeSubnet added in v1.11.0

func MakeSubnet(name, vlan, cidr, gateway string, excludeIPs, gatewayNodes, namespaces []string) *apiv1.Subnet

func MakeVlan added in v1.11.0

func MakeVlan(name, provider string, id int) *apiv1.Vlan

func OrderedDescribe added in v1.11.0

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

func PrunedStack added in v1.11.0

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/v2/blob/f90f37d87fa6b1dd9625e2b1e83c23ffae3de228/internal/codelocation/code_location.go#L25:

func RandomCIDR added in v1.11.0

func RandomCIDR(family string) string

func RandomExcludeIPs added in v1.11.0

func RandomExcludeIPs(cidr string, count int) []string

ipv4/ipv6 only

func RandomIPPool added in v1.11.0

func RandomIPPool(cidr, sep string, count int) string

func RandomSuffix added in v1.11.0

func RandomSuffix() string

RandomSuffix provides a random sequence to append to resources.

func TimeoutError added in v1.11.0

func TimeoutError(msg string, observedObjects ...interface{}) *timeoutError

Types

type EventClient added in v1.11.0

type EventClient struct {
	typedcorev1.EventInterface
	// contains filtered or unexported fields
}

func (*EventClient) WaitToHaveEvent added in v1.11.0

func (c *EventClient) WaitToHaveEvent(kind, name, eventType, reason, sourceComponent, sourceHost string) []corev1.Event

WaitToHaveEvent waits the provided resource to have the specified event(s)

type Framework

type Framework struct {
	KubeContext string
	*framework.Framework
	KubeOVNClientSet kubeovncs.Interface

	// master/release-1.10/...
	ClusterVersion string
	// 999.999 for master
	ClusterVersionMajor uint
	ClusterVersionMinor uint
	// ipv4/ipv6/dual
	ClusterIpFamily string
	// overlay/underlay/underlay-hairpin
	ClusterNetworkMode string
}

func NewDefaultFramework added in v1.11.0

func NewDefaultFramework(baseName string) *Framework

func NewFrameworkWithContext added in v1.11.0

func NewFrameworkWithContext(baseName, kubeContext string) *Framework

func (*Framework) BeforeEach added in v1.11.0

func (f *Framework) BeforeEach()

BeforeEach gets a kube-ovn client

func (*Framework) EventClient added in v1.11.0

func (f *Framework) EventClient() *EventClient

func (*Framework) IPv6 added in v1.11.0

func (f *Framework) IPv6() bool

func (*Framework) PodClient added in v1.11.0

func (f *Framework) PodClient() *PodClient

func (*Framework) ProviderNetworkClient added in v1.11.0

func (f *Framework) ProviderNetworkClient() *ProviderNetworkClient

func (*Framework) ServiceClient added in v1.11.0

func (f *Framework) ServiceClient() *ServiceClient

func (*Framework) SkipVersionPriorTo added in v1.11.0

func (f *Framework) SkipVersionPriorTo(major, minor uint, message string)

func (*Framework) SubnetClient added in v1.11.0

func (f *Framework) SubnetClient() *SubnetClient

func (*Framework) VlanClient added in v1.11.0

func (f *Framework) VlanClient() *VlanClient

type PodClient added in v1.11.0

type PodClient struct {
	*e2epod.PodClient
}

func (*PodClient) DeleteSync added in v1.11.0

func (c *PodClient) DeleteSync(name string)

func (*PodClient) PatchPod added in v1.11.0

func (c *PodClient) PatchPod(original, modified *corev1.Pod) *corev1.Pod

type ProviderNetworkClient added in v1.11.0

type ProviderNetworkClient struct {
	v1.ProviderNetworkInterface
	// contains filtered or unexported fields
}

ProviderNetworkClient is a struct for provider network client.

func (*ProviderNetworkClient) Create added in v1.11.0

Create creates a new provider network according to the framework specifications

func (*ProviderNetworkClient) CreateSync added in v1.11.0

CreateSync creates a new provider network according to the framework specifications, and waits for it to be ready.

func (*ProviderNetworkClient) Delete added in v1.11.0

func (c *ProviderNetworkClient) Delete(name string)

Delete deletes a provider network if the provider network exists

func (*ProviderNetworkClient) DeleteSync added in v1.11.0

func (c *ProviderNetworkClient) DeleteSync(name string)

DeleteSync deletes the provider network and waits for the provider network to disappear for `timeout`. If the provider network doesn't disappear before the timeout, it will fail the test.

func (*ProviderNetworkClient) Get added in v1.11.0

func (*ProviderNetworkClient) Patch added in v1.11.0

func (c *ProviderNetworkClient) Patch(original, modified *apiv1.ProviderNetwork) *apiv1.ProviderNetwork

Patch patches the provider network

func (*ProviderNetworkClient) PatchSync added in v1.11.0

func (c *ProviderNetworkClient) PatchSync(original, modified *apiv1.ProviderNetwork, requiredNodes []string, timeout time.Duration) *apiv1.ProviderNetwork

PatchSync patches the provider network and waits for the provider network to be ready for `timeout`. If the provider network doesn't become ready before the timeout, it will fail the test.

func (*ProviderNetworkClient) WaitConditionToBe added in v1.11.0

func (c *ProviderNetworkClient) WaitConditionToBe(name, node string, conditionType apiv1.ConditionType, wantTrue bool, deadline time.Time) bool

WaitConditionToBe returns whether provider network "name's" condition state matches wantTrue within timeout. If wantTrue is true, it will ensure the provider network condition status is ConditionTrue; if it's false, it ensures the provider network condition is in any state other than ConditionTrue (e.g. not true or unknown).

func (*ProviderNetworkClient) WaitToBeReady added in v1.11.0

func (c *ProviderNetworkClient) WaitToBeReady(name string, timeout time.Duration) bool

WaitToBeReady returns whether the provider network is ready within timeout.

func (*ProviderNetworkClient) WaitToBeUpdated added in v1.11.0

func (c *ProviderNetworkClient) WaitToBeUpdated(pn *apiv1.ProviderNetwork, timeout time.Duration) bool

WaitToBeUpdated returns whether the provider network is updated within timeout.

func (*ProviderNetworkClient) WaitToDisappear added in v1.11.0

func (c *ProviderNetworkClient) WaitToDisappear(name string, interval, timeout time.Duration) error

WaitToDisappear waits the given timeout duration for the specified provider network to disappear.

type ServiceClient added in v1.11.0

type ServiceClient struct {
	v1core.ServiceInterface
	// contains filtered or unexported fields
}

ServiceClient is a struct for service client.

func (*ServiceClient) Create added in v1.11.0

func (c *ServiceClient) Create(service *corev1.Service) *corev1.Service

Create creates a new service according to the framework specifications

func (*ServiceClient) CreateSync added in v1.11.0

func (c *ServiceClient) CreateSync(service *corev1.Service) *corev1.Service

CreateSync creates a new service according to the framework specifications, and waits for it to be updated.

func (*ServiceClient) Delete added in v1.11.0

func (c *ServiceClient) Delete(name string)

Delete deletes a service if the service exists

func (*ServiceClient) DeleteSync added in v1.11.0

func (c *ServiceClient) DeleteSync(name string)

DeleteSync deletes the service and waits for the service to disappear for `timeout`. If the service doesn't disappear before the timeout, it will fail the test.

func (*ServiceClient) Get added in v1.11.0

func (s *ServiceClient) Get(name string) *corev1.Service

func (*ServiceClient) WaitToBeUpdated added in v1.11.0

func (c *ServiceClient) WaitToBeUpdated(service *corev1.Service) bool

WaitToBeUpdated returns whether the service is updated within timeout.

func (*ServiceClient) WaitToDisappear added in v1.11.0

func (c *ServiceClient) WaitToDisappear(name string, interval, timeout time.Duration) error

WaitToDisappear waits the given timeout duration for the specified service to disappear.

type SubnetClient added in v1.11.0

type SubnetClient struct {
	v1.SubnetInterface
	// contains filtered or unexported fields
}

SubnetClient is a struct for subnet client.

func (*SubnetClient) Create added in v1.11.0

func (c *SubnetClient) Create(subnet *apiv1.Subnet) *apiv1.Subnet

Create creates a new subnet according to the framework specifications

func (*SubnetClient) CreateSync added in v1.11.0

func (c *SubnetClient) CreateSync(subnet *apiv1.Subnet) *apiv1.Subnet

CreateSync creates a new subnet according to the framework specifications, and waits for it to be ready.

func (*SubnetClient) Delete added in v1.11.0

func (c *SubnetClient) Delete(name string)

Delete deletes a subnet if the subnet exists

func (*SubnetClient) DeleteSync added in v1.11.0

func (c *SubnetClient) DeleteSync(name string)

DeleteSync deletes the subnet and waits for the subnet to disappear for `timeout`. If the subnet doesn't disappear before the timeout, it will fail the test.

func (*SubnetClient) Get added in v1.11.0

func (s *SubnetClient) Get(name string) *apiv1.Subnet

func (*SubnetClient) Patch added in v1.11.0

func (c *SubnetClient) Patch(original, modified *apiv1.Subnet, timeout time.Duration) *apiv1.Subnet

Patch patches the subnet

func (*SubnetClient) PatchSync added in v1.11.0

func (c *SubnetClient) PatchSync(original, modified *apiv1.Subnet) *apiv1.Subnet

PatchSync patches the subnet and waits for the subnet to be ready for `timeout`. If the subnet doesn't become ready before the timeout, it will fail the test.

func (*SubnetClient) Update added in v1.11.0

func (c *SubnetClient) Update(subnet *apiv1.Subnet, options metav1.UpdateOptions, timeout time.Duration) *apiv1.Subnet

Update updates the subnet

func (*SubnetClient) UpdateSync added in v1.11.0

func (c *SubnetClient) UpdateSync(subnet *apiv1.Subnet, options metav1.UpdateOptions, timeout time.Duration) *apiv1.Subnet

UpdateSync updates the subnet and waits for the subnet to be ready for `timeout`. If the subnet doesn't become ready before the timeout, it will fail the test.

func (*SubnetClient) WaitConditionToBe added in v1.11.0

func (c *SubnetClient) WaitConditionToBe(name string, conditionType apiv1.ConditionType, wantTrue bool, timeout time.Duration) bool

WaitConditionToBe returns whether subnet "name's" condition state matches wantTrue within timeout. If wantTrue is true, it will ensure the subnet condition status is ConditionTrue; if it's false, it ensures the subnet condition is in any state other than ConditionTrue (e.g. not true or unknown).

func (*SubnetClient) WaitToBeReady added in v1.11.0

func (c *SubnetClient) WaitToBeReady(name string, timeout time.Duration) bool

WaitToBeReady returns whether the subnet is ready within timeout.

func (*SubnetClient) WaitToBeUpdated added in v1.11.0

func (c *SubnetClient) WaitToBeUpdated(subnet *apiv1.Subnet, timeout time.Duration) bool

WaitToBeUpdated returns whether the subnet is updated within timeout.

func (*SubnetClient) WaitToDisappear added in v1.11.0

func (c *SubnetClient) WaitToDisappear(name string, interval, timeout time.Duration) error

WaitToDisappear waits the given timeout duration for the specified subnet to disappear.

type VlanClient added in v1.11.0

type VlanClient struct {
	v1.VlanInterface
	// contains filtered or unexported fields
}

VlanClient is a struct for vlan client.

func (*VlanClient) Create added in v1.11.0

func (c *VlanClient) Create(pn *apiv1.Vlan) *apiv1.Vlan

Create creates a new vlan according to the framework specifications

func (*VlanClient) Delete added in v1.11.0

func (c *VlanClient) Delete(name string, options metav1.DeleteOptions)

Delete deletes a vlan if the vlan exists

func (*VlanClient) Get added in v1.11.0

func (s *VlanClient) Get(name string) *apiv1.Vlan

func (*VlanClient) Patch added in v1.11.0

func (c *VlanClient) Patch(original, modified *apiv1.Vlan, timeout time.Duration) *apiv1.Vlan

Patch patches the vlan

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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