@@ -11,6 +11,7 @@ import (
1111 "github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs/v2/internal/amqpwrap"
1212 "github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs/v2/internal/mock"
1313 "github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs/v2/internal/test"
14+ "github.com/Azure/azure-sdk-for-go/sdk/messaging/azeventhubs/v2/internal/utils"
1415 "github.com/Azure/go-amqp"
1516 "github.com/golang/mock/gomock"
1617 "github.com/stretchr/testify/require"
@@ -26,7 +27,7 @@ func TestLinks_NoOp(t *testing.T) {
2627 })
2728
2829 // no error just no-ops
29- err := links .lr .RecoverIfNeeded (context .Background (), nil )
30+ err := links .lr .RecoverIfNeeded (context .Background (), nil , & utils. RetryFnArgs {} )
3031 require .NoError (t , err )
3132}
3233
@@ -55,13 +56,13 @@ func TestLinks_LinkStale(t *testing.T) {
5556 // we'll recover first, but our lwid (after this recovery) is stale since
5657 // the link cache will be updated after this is done.
5758
58- err = links .lr .RecoverIfNeeded (context .Background (), lwidToError (& amqp.LinkError {}, staleLWID ))
59+ err = links .lr .RecoverIfNeeded (context .Background (), lwidToError (& amqp.LinkError {}, staleLWID ), & utils. RetryFnArgs {} )
5960 require .NoError (t , err )
6061 require .Nil (t , links .links ["0" ], "closed link is removed from the cache" )
6162 require .Equal (t , 1 , receivers [0 ].CloseCalled , "original receiver is closed, and replaced" )
6263
6364 // trying to recover again is a no-op (if nothing is in the cache)
64- err = links .lr .RecoverIfNeeded (context .Background (), lwidToError (& amqp.LinkError {}, staleLWID ))
65+ err = links .lr .RecoverIfNeeded (context .Background (), lwidToError (& amqp.LinkError {}, staleLWID ), & utils. RetryFnArgs {} )
6566 require .NoError (t , err )
6667 require .Nil (t , links .links ["0" ], "closed link is removed from the cache" )
6768 require .Equal (t , 1 , receivers [0 ].CloseCalled , "original receiver is closed, and replaced" )
@@ -75,7 +76,7 @@ func TestLinks_LinkStale(t *testing.T) {
7576 require .NotNil (t , newLWID )
7677 require .Equal (t , (* links .links ["0" ].link ).LinkName (), newLWID .Link ().LinkName (), "cache contains the newly created link for partition 0" )
7778
78- err = links .lr .RecoverIfNeeded (context .Background (), lwidToError (& amqp.LinkError {}, staleLWID ))
79+ err = links .lr .RecoverIfNeeded (context .Background (), lwidToError (& amqp.LinkError {}, staleLWID ), & utils. RetryFnArgs {} )
7980 require .NoError (t , err )
8081 require .Equal (t , 0 , receivers [0 ].CloseCalled , "receiver is NOT closed - we didn't need to replace it since the lwid with the error was stale" )
8182}
@@ -102,7 +103,7 @@ func TestLinks_LinkRecoveryOnly(t *testing.T) {
102103 require .NotNil (t , lwid )
103104 require .NotNil (t , links .links ["0" ], "cache contains the newly created link for partition 0" )
104105
105- err = links .lr .RecoverIfNeeded (context .Background (), lwidToError (& amqp.LinkError {}, lwid ))
106+ err = links .lr .RecoverIfNeeded (context .Background (), lwidToError (& amqp.LinkError {}, lwid ), & utils. RetryFnArgs {} )
106107 require .NoError (t , err )
107108 require .Nil (t , links .links ["0" ], "cache will no longer a link for partition 0" )
108109
@@ -157,7 +158,7 @@ func TestLinks_ConnectionRecovery(t *testing.T) {
157158 ns .EXPECT ().Recover (test .NotCancelled , gomock .Any ()).Return (nil )
158159
159160 // initiate a connection level recovery
160- err = links .lr .RecoverIfNeeded (context .Background (), lwidToError (& amqp.ConnError {}, lwid ))
161+ err = links .lr .RecoverIfNeeded (context .Background (), lwidToError (& amqp.ConnError {}, lwid ), & utils. RetryFnArgs {} )
161162 require .NoError (t , err )
162163
163164 // we still cleanup what we can (including cancelling our background negotiate claim loop)
@@ -202,7 +203,7 @@ func TestLinks_LinkRecoveryButCloseIsCancelled(t *testing.T) {
202203 require .NotNil (t , lwid )
203204 require .NotNil (t , links .links ["0" ], "cache contains the newly created link for partition 0" )
204205
205- err = links .lr .RecoverIfNeeded (context .Background (), lwidToError (& amqp.LinkError {}, lwid ))
206+ err = links .lr .RecoverIfNeeded (context .Background (), lwidToError (& amqp.LinkError {}, lwid ), & utils. RetryFnArgs {} )
206207 require .ErrorIs (t , err , context .Canceled )
207208 require .Nil (t , links .links ["0" ], "cache will no longer a link for partition 0" )
208209 require .Equal (t , 0 , connectionRecoverCalled , "Link level recovery, not connection level" )
@@ -254,7 +255,7 @@ func TestLinks_closeWithTimeout(t *testing.T) {
254255
255256 // purposefully recover with what should be a link level recovery. However, the Close() failing
256257 // means we end up "upgrading" to a connection reset instead.
257- err = links .lr .RecoverIfNeeded (userCtx , lwidToError (& amqp.LinkError {}, lwid ))
258+ err = links .lr .RecoverIfNeeded (userCtx , lwidToError (& amqp.LinkError {}, lwid ), & utils. RetryFnArgs {} )
258259 require .ErrorIs (t , err , errToReturn )
259260
260261 // we still cleanup what we can (including cancelling our background negotiate claim loop)
@@ -292,7 +293,7 @@ func TestLinks_linkRecoveryOnly(t *testing.T) {
292293 lwid , err := links .GetLink (context .Background (), "0" )
293294 require .NoError (t , err )
294295
295- err = links .lr .RecoverIfNeeded (context .Background (), lwidToError (& amqp.LinkError {}, lwid ))
296+ err = links .lr .RecoverIfNeeded (context .Background (), lwidToError (& amqp.LinkError {}, lwid ), & utils. RetryFnArgs {} )
296297 require .NoError (t , err )
297298
298299 // we still cleanup what we can (including cancelling our background negotiate claim loop)
@@ -329,7 +330,7 @@ func TestLinks_linkRecoveryFailsWithLinkFailure(t *testing.T) {
329330 lwid , err := links .GetLink (context .Background (), "0" )
330331 require .NoError (t , err )
331332
332- err = links .lr .RecoverIfNeeded (context .Background (), lwidToError (& amqp.LinkError {}, lwid ))
333+ err = links .lr .RecoverIfNeeded (context .Background (), lwidToError (& amqp.LinkError {}, lwid ), & utils. RetryFnArgs {} )
333334 require .Equal (t , err , detachErr )
334335
335336 // we still cleanup what we can (including cancelling our background negotiate claim loop)
0 commit comments