@@ -11,7 +11,6 @@ import (
1111 grpcCodes "google.golang.org/grpc/codes"
1212 grpcStatus "google.golang.org/grpc/status"
1313
14- "github.com/ydb-platform/ydb-go-sdk/v3/internal/table/config"
1514 "github.com/ydb-platform/ydb-go-sdk/v3/internal/xcontext"
1615 "github.com/ydb-platform/ydb-go-sdk/v3/internal/xerrors"
1716 "github.com/ydb-platform/ydb-go-sdk/v3/internal/xrand"
@@ -41,12 +40,10 @@ func TestRetryerBackoffRetryCancelation(t *testing.T) {
4140 ctx , cancel := xcontext .WithCancel (context .Background ())
4241 results := make (chan error )
4342 go func () {
44- err := do (ctx , p ,
45- config .New (),
43+ err := retryBackoff (ctx , p ,
4644 func (ctx context.Context , _ table.Session ) error {
4745 return testErr
4846 },
49- nil ,
5047 retry .WithFastBackoff (
5148 testutil .BackoffFunc (func (n int ) <- chan time.Time {
5249 ch := make (chan time.Time )
@@ -103,7 +100,7 @@ func TestRetryerBadSession(t *testing.T) {
103100 sessions []table.Session
104101 )
105102 ctx , cancel := xcontext .WithCancel (context .Background ())
106- err := do (ctx , p , config . New () ,
103+ err := retryBackoff (ctx , p ,
107104 func (ctx context.Context , s table.Session ) error {
108105 sessions = append (sessions , s )
109106 i ++
@@ -115,7 +112,6 @@ func TestRetryerBadSession(t *testing.T) {
115112 xerrors .WithStatusCode (Ydb .StatusIds_BAD_SESSION ),
116113 )
117114 },
118- func (err error ) {},
119115 )
120116 if ! xerrors .Is (err , context .Canceled ) {
121117 t .Errorf ("unexpected error: %v" , err )
@@ -154,17 +150,13 @@ func TestRetryerSessionClosing(t *testing.T) {
154150 }
155151 var sessions []table.Session
156152 for i := 0 ; i < 1000 ; i ++ {
157- err := do (
158- context .Background (),
159- p ,
160- config .New (),
153+ err := retryBackoff (context .Background (), p ,
161154 func (ctx context.Context , s table.Session ) error {
162155 sessions = append (sessions , s )
163156 s .(* session ).SetStatus (table .SessionClosing )
164157
165158 return nil
166159 },
167- nil ,
168160 )
169161 if err != nil {
170162 t .Errorf ("unexpected error: %v" , err )
@@ -208,14 +200,10 @@ func TestRetryerImmediateReturn(t *testing.T) {
208200 p := SingleSession (
209201 simpleSession (t ),
210202 )
211- err := do (
212- context .Background (),
213- p ,
214- config .New (),
203+ err := retryBackoff (context .Background (), p ,
215204 func (ctx context.Context , _ table.Session ) error {
216205 return testErr
217206 },
218- nil ,
219207 retry .WithFastBackoff (
220208 testutil .BackoffFunc (func (n int ) <- chan time.Time {
221209 panic ("this code will not be called" )
@@ -341,10 +329,7 @@ func TestRetryContextDeadline(t *testing.T) {
341329 t .Run (fmt .Sprintf ("Timeout=%v,Sleep=%v" , timeout , sleep ), func (t * testing.T ) {
342330 ctx , cancel := xcontext .WithTimeout (context .Background (), timeout )
343331 defer cancel ()
344- _ = do (
345- ctx ,
346- p ,
347- config .New (),
332+ _ = retryBackoff (ctx , p ,
348333 func (ctx context.Context , _ table.Session ) error {
349334 select {
350335 case <- ctx .Done ():
@@ -353,7 +338,6 @@ func TestRetryContextDeadline(t *testing.T) {
353338 return errs [r .Int (len (errs ))]
354339 }
355340 },
356- nil ,
357341 )
358342 })
359343 }
@@ -442,10 +426,7 @@ func TestRetryWithCustomErrors(t *testing.T) {
442426 i = 0
443427 sessions = make (map [table.Session ]int )
444428 )
445- err := do (
446- ctx ,
447- p ,
448- config .New (),
429+ err := retryBackoff (ctx , p ,
449430 func (ctx context.Context , s table.Session ) (err error ) {
450431 sessions [s ]++
451432 i ++
@@ -455,7 +436,6 @@ func TestRetryWithCustomErrors(t *testing.T) {
455436
456437 return nil
457438 },
458- nil ,
459439 )
460440 //nolint:nestif
461441 if test .retriable {
0 commit comments