@@ -11,7 +11,6 @@ import (
11
11
grpcCodes "google.golang.org/grpc/codes"
12
12
grpcStatus "google.golang.org/grpc/status"
13
13
14
- "github.com/ydb-platform/ydb-go-sdk/v3/internal/table/config"
15
14
"github.com/ydb-platform/ydb-go-sdk/v3/internal/xcontext"
16
15
"github.com/ydb-platform/ydb-go-sdk/v3/internal/xerrors"
17
16
"github.com/ydb-platform/ydb-go-sdk/v3/internal/xrand"
@@ -41,12 +40,10 @@ func TestRetryerBackoffRetryCancelation(t *testing.T) {
41
40
ctx , cancel := xcontext .WithCancel (context .Background ())
42
41
results := make (chan error )
43
42
go func () {
44
- err := do (ctx , p ,
45
- config .New (),
43
+ err := retryBackoff (ctx , p ,
46
44
func (ctx context.Context , _ table.Session ) error {
47
45
return testErr
48
46
},
49
- nil ,
50
47
retry .WithFastBackoff (
51
48
testutil .BackoffFunc (func (n int ) <- chan time.Time {
52
49
ch := make (chan time.Time )
@@ -103,7 +100,7 @@ func TestRetryerBadSession(t *testing.T) {
103
100
sessions []table.Session
104
101
)
105
102
ctx , cancel := xcontext .WithCancel (context .Background ())
106
- err := do (ctx , p , config . New () ,
103
+ err := retryBackoff (ctx , p ,
107
104
func (ctx context.Context , s table.Session ) error {
108
105
sessions = append (sessions , s )
109
106
i ++
@@ -115,7 +112,6 @@ func TestRetryerBadSession(t *testing.T) {
115
112
xerrors .WithStatusCode (Ydb .StatusIds_BAD_SESSION ),
116
113
)
117
114
},
118
- func (err error ) {},
119
115
)
120
116
if ! xerrors .Is (err , context .Canceled ) {
121
117
t .Errorf ("unexpected error: %v" , err )
@@ -154,17 +150,13 @@ func TestRetryerSessionClosing(t *testing.T) {
154
150
}
155
151
var sessions []table.Session
156
152
for i := 0 ; i < 1000 ; i ++ {
157
- err := do (
158
- context .Background (),
159
- p ,
160
- config .New (),
153
+ err := retryBackoff (context .Background (), p ,
161
154
func (ctx context.Context , s table.Session ) error {
162
155
sessions = append (sessions , s )
163
156
s .(* session ).SetStatus (table .SessionClosing )
164
157
165
158
return nil
166
159
},
167
- nil ,
168
160
)
169
161
if err != nil {
170
162
t .Errorf ("unexpected error: %v" , err )
@@ -208,14 +200,10 @@ func TestRetryerImmediateReturn(t *testing.T) {
208
200
p := SingleSession (
209
201
simpleSession (t ),
210
202
)
211
- err := do (
212
- context .Background (),
213
- p ,
214
- config .New (),
203
+ err := retryBackoff (context .Background (), p ,
215
204
func (ctx context.Context , _ table.Session ) error {
216
205
return testErr
217
206
},
218
- nil ,
219
207
retry .WithFastBackoff (
220
208
testutil .BackoffFunc (func (n int ) <- chan time.Time {
221
209
panic ("this code will not be called" )
@@ -341,10 +329,7 @@ func TestRetryContextDeadline(t *testing.T) {
341
329
t .Run (fmt .Sprintf ("Timeout=%v,Sleep=%v" , timeout , sleep ), func (t * testing.T ) {
342
330
ctx , cancel := xcontext .WithTimeout (context .Background (), timeout )
343
331
defer cancel ()
344
- _ = do (
345
- ctx ,
346
- p ,
347
- config .New (),
332
+ _ = retryBackoff (ctx , p ,
348
333
func (ctx context.Context , _ table.Session ) error {
349
334
select {
350
335
case <- ctx .Done ():
@@ -353,7 +338,6 @@ func TestRetryContextDeadline(t *testing.T) {
353
338
return errs [r .Int (len (errs ))]
354
339
}
355
340
},
356
- nil ,
357
341
)
358
342
})
359
343
}
@@ -442,10 +426,7 @@ func TestRetryWithCustomErrors(t *testing.T) {
442
426
i = 0
443
427
sessions = make (map [table.Session ]int )
444
428
)
445
- err := do (
446
- ctx ,
447
- p ,
448
- config .New (),
429
+ err := retryBackoff (ctx , p ,
449
430
func (ctx context.Context , s table.Session ) (err error ) {
450
431
sessions [s ]++
451
432
i ++
@@ -455,7 +436,6 @@ func TestRetryWithCustomErrors(t *testing.T) {
455
436
456
437
return nil
457
438
},
458
- nil ,
459
439
)
460
440
//nolint:nestif
461
441
if test .retriable {
0 commit comments