Skip to content

Commit

Permalink
test(canary): rollback without steps when it's within the rollback wi…
Browse files Browse the repository at this point in the history
…ndow

Signed-off-by: Andy Chen <[email protected]>
  • Loading branch information
amazingandyyy committed Aug 11, 2023
1 parent 0d24e36 commit 262c1b4
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions rollout/canary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 262c1b4

Please sign in to comment.