Skip to content

Commit

Permalink
add locklost failure case
Browse files Browse the repository at this point in the history
  • Loading branch information
karenychen committed Aug 5, 2024
1 parent 51d950d commit 8678b29
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions v2/lockrenewer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,24 @@ func Test_RenewRetry(t *testing.T) {
g.Expect(tc.processorCtx.Err()).To(BeNil())
},
},
{
name: "should not retry if renew fails for LockLost error",
settler: &fakeSBRenewLockSettler{
Err: &azservicebus.Error{Code: azservicebus.CodeLockLost},
},
msgLockedDuration: 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(1))) },
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 canceled",
settler: &fakeSBRenewLockSettler{
Expand Down

0 comments on commit 8678b29

Please sign in to comment.