@@ -39,11 +39,6 @@ async def trigger_network_failure_action(fault_injector_client, config, event: a
39
39
logger .info (f"Action completed. Status: { status_result ['status' ]} " )
40
40
41
41
class TestActiveActive :
42
-
43
- def teardown_method (self , method ):
44
- # Timeout so the cluster could recover from network failure.
45
- sleep (15 )
46
-
47
42
@pytest .mark .asyncio
48
43
@pytest .mark .parametrize (
49
44
"r_multi_db" ,
@@ -54,9 +49,9 @@ def teardown_method(self, method):
54
49
ids = ["standalone" , "cluster" ],
55
50
indirect = True
56
51
)
57
- @pytest .mark .timeout (100 )
52
+ @pytest .mark .timeout (200 )
58
53
async def test_multi_db_client_failover_to_another_db (self , r_multi_db , fault_injector_client ):
59
- client_config , listener , endpoint_config = r_multi_db
54
+ client , listener , endpoint_config = r_multi_db
60
55
61
56
# Handle unavailable databases from previous test.
62
57
retry = Retry (
@@ -65,7 +60,7 @@ async def test_multi_db_client_failover_to_another_db(self, r_multi_db, fault_in
65
60
backoff = ConstantBackoff (backoff = DEFAULT_FAILOVER_DELAY )
66
61
)
67
62
68
- async with MultiDBClient ( client_config ) as r_multi_db :
63
+ async with client as r_multi_db :
69
64
event = asyncio .Event ()
70
65
asyncio .create_task (trigger_network_failure_action (fault_injector_client , endpoint_config , event ))
71
66
@@ -116,16 +111,16 @@ async def test_multi_db_client_failover_to_another_db(self, r_multi_db, fault_in
116
111
ids = ["standalone" , "cluster" ],
117
112
indirect = True
118
113
)
119
- @pytest .mark .timeout (100 )
114
+ @pytest .mark .timeout (200 )
120
115
async def test_multi_db_client_uses_lag_aware_health_check (self , r_multi_db , fault_injector_client ):
121
- client_config , listener , endpoint_config = r_multi_db
116
+ client , listener , endpoint_config = r_multi_db
122
117
retry = Retry (
123
118
supported_errors = (TemporaryUnavailableException ,),
124
119
retries = DEFAULT_FAILOVER_ATTEMPTS ,
125
120
backoff = ConstantBackoff (backoff = DEFAULT_FAILOVER_DELAY )
126
121
)
127
122
128
- async with MultiDBClient ( client_config ) as r_multi_db :
123
+ async with client as r_multi_db :
129
124
event = asyncio .Event ()
130
125
asyncio .create_task (trigger_network_failure_action (fault_injector_client , endpoint_config , event ))
131
126
@@ -160,9 +155,9 @@ async def test_multi_db_client_uses_lag_aware_health_check(self, r_multi_db, fau
160
155
ids = ["standalone" , "cluster" ],
161
156
indirect = True
162
157
)
163
- @pytest .mark .timeout (100 )
158
+ @pytest .mark .timeout (200 )
164
159
async def test_context_manager_pipeline_failover_to_another_db (self , r_multi_db , fault_injector_client ):
165
- client_config , listener , endpoint_config = r_multi_db
160
+ client , listener , endpoint_config = r_multi_db
166
161
retry = Retry (
167
162
supported_errors = (TemporaryUnavailableException ,),
168
163
retries = DEFAULT_FAILOVER_ATTEMPTS ,
@@ -179,7 +174,7 @@ async def callback():
179
174
pipe .get ('{hash}key3' )
180
175
assert await pipe .execute () == [True , True , True , 'value1' , 'value2' , 'value3' ]
181
176
182
- async with MultiDBClient ( client_config ) as r_multi_db :
177
+ async with client as r_multi_db :
183
178
event = asyncio .Event ()
184
179
asyncio .create_task (trigger_network_failure_action (fault_injector_client , endpoint_config , event ))
185
180
@@ -209,9 +204,9 @@ async def callback():
209
204
ids = ["standalone" , "cluster" ],
210
205
indirect = True
211
206
)
212
- @pytest .mark .timeout (100 )
207
+ @pytest .mark .timeout (200 )
213
208
async def test_chaining_pipeline_failover_to_another_db (self , r_multi_db , fault_injector_client ):
214
- client_config , listener , endpoint_config = r_multi_db
209
+ client , listener , endpoint_config = r_multi_db
215
210
retry = Retry (
216
211
supported_errors = (TemporaryUnavailableException ,),
217
212
retries = DEFAULT_FAILOVER_ATTEMPTS ,
@@ -228,7 +223,7 @@ async def callback():
228
223
pipe .get ('{hash}key3' )
229
224
assert await pipe .execute () == [True , True , True , 'value1' , 'value2' , 'value3' ]
230
225
231
- async with MultiDBClient ( client_config ) as r_multi_db :
226
+ async with client as r_multi_db :
232
227
event = asyncio .Event ()
233
228
asyncio .create_task (trigger_network_failure_action (fault_injector_client , endpoint_config , event ))
234
229
@@ -258,9 +253,9 @@ async def callback():
258
253
ids = ["standalone" , "cluster" ],
259
254
indirect = True
260
255
)
261
- @pytest .mark .timeout (100 )
256
+ @pytest .mark .timeout (200 )
262
257
async def test_transaction_failover_to_another_db (self , r_multi_db , fault_injector_client ):
263
- client_config , listener , endpoint_config = r_multi_db
258
+ client , listener , endpoint_config = r_multi_db
264
259
265
260
retry = Retry (
266
261
supported_errors = (TemporaryUnavailableException ,),
@@ -276,7 +271,7 @@ async def callback(pipe: Pipeline):
276
271
pipe .get ('{hash}key2' )
277
272
pipe .get ('{hash}key3' )
278
273
279
- async with MultiDBClient ( client_config ) as r_multi_db :
274
+ async with client as r_multi_db :
280
275
event = asyncio .Event ()
281
276
asyncio .create_task (trigger_network_failure_action (fault_injector_client , endpoint_config , event ))
282
277
@@ -302,9 +297,9 @@ async def callback(pipe: Pipeline):
302
297
[{"failure_threshold" : 2 }],
303
298
indirect = True
304
299
)
305
- @pytest .mark .timeout (60 )
300
+ @pytest .mark .timeout (200 )
306
301
async def test_pubsub_failover_to_another_db (self , r_multi_db , fault_injector_client ):
307
- client_config , listener , endpoint_config = r_multi_db
302
+ client , listener , endpoint_config = r_multi_db
308
303
retry = Retry (
309
304
supported_errors = (TemporaryUnavailableException ,),
310
305
retries = DEFAULT_FAILOVER_ATTEMPTS ,
@@ -318,7 +313,7 @@ async def handler(message):
318
313
nonlocal messages_count
319
314
messages_count += 1
320
315
321
- async with MultiDBClient ( client_config ) as r_multi_db :
316
+ async with client as r_multi_db :
322
317
event = asyncio .Event ()
323
318
asyncio .create_task (trigger_network_failure_action (fault_injector_client , endpoint_config , event ))
324
319
@@ -358,4 +353,4 @@ async def handler(message):
358
353
await asyncio .sleep (0.1 )
359
354
task .cancel ()
360
355
await pubsub .unsubscribe ('test-channel' ) is True
361
- assert messages_count >= 5
356
+ assert messages_count >= 2
0 commit comments