Skip to content

Commit d19a74f

Browse files
committed
test: fix flaky report diff e2e
Signed-off-by: Wantong Jiang <[email protected]>
1 parent aa55878 commit d19a74f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

test/e2e/placement_drift_diff_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1383,6 +1383,10 @@ var _ = Describe("report diff mode", func() {
13831383
}
13841384
}
13851385

1386+
// With workapplier's backoff requeue enabled, it takes longer to report the new diff results.
1387+
// The backoff logic is: 1 attempt after 5s (fixed delay), 2nd attempt after 2s (initial delay for slow backoff),
1388+
// fast backoff with exponential rate of 1.5x (as diff report succeeded).
1389+
// The test takes ~25s to reach this point, so workloadEventuallyDuration (45s) should be enough to cover the backoff delays.
13861390
Eventually(func() error {
13871391
crp := &placementv1beta1.ClusterResourcePlacement{}
13881392
if err := hubClient.Get(ctx, types.NamespacedName{Name: crpName}, crp); err != nil {
@@ -1394,7 +1398,7 @@ var _ = Describe("report diff mode", func() {
13941398
return fmt.Errorf("CRP status diff (-got, +want): %s", diff)
13951399
}
13961400
return nil
1397-
}, eventuallyDuration, eventuallyInterval).Should(Succeed(), "Failed to update CRP status as expected")
1401+
}, workloadEventuallyDuration, eventuallyInterval).Should(Succeed(), "Failed to update CRP status as expected")
13981402
})
13991403

14001404
AfterAll(func() {

test/e2e/resource_placement_drift_diff_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1556,6 +1556,10 @@ var _ = Describe("report diff mode using RP", Label("resourceplacement"), func()
15561556
}
15571557
}
15581558

1559+
// With workapplier's backoff requeue enabled, it takes longer to report the new diff results.
1560+
// The backoff logic is: 1 attempt after 5s (fixed delay), 2nd attempt after 2s (initial delay for slow backoff),
1561+
// fast backoff with exponential rate of 1.5x (as diff report succeeded).
1562+
// The test takes ~25s to reach this point, so workloadEventuallyDuration (45s) should be enough to cover the backoff delays.
15591563
Eventually(func() error {
15601564
rp := &placementv1beta1.ResourcePlacement{}
15611565
if err := hubClient.Get(ctx, types.NamespacedName{Name: rpName, Namespace: nsName}, rp); err != nil {
@@ -1567,7 +1571,7 @@ var _ = Describe("report diff mode using RP", Label("resourceplacement"), func()
15671571
return fmt.Errorf("RP status diff (-got, +want): %s", diff)
15681572
}
15691573
return nil
1570-
}, eventuallyDuration, eventuallyInterval).Should(Succeed(), "Failed to update RP status as expected")
1574+
}, workloadEventuallyDuration, eventuallyInterval).Should(Succeed(), "Failed to update RP status as expected")
15711575
})
15721576

15731577
AfterAll(func() {

0 commit comments

Comments
 (0)