fixtures

package
v1.6.6 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Apache-2.0 Imports: 68 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// E2E_INSTANCE_ID is the instance id label attached to objects created by the e2e tests
	EnvVarE2EInstanceID = "E2E_INSTANCE_ID"
	// E2E_WAIT_TIMEOUT is a timeout in seconds when waiting for a test condition (default: 90)
	EnvVarE2EWaitTimeout = "E2E_WAIT_TIMEOUT"
	// E2E_POD_DELAY slows down pod startup and shutdown by the value in seconds (default: 0)
	// Used humans slow down rollout activity during a test
	EnvVarE2EPodDelay = "E2E_POD_DELAY"
	// EnvVarE2EImagePrefix is a prefix that will be prefixed to images used by the e2e tests
	EnvVarE2EImagePrefix = "E2E_IMAGE_PREFIX"
	// E2E_DEBUG makes e2e testing easier to debug by not tearing down the suite
	EnvVarE2EDebug = "E2E_DEBUG"
	// E2E_ALB_INGESS_ANNOTATIONS is a map of annotations to apply to ingress for AWS Load Balancer Controller
	EnvVarE2EALBIngressAnnotations = "E2E_ALB_INGESS_ANNOTATIONS"
	// E2E_KLOG_LEVEL controls the kuberntes klog level for e2e tests
	EnvVarE2EKLogLevel = "E2E_KLOG_LEVEL"
)

Variables

View Source
var (
	E2EWaitTimeout time.Duration = time.Second * 120
	E2EPodDelay                  = 0

	E2EALBIngressAnnotations map[string]string

	// All e2e tests will be labeled with this instance-id (unless E2E_INSTANCE_ID="")
	E2ELabelValueInstanceID = "argo-rollouts-e2e"
	// All e2e tests will be labeled with their test name
	E2ELabelKeyTestName = "e2e-test-name"
)

Functions

This section is empty.

Types

type AnalysisRunExpectation

type AnalysisRunExpectation func(*rov1.AnalysisRun) bool

type AnalysisRunListExpectation

type AnalysisRunListExpectation func(*rov1.AnalysisRunList) bool

type Common

type Common struct {
	Context context.Context
	// contains filtered or unexported fields
}

func (*Common) ApplyManifests added in v0.9.2

func (c *Common) ApplyManifests(text string)

ApplyManifests kubectl applys the given YAML string or file path: 1. A file name if it starts with "@" 2. Raw YAML.

func (*Common) CheckError

func (c *Common) CheckError(err error)

func (*Common) GetALBIngress added in v1.1.0

func (c *Common) GetALBIngress() *networkingv1.Ingress

func (*Common) GetALBIngresses added in v1.6.0

func (c *Common) GetALBIngresses() []*networkingv1.Ingress

func (*Common) GetApisixRoute added in v1.4.0

func (c *Common) GetApisixRoute() *unstructured.Unstructured

func (*Common) GetApisixSetHeaderRoute added in v1.5.0

func (c *Common) GetApisixSetHeaderRoute() *unstructured.Unstructured

func (*Common) GetAppMeshVirtualRouter added in v1.2.0

func (c *Common) GetAppMeshVirtualRouter() *unstructured.Unstructured

func (*Common) GetBackgroundAnalysisRun

func (c *Common) GetBackgroundAnalysisRun() *rov1.AnalysisRun

func (*Common) GetDestinationRule added in v1.0.0

func (c *Common) GetDestinationRule() *istio.DestinationRule

func (*Common) GetExperimentAnalysisRun added in v0.10.1

func (c *Common) GetExperimentAnalysisRun(exp *rov1.Experiment) *rov1.AnalysisRun

GetExperimentAnalysisRun returns the AnalysisRun associated with the experiment. Errors if there is more than one.

func (*Common) GetExperimentByName added in v1.1.0

func (c *Common) GetExperimentByName(name string) *rov1.Experiment

func (*Common) GetExperimentByRevision added in v0.10.1

func (c *Common) GetExperimentByRevision(revision string) *rov1.Experiment

func (*Common) GetInlineAnalysisRun

func (c *Common) GetInlineAnalysisRun() *rov1.AnalysisRun

GetInlineAnalysisRun returns the latest Step analysis run. This should generally be coupled with a count check, to ensure we are not checking the previous one. This may fail to accurately return the latest if the creationTimestamps are the same

