File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -14,9 +14,12 @@ class FakeCredentials extends Auth {
14
14
*/
15
15
protected $ counter ;
16
16
17
- public function __construct (&$ counter )
17
+ protected $ tokenLiveTime ;
18
+
19
+ public function __construct (&$ counter , &$ tokenLiveTime )
18
20
{
19
21
$ this ->counter = &$ counter ;
22
+ $ this ->tokenLiveTime = &$ tokenLiveTime ;
20
23
}
21
24
22
25
public function getTokenInfo (): TokenInfo
@@ -25,7 +28,7 @@ public function getTokenInfo(): TokenInfo
25
28
if ($ this ->counter ==2 ){
26
29
throw new \Exception ("Some error " );
27
30
}
28
- return new TokenInfo (time ()+10 ,time ()+10 );
31
+ return new TokenInfo (time ()+$ this -> tokenLiveTime ,time ()+$ this -> tokenLiveTime );
29
32
}
30
33
31
34
public function getName (): string
@@ -46,6 +49,8 @@ public function test(){
46
49
47
50
$ counter = 0 ;
48
51
52
+ $ TOKEN_LIVE_TIME = 10 ;
53
+
49
54
$ config = [
50
55
51
56
// Database path
@@ -82,9 +87,8 @@ public function test(){
82
87
$ token ,
83
88
MetaGetter::getMeta ($ session )["x-ydb-auth-ticket " ][0 ]
84
89
);
85
-
86
90
// Check that sdk used old token when failed refreshing
87
- usleep (2 * 1000 *1000 ); // waiting 2 seconds
91
+ usleep (TokenInfo:: _PRIVATE_REFRESH_RATIO * $ TOKEN_LIVE_TIME * 1000 *1000 ); // waiting 10% from token live time
88
92
$ session ->query ('select 1 as res ' );
89
93
self ::assertEquals (
90
94
2 ,
You can’t perform that action at this time.
0 commit comments