1818use YdbPlatform \Ydb \Exceptions \Grpc \UnavailableException ;
1919use YdbPlatform \Ydb \Exceptions \Grpc \UnimplementedException ;
2020use YdbPlatform \Ydb \Exceptions \Grpc \UnknownException ;
21- use YdbPlatform \Ydb \Exceptions \RetryableException ;
2221use YdbPlatform \Ydb \Exceptions \Ydb \BadRequestException ;
2322use YdbPlatform \Ydb \Exceptions \Ydb \InternalErrorException ;
2423use YdbPlatform \Ydb \Exceptions \Ydb \StatusCodeUnspecified ;
2524use YdbPlatform \Ydb \Exceptions \Ydb \UnauthorizedException ;
25+ use YdbPlatform \Ydb \Logger \SimpleStdLogger ;
2626use YdbPlatform \Ydb \Retry \Backoff ;
2727use YdbPlatform \Ydb \Retry \RetryParams ;
28- use YdbPlatform \Ydb \Session ;
2928use YdbPlatform \Ydb \Table ;
3029use YdbPlatform \Ydb \Ydb ;
3130use YdbPlatform \Ydb \Retry \Retry ;
@@ -48,7 +47,7 @@ public function deleteSession(string $exception): bool
4847 }
4948}
5049
51- class RetryTest2 extends \PHPUnit \Framework \TestCase
50+ class RetryParamsTest extends \PHPUnit \Framework \TestCase
5251{
5352 protected const FAST = 5 ;
5453 protected const SLOW = 20 ;
@@ -370,22 +369,25 @@ public function test(){
370369 $ retryParams = new RetryParams (1000 , new Backoff (6 ,self ::FAST ),
371370 new Backoff (6 ,self ::SLOW ));
372371
373- $ retry = (new RetrySubclass ())->withParams ($ retryParams );
374- $ table = new TableSubclass (new Ydb (["credentials " =>new AnonymousAuthentication ()]), null , $ retry );
372+ $ logger = new SimpleStdLogger (7 );
373+ $ retry = (new RetrySubclass ($ logger ))->withParams ($ retryParams );
374+ $ table = new TableSubclass (new Ydb (["credentials " =>new AnonymousAuthentication ()]), $ logger , $ retry );
375375
376376 foreach ($ this ->errsToCheck as $ error ) {
377377
378+ $ exception = new $ error ["class " ]();
379+
378380 $ resultDeleteSession = $ table ->deleteSession ($ error ["class " ]) ? "true " : "false " ;
379381 $ wantDeleteSession = $ error ["deleteSession " ] ? "true " : "false " ;
380382 self ::assertEquals ($ wantDeleteSession , $ resultDeleteSession ,
381383 "{$ error ["class " ]}: unexpected delete session status: $ resultDeleteSession, want: $ wantDeleteSession " );
382384
383- $ resultRetryIdempotent = $ retry ->canRetry (new $ error [ " class " ]() , true ) ? "true " : "false " ;
385+ $ resultRetryIdempotent = $ retry ->canRetry ($ exception , true ) ? "true " : "false " ;
384386 $ wantRetryIdempotent = $ error ["retry " ]["idempotent " ] ? "true " : "false " ;
385387 self ::assertEquals ($ wantRetryIdempotent , $ resultRetryIdempotent ,
386388 "{$ error ["class " ]}: unexpected must retry idempotent operation status: $ resultRetryIdempotent, want: $ wantRetryIdempotent " );
387389
388- $ resultRetryNonIdempotent = $ retry ->canRetry (new $ error [ " class " ]() , false ) ? "true " : "false " ;
390+ $ resultRetryNonIdempotent = $ retry ->canRetry ($ exception , false ) ? "true " : "false " ;
389391 $ wantRetryNonIdempotent = $ error ["retry " ]["nonIdempotent " ] ? "true " : "false " ;
390392 self ::assertEquals ($ wantRetryNonIdempotent , $ resultRetryNonIdempotent ,
391393 "{$ error ["class " ]}: unexpected must retry non-idempotent operation status: $ resultDeleteSession, want: $ wantDeleteSession " );
0 commit comments