func (*Common) GetJobFromAnalysisRun added in v0.10.1

func (c *Common) GetJobFromAnalysisRun(ar *rov1.AnalysisRun) *batchv1.Job

GetJobFromAnalysisRun returns the Job associated with the AnalysisRun. Errors if there is more than one.

func (*Common) GetNginxIngressCanary added in v1.2.0

func (c *Common) GetNginxIngressCanary() *networkingv1.Ingress

func (*Common) GetNginxIngressStable added in v1.2.0

func (c *Common) GetNginxIngressStable() *networkingv1.Ingress

func (*Common) GetPodsByRevision added in v0.10.0

func (c *Common) GetPodsByRevision(revision string) *corev1.PodList

func (*Common) GetPostPromotionAnalysisRun added in v0.10.0

func (c *Common) GetPostPromotionAnalysisRun() *rov1.AnalysisRun

func (*Common) GetPrePromotionAnalysisRun added in v0.10.0

func (c *Common) GetPrePromotionAnalysisRun() *rov1.AnalysisRun

func (*Common) GetReplicaSetByRevision added in v0.9.2

func (c *Common) GetReplicaSetByRevision(revision string) *appsv1.ReplicaSet

func (*Common) GetReplicaSetFromExperiment added in v0.10.1

func (c *Common) GetReplicaSetFromExperiment(exp *rov1.Experiment, templateName string) *appsv1.ReplicaSet

func (*Common) GetRollout added in v1.6.1

func (c *Common) GetRollout() *rov1.Rollout

GetRollout returns the live rollout object in the cluster

func (*Common) GetRolloutAnalysisRuns

func (c *Common) GetRolloutAnalysisRuns() rov1.AnalysisRunList

func (*Common) GetRolloutEventReasons added in v1.0.0

func (c *Common) GetRolloutEventReasons() []string

func (*Common) GetRolloutExperiments added in v0.10.1

func (c *Common) GetRolloutExperiments() rov1.ExperimentList

func (*Common) GetServices added in v1.0.0

func (c *Common) GetServices() (*corev1.Service, *corev1.Service)

GetServices() returns the desired (aka preview/canary) and stable (aka active) services

func (*Common) GetTrafficSplit added in v1.1.0

func (c *Common) GetTrafficSplit() *smiv1alpha1.TrafficSplit

func (*Common) GetVirtualService added in v1.0.0

func (c *Common) GetVirtualService() *istio.VirtualService

func (*Common) MarkPodsReady added in v1.1.0

func (c *Common) MarkPodsReady(revision string, quantity int) int

MarkPodsReady is a helper to mark the readiness gates of pods of a particular revision as ready.

func (*Common) PrintExperiment added in v1.1.0

func (c *Common) PrintExperiment(name string)

func (*Common) PrintExperimentEvents added in v1.1.0

func (c *Common) PrintExperimentEvents(ex *v1alpha1.Experiment)

PrintExperimentEvents prints all Kubernetes events associated with the given experiment.

func (*Common) PrintExperimentYAML added in v1.1.0

func (c *Common) PrintExperimentYAML(ex *rov1.Experiment)

func (*Common) PrintObjectEvents added in v1.1.0

func (c *Common) PrintObjectEvents(opts metav1.ListOptions)

PrintObjectEvents prints all Kubernetes events associated with the given object. Note that events may be deduplicated, or printed out-of-order from when they were emitted, so this function should only be used to assist with debugging and not correctness.

func (*Common) PrintRollout

func (c *Common) PrintRollout(name string)

func (*Common) PrintRolloutEvents added in v1.0.0

func (c *Common) PrintRolloutEvents(ro *v1alpha1.Rollout)

PrintRolloutEvents prints all Kubernetes events associated with the given rollout.

func (*Common) PrintRolloutYAML added in v0.10.2

func (c *Common) PrintRolloutYAML(ro *rov1.Rollout)

func (*Common) Rollout added in v0.9.2

func (c *Common) Rollout() *rov1.Rollout

Rollout returns the original rollout manifest used in the test

func (*Common) SetLabels added in v1.0.0

func (c *Common) SetLabels(obj *unstructured.Unstructured)

func (*Common) StartEventWatch added in v1.0.0

func (c *Common) StartEventWatch(ctx context.Context)

