test

package
v0.0.0-...-f496b69 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Eventually

func Eventually(t *testing.T, name string, cond Condition)

Eventually polls cond until it completes (returns true) or times out (resulting in a test failure).

Types

type Condition

type Condition func() bool

A Condition is a function that returns true when a test condition is satisfied.

type EventualOpts

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

EventualOpts defines a polling strategy for operations that must eventually succeed. A new EventualOpts must be provided for each invocation of Eventually (or call Reset on a previously completed set of options).

func NewEventualOpts

func NewEventualOpts(interval, deadline time.Duration) *EventualOpts

NewEventualOpts constructs an EventualOpts instance with the provided polling interval and deadline. EventualOpts will perform randomized exponential backoff using the starting interval, and will stop polling (and therefore fail) after deadline time as elapsed from calling Eventually.

Note: we always backoff with a randomization of 0.5 (50%), a multiplier of 1.5, and a max interval of one minute.

func (EventualOpts) Eventually

func (e EventualOpts) Eventually(t *testing.T, name string, cond Condition)

Eventually polls cond until it succeeds (returns true) or we exceed the deadline. Eventually performs backoff while polling cond.

name is printed as part of the test failure message when we exceed the deadline to help identify the test case failing. cond does not need to be thread-safe: it is only called from the current goroutine. cond itself can also fail the test early using t.Fatal.

type FakeConfigMapController

type FakeConfigMapController struct {
	GetError          error
	PutError          error
	ConfigmapToReturn *k8sCoreV1.ConfigMap
}

func (*FakeConfigMapController) GetConfigMap

func (*FakeConfigMapController) GetIPPrefixForServiceEntries

func (c *FakeConfigMapController) GetIPPrefixForServiceEntries() (seIpPrefix string)

func (*FakeConfigMapController) PutConfigMap

func (c *FakeConfigMapController) PutConfigMap(ctx context.Context, newMap *k8sCoreV1.ConfigMap) error

type MockDependencyHandler

type MockDependencyHandler struct {
}

func (*MockDependencyHandler) Added

func (m *MockDependencyHandler) Added(ctx context.Context, obj *v1.Dependency)

func (*MockDependencyHandler) Deleted

func (m *MockDependencyHandler) Deleted(ctx context.Context, obj *v1.Dependency)

func (*MockDependencyHandler) Updated

func (m *MockDependencyHandler) Updated(ctx context.Context, obj *v1.Dependency)

type MockDeploymentHandler

type MockDeploymentHandler struct {
}

func (*MockDeploymentHandler) Added

func (*MockDeploymentHandler) Deleted

type MockDestinationRuleHandler

type MockDestinationRuleHandler struct {
	Obj *v1alpha32.DestinationRule
}

func (*MockDestinationRuleHandler) Added

func (*MockDestinationRuleHandler) Deleted

func (*MockDestinationRuleHandler) Updated

type MockGlobalTrafficHandler

type MockGlobalTrafficHandler struct {
	Obj *v1.GlobalTrafficPolicy
}

func (*MockGlobalTrafficHandler) Added

func (*MockGlobalTrafficHandler) Deleted

func (*MockGlobalTrafficHandler) Updated

type MockIstioConfigStore

type MockIstioConfigStore struct {
	TestHook func(interface{})
}

func (*MockIstioConfigStore) Delete

func (m *MockIstioConfigStore) Delete(typ, name, namespace string) error

func (*MockIstioConfigStore) HasSynced

func (m *MockIstioConfigStore) HasSynced() bool

func (*MockIstioConfigStore) Run

func (m *MockIstioConfigStore) Run(stop <-chan struct{})

type MockNodeHandler

type MockNodeHandler struct {
	Obj *k8sCoreV1.Node
}

func (*MockNodeHandler) Added

func (m *MockNodeHandler) Added(obj *k8sCoreV1.Node)

func (*MockNodeHandler) Deleted

func (m *MockNodeHandler) Deleted(obj *k8sCoreV1.Node)

type MockPodHandler

type MockPodHandler struct {
}

func (MockPodHandler) Added

func (m MockPodHandler) Added(obj *k8sCoreV1.Pod)

func (MockPodHandler) Deleted

func (m MockPodHandler) Deleted(obj *k8sCoreV1.Pod)

type MockRolloutHandler

type MockRolloutHandler struct {
}

func (*MockRolloutHandler) Added

func (m *MockRolloutHandler) Added(ctx context.Context, obj *argo.Rollout)

func (*MockRolloutHandler) Deleted

func (m *MockRolloutHandler) Deleted(ctx context.Context, obj *argo.Rollout)

func (*MockRolloutHandler) Updated

func (m *MockRolloutHandler) Updated(ctx context.Context, obj *argo.Rollout)

type MockRoutingPolicyHandler

type MockRoutingPolicyHandler struct {
	Obj *v1.RoutingPolicy
}

func (*MockRoutingPolicyHandler) Added

func (*MockRoutingPolicyHandler) Deleted

func (*MockRoutingPolicyHandler) Updated

type MockServiceEntryHandler

type MockServiceEntryHandler struct {
	Obj *v1alpha32.ServiceEntry
}

func (*MockServiceEntryHandler) Added

func (*MockServiceEntryHandler) Deleted

func (*MockServiceEntryHandler) Updated

type MockServiceHandler

type MockServiceHandler struct {
}

func (*MockServiceHandler) Added

func (m *MockServiceHandler) Added(ctx context.Context, obj *k8sCoreV1.Service)

func (*MockServiceHandler) Deleted

func (m *MockServiceHandler) Deleted(ctx context.Context, obj *k8sCoreV1.Service)

func (*MockServiceHandler) Updated

func (m *MockServiceHandler) Updated(ctx context.Context, obj *k8sCoreV1.Service)

type MockSidecarHandler

type MockSidecarHandler struct {
	Obj *v1alpha32.Sidecar
}

func (*MockSidecarHandler) Added

func (m *MockSidecarHandler) Added(ctx context.Context, obj *v1alpha32.Sidecar)

func (*MockSidecarHandler) Deleted

func (m *MockSidecarHandler) Deleted(ctx context.Context, obj *v1alpha32.Sidecar)

func (*MockSidecarHandler) Updated

func (m *MockSidecarHandler) Updated(ctx context.Context, obj *v1alpha32.Sidecar)

type MockVirtualServiceHandler

type MockVirtualServiceHandler struct {
	Obj *v1alpha32.VirtualService
}

func (*MockVirtualServiceHandler) Added

func (*MockVirtualServiceHandler) Deleted

func (*MockVirtualServiceHandler) Updated

Jump to

Keyboard shortcuts

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