@@ -77,8 +77,8 @@ func TestValidatePayloadStatus(t *testing.T) {
7777 }
7878}
7979
80- // TestRetryWithBackoff tests the retry logic with exponential backoff
81- func TestRetryWithBackoff (t * testing.T ) {
80+ // TestRetryWithBackoffOnPayloadStatus tests the retry logic with exponential backoff
81+ func TestRetryWithBackoffOnPayloadStatus (t * testing.T ) {
8282 t .Parallel ()
8383
8484 tests := []struct {
@@ -157,7 +157,7 @@ func TestRetryWithBackoff(t *testing.T) {
157157 }
158158
159159 ctx := context .Background ()
160- err := retryWithBackoff (ctx , retryFn , tt .maxRetries , 1 * time .Millisecond , "test_operation" )
160+ err := retryWithBackoffOnPayloadStatus (ctx , retryFn , tt .maxRetries , 1 * time .Millisecond , "test_operation" )
161161
162162 if tt .shouldSucceed {
163163 require .NoError (t , err , "expected success but got error" )
@@ -170,8 +170,8 @@ func TestRetryWithBackoff(t *testing.T) {
170170 }
171171}
172172
173- // TestRetryWithBackoff_ContextCancellation tests that retry respects context cancellation
174- func TestRetryWithBackoff_ContextCancellation (t * testing.T ) {
173+ // TestRetryWithBackoffOnPayloadStatus_ContextCancellation tests that retry respects context cancellation
174+ func TestRetryWithBackoffOnPayloadStatus_ContextCancellation (t * testing.T ) {
175175 t .Parallel ()
176176
177177 attempts := 0
@@ -183,16 +183,16 @@ func TestRetryWithBackoff_ContextCancellation(t *testing.T) {
183183 ctx , cancel := context .WithCancel (context .Background ())
184184 cancel () // Cancel immediately
185185
186- err := retryWithBackoff (ctx , retryFn , 5 , 100 * time .Millisecond , "test_operation" )
186+ err := retryWithBackoffOnPayloadStatus (ctx , retryFn , 5 , 100 * time .Millisecond , "test_operation" )
187187
188188 require .Error (t , err , "expected error due to context cancellation" )
189189 assert .ErrorIs (t , err , context .Canceled , "expected context.Canceled error" )
190190 // Should fail fast on context cancellation without retries
191191 assert .LessOrEqual (t , attempts , 1 , "expected at most 1 attempt, got %d" , attempts )
192192}
193193
194- // TestRetryWithBackoff_ContextTimeout tests that retry respects context timeout
195- func TestRetryWithBackoff_ContextTimeout (t * testing.T ) {
194+ // TestRetryWithBackoffOnPayloadStatus_ContextTimeout tests that retry respects context timeout
195+ func TestRetryWithBackoffOnPayloadStatus_ContextTimeout (t * testing.T ) {
196196 t .Parallel ()
197197
198198 attempts := 0
@@ -205,16 +205,16 @@ func TestRetryWithBackoff_ContextTimeout(t *testing.T) {
205205 ctx , cancel := context .WithTimeout (context .Background (), 100 * time .Millisecond )
206206 defer cancel ()
207207
208- err := retryWithBackoff (ctx , retryFn , 10 , 1 * time .Second , "test_operation" )
208+ err := retryWithBackoffOnPayloadStatus (ctx , retryFn , 10 , 1 * time .Second , "test_operation" )
209209
210210 require .Error (t , err , "expected error due to context timeout" )
211211 assert .ErrorIs (t , err , context .DeadlineExceeded , "expected context.DeadlineExceeded error" )
212212 // Should stop on timeout, not exhaust all retries
213213 assert .Less (t , attempts , 10 , "expected fewer than 10 attempts due to timeout, got %d" , attempts )
214214}
215215
216- // TestRetryWithBackoff_RPCErrors tests that RPC errors are not retried
217- func TestRetryWithBackoff_RPCErrors (t * testing.T ) {
216+ // TestRetryWithBackoffOnPayloadStatus_RPCErrors tests that RPC errors are not retried
217+ func TestRetryWithBackoffOnPayloadStatus_RPCErrors (t * testing.T ) {
218218 t .Parallel ()
219219
220220 rpcError := errors .New ("RPC connection failed" )
@@ -225,16 +225,16 @@ func TestRetryWithBackoff_RPCErrors(t *testing.T) {
225225 }
226226
227227 ctx := context .Background ()
228- err := retryWithBackoff (ctx , retryFn , 5 , 1 * time .Millisecond , "test_operation" )
228+ err := retryWithBackoffOnPayloadStatus (ctx , retryFn , 5 , 1 * time .Millisecond , "test_operation" )
229229
230230 require .Error (t , err , "expected error from RPC failure" )
231231 assert .Equal (t , rpcError , err , "expected original RPC error to be returned" )
232232 // Should fail immediately without retries on non-syncing errors
233233 assert .Equal (t , 1 , attempts , "expected exactly 1 attempt, got %d" , attempts )
234234}
235235
236- // TestRetryWithBackoff_WrappedRPCErrors tests that wrapped RPC errors are not retried
237- func TestRetryWithBackoff_WrappedRPCErrors (t * testing.T ) {
236+ // TestRetryWithBackoffOnPayloadStatus_WrappedRPCErrors tests that wrapped RPC errors are not retried
237+ func TestRetryWithBackoffOnPayloadStatus_WrappedRPCErrors (t * testing.T ) {
238238 t .Parallel ()
239239
240240 rpcError := errors .New ("connection refused" )
@@ -245,7 +245,7 @@ func TestRetryWithBackoff_WrappedRPCErrors(t *testing.T) {
245245 }
246246
247247 ctx := context .Background ()
248- err := retryWithBackoff (ctx , retryFn , 5 , 1 * time .Millisecond , "test_operation" )
248+ err := retryWithBackoffOnPayloadStatus (ctx , retryFn , 5 , 1 * time .Millisecond , "test_operation" )
249249
250250 require .Error (t , err , "expected error from RPC failure" )
251251 // Should fail immediately without retries on non-syncing errors
0 commit comments