We use a watch to collect events (as opposed to listing them after-the-fact), because: 1. the kubernetes event recorder can dedupe multiple events into one Event object 2. listing events may return events out-of-order from when they were produced

type E2ESuite

type E2ESuite struct {
	suite.Suite
	Common

	IstioEnabled   bool
	SMIEnabled     bool
	AppMeshEnabled bool
	ApisixEnabled  bool
}

func (*E2ESuite) AfterTest

func (s *E2ESuite) AfterTest(suiteName, testName string)

func (*E2ESuite) BeforeTest

func (s *E2ESuite) BeforeTest(suiteName, testName string)

func (*E2ESuite) Given

func (s *E2ESuite) Given() *Given

func (*E2ESuite) Run

func (s *E2ESuite) Run(name string, subtest func())

func (*E2ESuite) SetupSuite

func (s *E2ESuite) SetupSuite()

func (*E2ESuite) TearDownSuite

func (s *E2ESuite) TearDownSuite()

type ExperimentExpectation added in v0.10.1

type ExperimentExpectation func(*rov1.Experiment) bool

type ExperimentListExpectation added in v0.10.1

type ExperimentListExpectation func(*rov1.ExperimentList) bool

type ExperimentServiceListExpectation added in v1.1.0

type ExperimentServiceListExpectation func(map[string]*corev1.Service) bool

type ExperimentTemplateReplicaSetExpectation added in v1.1.0

type ExperimentTemplateReplicaSetExpectation func(set *appsv1.ReplicaSet) bool

type Given

type Given struct {
	*Common
}

func (*Given) HealthyRollout

func (g *Given) HealthyRollout(text string) *Given

HealthyRollout is a convenience around creating a rollout and waiting for it to become healthy

func (*Given) RolloutObjects

func (g *Given) RolloutObjects(text string) *Given

RolloutObjects sets up the rollout objects for the test environment given a YAML string or file path: 1. A file name if it starts with "@" 2. Raw YAML.

func (*Given) RolloutTemplate

func (g *Given) RolloutTemplate(text, name string) *Given

func (*Given) SetSteps

func (g *Given) SetSteps(text string) *Given

func (*Given) StartEventWatch added in v1.0.0

func (g *Given) StartEventWatch(ctx context.Context) *Given

func (*Given) When

func (g *Given) When() *When

type PodExpectation

type PodExpectation func(*corev1.PodList) bool

type ReplicaSetExpectation

type ReplicaSetExpectation func(*appsv1.ReplicaSetList) bool

type ReplicasetExpectation added in v1.1.0

type ReplicasetExpectation func(*appsv1.ReplicaSet) bool

type RolloutExpectation

type RolloutExpectation func(*rov1.Rollout) bool

type Then

type Then struct {
	*Common
}

func (*Then) Assert added in v0.10.1

func (t *Then) Assert(assertFunc func(t *Then)) *Then

func (*Then) ExpectActiveRevision added in v0.9.2

func (t *Then) ExpectActiveRevision(revision string) *Then

ExpectActiveRevision verifies the active service selector is pointing to the specified revision

func (*Then) ExpectAnalysisRunCount

func (t *Then) ExpectAnalysisRunCount(expectedCount int) *Then

func (*Then) ExpectAnalysisRuns

func (t *Then) ExpectAnalysisRuns(expectation string, expectFunc AnalysisRunListExpectation) *Then

func (*Then) ExpectBackgroundAnalysisRun

func (t *Then) ExpectBackgroundAnalysisRun(expectation string, expectFunc AnalysisRunExpectation) *Then

func (*Then) ExpectBackgroundAnalysisRunPhase

func (t *Then) ExpectBackgroundAnalysisRunPhase(phase string) *Then

func (*Then) ExpectCanaryStablePodCount

func (t *Then) ExpectCanaryStablePodCount(canaryCount, stableCount int) *Then

func (*Then) ExpectExperimentByRevision added in v0.10.1

func (t *Then) ExpectExperimentByRevision(expectation string, revision string, expectFunc ExperimentExpectation) *Then

func (*Then) ExpectExperimentByRevisionPhase added in v0.10.1

func (t *Then) ExpectExperimentByRevisionPhase(revision string, phase string) *Then

func (*Then) ExpectExperimentCount added in v0.10.1

