Skip to content

Commit

Permalink
one more UT
Browse files Browse the repository at this point in the history
  • Loading branch information
karenychen committed Aug 5, 2024
1 parent d73c081 commit 7933295
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion v2/lockrenewer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,25 @@ func Test_RenewRetry(t *testing.T) {
},
},
{
name: "should not retry if renew fails for an error other than context canceled",
name: "should not retry if renew fails for unknown error",
settler: &fakeSBRenewLockSettler{
Err: fmt.Errorf("unknown error"),
},
msgLockedUntil: to.Ptr(time.Now().Add(1 * time.Minute)),
renewTimeout: to.Ptr(100 * time.Millisecond),
verify: func(g Gomega, tc *testCase, metrics *processor.Informer) {
// should renew 3 times before message completes at 180ms
g.Eventually(
func(g Gomega) { g.Expect(tc.settler.RenewCalled.Load()).To(Equal(int32(3))) },
180*time.Millisecond,
20*time.Millisecond).Should(Succeed())
g.Expect(tc.gotMessageCtx.Err()).To(Equal(context.Canceled))
// processor context healthy because we finished early
g.Expect(tc.processorCtx.Err()).To(BeNil())
},
},
{
name: "should not retry if renew fails due to context timeout exceeded",
settler: &fakeSBRenewLockSettler{
Err: context.DeadlineExceeded,
},
Expand Down

0 comments on commit 7933295

Please sign in to comment.