@@ -132,26 +132,29 @@ func TestDoBadSession(t *testing.T) {
132132}
133133
134134func TestDoCreateSessionError (t * testing.T ) {
135- ctx , cancel := xcontext .WithTimeout (xtest .Context (t ), time .Second )
136- defer cancel ()
137- p := pool .New [* session , session ](ctx ,
138- pool.WithCreateItemFunc [* session , session ](func (ctx context.Context ) (* session , error ) {
139- return nil , xerrors .Operation (xerrors .WithStatusCode (Ydb .StatusIds_UNAVAILABLE ))
140- }),
141- pool .WithSyncCloseItem [* session , session ](),
142- )
143- err := do (ctx , p , config .New (),
144- func (ctx context.Context , s table.Session ) error {
145- return nil
146- },
147- nil ,
148- )
149- if ! xerrors .Is (err , context .DeadlineExceeded ) {
150- t .Errorf ("unexpected error: %v" , err )
151- }
152- if ! xerrors .IsOperationError (err , Ydb .StatusIds_UNAVAILABLE ) {
153- t .Errorf ("unexpected error: %v" , err )
154- }
135+ rootCtx := xtest .Context (t )
136+ xtest .TestManyTimes (t , func (t testing.TB ) {
137+ ctx , cancel := xcontext .WithTimeout (rootCtx , 30 * time .Millisecond )
138+ defer cancel ()
139+ p := pool .New [* session , session ](ctx ,
140+ pool.WithCreateItemFunc [* session , session ](func (ctx context.Context ) (* session , error ) {
141+ return nil , xerrors .Operation (xerrors .WithStatusCode (Ydb .StatusIds_UNAVAILABLE ))
142+ }),
143+ pool .WithSyncCloseItem [* session , session ](),
144+ )
145+ err := do (ctx , p , config .New (),
146+ func (ctx context.Context , s table.Session ) error {
147+ return nil
148+ },
149+ nil ,
150+ )
151+ if ! xerrors .Is (err , context .DeadlineExceeded ) {
152+ t .Errorf ("unexpected error: %v" , err )
153+ }
154+ if ! xerrors .IsOperationError (err , Ydb .StatusIds_UNAVAILABLE ) {
155+ t .Errorf ("unexpected error: %v" , err )
156+ }
157+ })
155158}
156159
157160func TestDoImmediateReturn (t * testing.T ) {
0 commit comments