From 9ce8241ead36302454d83c4759dbbf15b49859e5 Mon Sep 17 00:00:00 2001 From: Andy Chen Date: Fri, 11 Aug 2023 15:15:24 -0700 Subject: [PATCH] test(canary): rollback without steps when it's within the rollback window Signed-off-by: Andy Chen --- rollout/canary_test.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/rollout/canary_test.go b/rollout/canary_test.go index 3e6b57be51..09a7c319e9 100644 --- a/rollout/canary_test.go +++ b/rollout/canary_test.go @@ -846,32 +846,27 @@ func TestRollBackToStable(t *testing.T) { assert.Equal(t, calculatePatch(r2, expectedPatch), patch) } -func TestRollBackToActiveReplicaSetWithinWindow(t *testing.T) { +func TestRollBackToActiveWithinRollbackWindow(t *testing.T) { f := newFixture(t) defer f.Close() steps := []v1alpha1.CanaryStep{{ SetWeight: int32Ptr(10), }} - r1 := newCanaryRollout("foo", 10, int32Ptr(1), steps, int32Ptr(0), intstr.FromInt(1), intstr.FromInt(0)) r1.Spec.RollbackWindow = &v1alpha1.RollbackWindowSpec{ Revisions: 1, } - - rs1 := newReplicaSetWithStatus(r1, 10, 10) - rs1.CreationTimestamp = metav1.Time{Time: time.Now().Add(-10 * time.Minute)} r2 := bumpVersion(r1) - rs2 := newReplicaSetWithStatus(r2, 10, 10) - rs2.CreationTimestamp = metav1.Time{Time: time.Now().Add(-1 * time.Minute)} - + rs2 := newReplicaSetWithStatus(r2, 1, 1) r2.Spec.Template = r1.Spec.Template - rs2PodHash := rs2.Labels[v1alpha1.DefaultRolloutUniqueLabelKey] + rs1 := newReplicaSetWithStatus(r1, 9, 9) + rs1PodHash := rs1.Labels[v1alpha1.DefaultRolloutUniqueLabelKey] f.kubeobjects = append(f.kubeobjects, rs1, rs2) f.replicaSetLister = append(f.replicaSetLister, rs1, rs2) - r2 = updateCanaryRolloutStatus(r2, rs2PodHash, 10, 10, 10, false) + r2 = updateCanaryRolloutStatus(r2, rs1PodHash, 10, 9, 10, false) f.rolloutLister = append(f.rolloutLister, r2) f.objects = append(f.objects, r2)