26
26
from .helpers import patch_network_get
27
27
28
28
29
+ @patch ("charms.rolling_ops.v0.rollingops.RollingOpsManager._on_process_locks" )
29
30
class TestAsyncRelation (unittest .TestCase ):
30
31
def setUp (self ) -> None :
31
32
self .harness = Harness (MySQLOperatorCharm )
@@ -37,7 +38,7 @@ def setUp(self) -> None:
37
38
self .async_replica = self .charm .async_replica
38
39
39
40
@patch ("charm.MySQLOperatorCharm._mysql" )
40
- def test_role (self , _mysql ):
41
+ def test_role (self , _mysql , _ ):
41
42
_mysql .is_cluster_replica .return_value = True
42
43
_mysql .get_member_state .return_value = (None , "primary" )
43
44
self .async_primary_relation_id = self .harness .add_relation (PRIMARY_RELATION , "db2" )
@@ -55,7 +56,7 @@ def test_role(self, _mysql):
55
56
del self .async_primary .role
56
57
57
58
@patch ("charm.MySQLOperatorCharm._mysql" )
58
- def test_async_relation_broken_primary (self , _mysql ):
59
+ def test_async_relation_broken_primary (self , _mysql , _ ):
59
60
self .harness .set_leader (True )
60
61
self .charm .on .config_changed .emit ()
61
62
self .async_primary_relation_id = self .harness .add_relation (PRIMARY_RELATION , "db2" )
@@ -77,7 +78,7 @@ def test_async_relation_broken_primary(self, _mysql):
77
78
)
78
79
79
80
@patch ("charm.MySQLOperatorCharm._mysql" )
80
- def test_async_relation_broken_replica (self , _mysql ):
81
+ def test_async_relation_broken_replica (self , _mysql , _ ):
81
82
self .harness .set_leader (True )
82
83
self .charm .on .config_changed .emit ()
83
84
async_primary_relation_id = self .harness .add_relation (PRIMARY_RELATION , "db2" )
@@ -93,7 +94,7 @@ def test_async_relation_broken_replica(self, _mysql):
93
94
self .assertNotIn ("units-added-to-cluster" , self .charm .app_peer_data )
94
95
95
96
@patch ("charm.MySQLOperatorCharm._mysql" )
96
- def test_get_state (self , _mysql ):
97
+ def test_get_state (self , _mysql , _ ):
97
98
async_primary_relation_id = self .harness .add_relation (PRIMARY_RELATION , "db2" )
98
99
relation = self .harness .model .get_relation (PRIMARY_RELATION , async_primary_relation_id )
99
100
assert relation
@@ -127,7 +128,7 @@ def test_get_state(self, _mysql):
127
128
128
129
@pytest .mark .usefixtures ("with_juju_secrets" )
129
130
@patch ("charm.MySQLOperatorCharm._mysql" )
130
- def test_primary_created (self , _mysql ):
131
+ def test_primary_created (self , _mysql , _ ):
131
132
self .harness .set_leader (True )
132
133
self .charm .on .config_changed .emit ()
133
134
@@ -150,7 +151,7 @@ def test_primary_created(self, _mysql):
150
151
151
152
@patch ("charms.mysql.v0.async_replication.MySQLAsyncReplicationPrimary.get_state" )
152
153
@patch ("charm.MySQLOperatorCharm._mysql" )
153
- def test_primary_relation_changed (self , _mysql , _get_state ):
154
+ def test_primary_relation_changed (self , _mysql , _get_state , _ ):
154
155
self .harness .set_leader (True )
155
156
async_primary_relation_id = self .harness .add_relation (PRIMARY_RELATION , "db2" )
156
157
@@ -203,7 +204,7 @@ def test_primary_relation_changed(self, _mysql, _get_state):
203
204
self .assertTrue (isinstance (self .charm .unit .status , MaintenanceStatus ))
204
205
205
206
@patch ("charm.MySQLOperatorCharm._mysql" )
206
- def test_state (self , _mysql ):
207
+ def test_state (self , _mysql , _ ):
207
208
"""Test async replica state property."""
208
209
self .assertIsNone (self .async_replica .state )
209
210
@@ -239,7 +240,7 @@ def test_state(self, _mysql):
239
240
self .assertEqual (self .async_replica .state , States .FAILED )
240
241
241
242
@patch ("charm.MySQLOperatorCharm._mysql" )
242
- def test_replica_created (self , _mysql ):
243
+ def test_replica_created (self , _mysql , _ ):
243
244
"""Test replica creation."""
244
245
self .harness .set_leader (True )
245
246
self .charm .on .config_changed .emit ()
@@ -255,7 +256,7 @@ def test_replica_created(self, _mysql):
255
256
self .assertTrue (isinstance (self .charm .unit .status , WaitingStatus ))
256
257
257
258
@patch ("charm.MySQLOperatorCharm._mysql" )
258
- def test_replica_created_user_data (self , _mysql ):
259
+ def test_replica_created_user_data (self , _mysql , _ ):
259
260
"""Test replica creation."""
260
261
self .harness .set_leader (True )
261
262
self .charm .on .config_changed .emit ()
@@ -284,7 +285,7 @@ def test_replica_created_user_data(self, _mysql):
284
285
new_callable = PropertyMock ,
285
286
)
286
287
@patch ("charm.MySQLOperatorCharm._mysql" )
287
- def test_replica_changed_syncing (self , _mysql , _state , _returning_cluster , _defer ):
288
+ def test_replica_changed_syncing (self , _mysql , _state , _returning_cluster , _defer , _ ):
288
289
"""Test replica changed for syncing state."""
289
290
self .harness .set_leader (True )
290
291
self .charm .on .config_changed .emit ()
@@ -361,7 +362,7 @@ def test_replica_changed_syncing(self, _mysql, _state, _returning_cluster, _defe
361
362
new_callable = PropertyMock ,
362
363
)
363
364
@patch ("charm.MySQLOperatorCharm._mysql" )
364
- def test_replica_changed_ready (self , _mysql , _state , _update_status ):
365
+ def test_replica_changed_ready (self , _mysql , _state , _update_status , _ ):
365
366
"""Test replica changed for ready state."""
366
367
self .harness .set_leader (True )
367
368
self .charm .on .config_changed .emit ()
@@ -385,7 +386,7 @@ def test_replica_changed_ready(self, _mysql, _state, _update_status):
385
386
new_callable = PropertyMock ,
386
387
)
387
388
@patch ("charm.MySQLOperatorCharm._mysql" )
388
- def test_replica_changed_recovering (self , _mysql , _state , _defer ):
389
+ def test_replica_changed_recovering (self , _mysql , _state , _defer , _ ):
389
390
"""Test replica changed for ready state."""
390
391
self .harness .set_leader (True )
391
392
self .charm .on .config_changed .emit ()
@@ -403,7 +404,7 @@ def test_replica_changed_recovering(self, _mysql, _state, _defer):
403
404
self .assertEqual (self .charm .app_peer_data ["units-added-to-cluster" ], "2" )
404
405
_defer .assert_called_once ()
405
406
406
- def test_replica_created_non_leader (self ):
407
+ def test_replica_created_non_leader (self , _ ):
407
408
"""Test replica changed for non-leader unit."""
408
409
self .harness .set_leader (False )
409
410
self .charm .unit_peer_data ["member-state" ] = "online"
@@ -412,7 +413,7 @@ def test_replica_created_non_leader(self):
412
413
self .assertEqual (self .charm .unit_peer_data ["member-state" ], "waiting" )
413
414
414
415
@patch ("charm.MySQLOperatorCharm._mysql" )
415
- def test_replica_changed_non_leader (self , _mysql ):
416
+ def test_replica_changed_non_leader (self , _mysql , _ ):
416
417
"""Test replica changed for non-leader unit."""
417
418
self .harness .set_leader (False )
418
419
with self .harness .hooks_disabled ():
@@ -430,7 +431,7 @@ def test_replica_changed_non_leader(self, _mysql):
430
431
431
432
# actions
432
433
@patch ("charm.MySQLOperatorCharm._mysql" )
433
- def test_promote_standby_cluster (self , _mysql ):
434
+ def test_promote_standby_cluster (self , _mysql , _ ):
434
435
self .harness .set_leader (True )
435
436
436
437
_mysql .is_cluster_replica .return_value = True
@@ -460,7 +461,7 @@ def test_promote_standby_cluster(self, _mysql):
460
461
461
462
@patch ("charm.MySQLOperatorCharm._on_update_status" )
462
463
@patch ("charm.MySQLOperatorCharm._mysql" )
463
- def test_fence_cluster (self , _mysql , _update_status ):
464
+ def test_fence_cluster (self , _mysql , _update_status , _ ):
464
465
self .harness .set_leader (True )
465
466
# fail on wrong cluster set name
466
467
with self .assertRaises (ActionFailed ):
@@ -504,7 +505,7 @@ def test_fence_cluster(self, _mysql, _update_status):
504
505
505
506
@patch ("charm.MySQLOperatorCharm._on_update_status" )
506
507
@patch ("charm.MySQLOperatorCharm._mysql" )
507
- def test_unfence_cluster (self , _mysql , _update_status ):
508
+ def test_unfence_cluster (self , _mysql , _update_status , _ ):
508
509
self .harness .set_leader (True )
509
510
510
511
_mysql .is_cluster_replica .return_value = False
@@ -523,7 +524,7 @@ def test_unfence_cluster(self, _mysql, _update_status):
523
524
_update_status .assert_called_once ()
524
525
525
526
@patch ("charm.MySQLOperatorCharm._mysql" )
526
- def test_rejoin_cluster_action (self , _mysql ):
527
+ def test_rejoin_cluster_action (self , _mysql , _ ):
527
528
with self .assertRaises (ActionFailed ):
528
529
self .harness .run_action ("rejoin-cluster" )
529
530
0 commit comments