func (t *Then) ExpectExperimentCount(expectedCount int) *Then

func (*Then) ExpectExperimentDryRunSummary added in v1.2.0

func (t *Then) ExpectExperimentDryRunSummary(expectedCount, expectedErrorCount, expectedFailureCount int32, experiment string) *Then

func (*Then) ExpectExperimentMeasurementsLength added in v1.2.0

func (t *Then) ExpectExperimentMeasurementsLength(metricResultsIndex, expectedMeasurementsLength int, experiment string) *Then

func (*Then) ExpectExperimentServiceCount added in v1.1.0

func (t *Then) ExpectExperimentServiceCount(experimentName string, expectedCount int) *Then

func (*Then) ExpectExperimentServices added in v1.1.0

func (t *Then) ExpectExperimentServices(expectation string, experiment string, expectFunc ExperimentServiceListExpectation) *Then

func (*Then) ExpectExperimentTemplateReplicaSet added in v1.1.0

func (t *Then) ExpectExperimentTemplateReplicaSet(expectation string, experiment string, template string, expectFunc ExperimentTemplateReplicaSetExpectation) *Then

func (*Then) ExpectExperimentTemplateReplicaSetNumReplicas added in v1.1.0

func (t *Then) ExpectExperimentTemplateReplicaSetNumReplicas(experiment string, template string, expectedReplicas int) *Then

func (*Then) ExpectExperiments added in v0.10.1

func (t *Then) ExpectExperiments(expectation string, expectFunc ExperimentListExpectation) *Then

func (*Then) ExpectInlineAnalysisRun added in v1.0.5

func (t *Then) ExpectInlineAnalysisRun(expectation string, expectFunc AnalysisRunExpectation) *Then

func (*Then) ExpectInlineAnalysisRunPhase added in v1.0.5

func (t *Then) ExpectInlineAnalysisRunPhase(phase string) *Then

func (*Then) ExpectPods

func (t *Then) ExpectPods(expectation string, expectFunc PodExpectation) *Then

func (*Then) ExpectPreviewRevision added in v0.9.2

func (t *Then) ExpectPreviewRevision(revision string) *Then

ExpectPreviewRevision verifies the preview service selector is pointing to the specified revision

func (*Then) ExpectRS added in v1.1.0

func (t *Then) ExpectRS(expectation string, name string, expectFunc ReplicasetExpectation) *Then

func (*Then) ExpectReplicaCounts added in v0.9.2

func (t *Then) ExpectReplicaCounts(desired, current, updated, ready, available interface{}) *Then

func (*Then) ExpectReplicaSets

func (t *Then) ExpectReplicaSets(expectation string, expectFunc ReplicaSetExpectation) *Then

func (*Then) ExpectRevisionPodCount

func (t *Then) ExpectRevisionPodCount(revision string, expectedCount int) *Then

func (*Then) ExpectRevisionPods added in v0.10.0

func (t *Then) ExpectRevisionPods(expectation string, revision string, expectFunc PodExpectation) *Then

func (*Then) ExpectRevisionScaleDown added in v1.1.0

func (t *Then) ExpectRevisionScaleDown(revision string, expectScaleDown bool) *Then

func (*Then) ExpectRollout

func (t *Then) ExpectRollout(expectation string, expectFunc RolloutExpectation) *Then

func (*Then) ExpectRolloutEvents added in v1.0.0

func (t *Then) ExpectRolloutEvents(reasons []string) *Then

func (*Then) ExpectRolloutStatus added in v0.9.2

func (t *Then) ExpectRolloutStatus(expectedStatus string) *Then

func (*Then) ExpectServiceSelector added in v0.9.2

func (t *Then) ExpectServiceSelector(service string, selector map[string]string, ensurePodTemplateHash bool) *Then

func (*Then) ExpectStableRevision added in v0.9.2

func (t *Then) ExpectStableRevision(revision string) *Then

ExpectStableRevision verifies the ReplicaSet with the specified revision is marked stable

func (*Then) Given added in v0.9.3

func (t *Then) Given() *Given

func (*Then) When

func (t *Then) When() *When

type When

type When struct {
	*Common
}

func (*When) AbortRollout

func (w *When) AbortRollout() *When

func (*When) ApplyManifests

func (w *When) ApplyManifests(yaml ...string) *When

