diff --git a/test/e2e/canary_test.go b/test/e2e/canary_test.go index 00b588c598..fe22175074 100644 --- a/test/e2e/canary_test.go +++ b/test/e2e/canary_test.go @@ -443,7 +443,7 @@ spec: port: 80 periodSeconds: 30 strategy: - canary: + canary: steps: - setWeight: 20 - pause: {} @@ -539,7 +539,24 @@ func (s *CanarySuite) TestCanaryScaleDownOnAbort() { AbortRollout(). WaitForRolloutStatus("Degraded"). Then(). - //Expect that the canary service selector has been moved back to stable + // Expect that the canary service selector has been moved back to stable + ExpectServiceSelector("canary-scaledowndelay-canary", map[string]string{"app": "canary-scaledowndelay", "rollouts-pod-template-hash": "66597877b7"}, false). + When(). + Sleep(3*time.Second). + Then(). + ExpectRevisionPodCount("2", 0) +} + +func (s *CanarySuite) TestCanaryScaleDownOnAbortNoTrafficRouting() { + s.Given(). + HealthyRollout(`@functional/canary-scaledownonabortnotrafficrouting.yaml`). + When(). + UpdateSpec(). // update to revision 2 + WaitForRolloutStatus("Paused"). + AbortRollout(). + WaitForRolloutStatus("Degraded"). + Then(). + // Expect that the canary service selector has been moved back to stable ExpectServiceSelector("canary-scaledowndelay-canary", map[string]string{"app": "canary-scaledowndelay", "rollouts-pod-template-hash": "66597877b7"}, false). When(). Sleep(3*time.Second). @@ -590,7 +607,7 @@ func (s *CanarySuite) TestCanaryDynamicStableScale() { WaitForRevisionPodCount("2", 1). Then(). ExpectRevisionPodCount("1", 4). - //Assert that the canary service selector is still not set to stable rs because of dynamic stable scale still in progress + // Assert that the canary service selector is still not set to stable rs because of dynamic stable scale still in progress Assert(func(t *fixtures.Then) { canarySvc, stableSvc := t.GetServices() assert.NotEqual(s.T(), canarySvc.Spec.Selector["rollouts-pod-template-hash"], stableSvc.Spec.Selector["rollouts-pod-template-hash"]) @@ -599,7 +616,7 @@ func (s *CanarySuite) TestCanaryDynamicStableScale() { MarkPodsReady("1", 1). // mark last remaining stable pod as ready (4/4 stable are ready) WaitForRevisionPodCount("2", 0). Then(). - //Expect that the canary service selector is now set to stable because of dynamic stable scale is over and we have all pods up on stable rs + // Expect that the canary service selector is now set to stable because of dynamic stable scale is over and we have all pods up on stable rs ExpectServiceSelector("dynamic-stable-scale-canary", map[string]string{"app": "dynamic-stable-scale", "rollouts-pod-template-hash": "868d98995b"}, false). ExpectRevisionPodCount("1", 4) } diff --git a/test/e2e/functional/canary-scaledownonabortnotrafficrouting.yaml b/test/e2e/functional/canary-scaledownonabortnotrafficrouting.yaml new file mode 100644 index 0000000000..0c42735db3 --- /dev/null +++ b/test/e2e/functional/canary-scaledownonabortnotrafficrouting.yaml @@ -0,0 +1,91 @@ +apiVersion: v1 +kind: Service +metadata: + name: canary-scaledowndelay-root +spec: + type: NodePort + ports: + - port: 80 + targetPort: http + protocol: TCP + name: http + selector: + app: canary-scaledowndelay +--- +apiVersion: v1 +kind: Service +metadata: + name: canary-scaledowndelay-canary +spec: + type: NodePort + ports: + - port: 80 + targetPort: http + protocol: TCP + name: http + selector: + app: canary-scaledowndelay +--- +apiVersion: v1 +kind: Service +metadata: + name: canary-scaledowndelay-stable +spec: + type: NodePort + ports: + - port: 80 + targetPort: http + protocol: TCP + name: http + selector: + app: canary-scaledowndelay +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: canary-scaledowndelay-ingress + annotations: + kubernetes.io/ingress.class: alb +spec: + rules: + - http: + paths: + - path: /* + pathType: Prefix + backend: + service: + name: canary-scaledowndelay-root + port: + name: use-annotation +--- +apiVersion: argoproj.io/v1alpha1 +kind: Rollout +metadata: + name: canary-scaledownd-on-abort +spec: + selector: + matchLabels: + app: canary-scaledowndelay + template: + metadata: + labels: + app: canary-scaledowndelay + spec: + containers: + - name: canary-scaledowndelay + image: nginx:1.19-alpine + ports: + - name: http + containerPort: 80 + protocol: TCP + resources: + requests: + memory: 16Mi + cpu: 5m + strategy: + canary: + canaryService: canary-scaledowndelay-canary + stableService: canary-scaledowndelay-stable + steps: + - setWeight: 50 + - pause: {}