func (*When) DeleteObject added in v0.10.2

func (w *When) DeleteObject(kind, name string) *When

func (*When) DeleteRollout

func (w *When) DeleteRollout() *When

func (*When) Given

func (w *When) Given() *Given

func (*When) MarkPodsReady added in v1.1.0

func (w *When) MarkPodsReady(revision string, count int, timeouts ...time.Duration) *When

func (*When) PatchSpec

func (w *When) PatchSpec(patch string) *When

PatchSpec patches the rollout

func (*When) PromoteRollout

func (w *When) PromoteRollout() *When

func (*When) PromoteRolloutFull added in v0.10.0

func (w *When) PromoteRolloutFull() *When

func (*When) RestartRollout

func (w *When) RestartRollout() *When

func (*When) RetryRollout

func (w *When) RetryRollout() *When

func (*When) ScaleRollout

func (w *When) ScaleRollout(scale int) *When

func (*When) Sleep added in v0.9.2

func (w *When) Sleep(d time.Duration) *When

func (*When) StartLoad added in v1.0.0

func (w *When) StartLoad() *When

func (*When) StopLoad added in v1.0.0

func (w *When) StopLoad() *When

func (*When) Then

func (w *When) Then() *Then

func (*When) UndoRollout added in v1.6.1

func (w *When) UndoRollout(toRevision int64) *When

func (*When) UpdateResource added in v1.0.0

func (w *When) UpdateResource(gvr schema.GroupVersionResource, name string, update func(res *unstructured.Unstructured) error) *When

UpdateResource modifies the specified resource

func (*When) UpdateSpec

func (w *When) UpdateSpec(texts ...string) *When

func (*When) Wait added in v1.0.0

func (w *When) Wait(duration time.Duration) *When

func (*When) WaitForActiveRevision added in v0.9.2

func (w *When) WaitForActiveRevision(revision string, timeout ...time.Duration) *When

func (*When) WaitForAnalysisRunCondition

func (w *When) WaitForAnalysisRunCondition(name string, test func(ar *rov1.AnalysisRun) bool, condition string, timeout time.Duration) *When

func (*When) WaitForBackgroundAnalysisRunPhase

func (w *When) WaitForBackgroundAnalysisRunPhase(phase string) *When

func (*When) WaitForExperimentCondition added in v1.1.0

func (w *When) WaitForExperimentCondition(name string, test func(ex *rov1.Experiment) bool, condition string, timeout time.Duration) *When

func (*When) WaitForExperimentPhase added in v1.1.0

func (w *When) WaitForExperimentPhase(name string, phase string) *When

func (*When) WaitForInlineAnalysisRunPhase

func (w *When) WaitForInlineAnalysisRunPhase(phase string) *When

func (*When) WaitForPostPromotionAnalysisRunPhase added in v0.10.0

func (w *When) WaitForPostPromotionAnalysisRunPhase(phase string) *When

func (*When) WaitForPrePromotionAnalysisRunPhase added in v0.10.0

func (w *When) WaitForPrePromotionAnalysisRunPhase(phase string) *When

func (*When) WaitForRevisionPodCount added in v1.1.0

func (w *When) WaitForRevisionPodCount(revision string, count int, timeouts ...time.Duration) *When

func (*When) WaitForRolloutAvailableReplicas

func (w *When) WaitForRolloutAvailableReplicas(count int32, timeout ...time.Duration) *When

func (*When) WaitForRolloutCanaryStepIndex

func (w *When) WaitForRolloutCanaryStepIndex(index int32, timeout ...time.Duration) *When

func (*When) WaitForRolloutCondition

func (w *When) WaitForRolloutCondition(test func(ro *rov1.Rollout) bool, condition string, timeouts ...time.Duration) *When

func (*When) WaitForRolloutReplicas

func (w *When) WaitForRolloutReplicas(count int32, timeout ...time.Duration) *When

func (*When) WaitForRolloutStatus

func (w *When) WaitForRolloutStatus(status string, timeout ...time.Duration) *When

func (*When) WatchRolloutStatus added in v1.0.2

func (w *When) WatchRolloutStatus(expectedStatus string, timeouts ...time.Duration) *When

WatchRolloutStatus returns success if Rollout becomes Healthy within timeout period Returns error is Rollout becomes Degraded or times out

Jump to

Keyboard shortcuts

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