@@ -151,35 +151,6 @@ async def test_async_relate(ops_test: OpsTest, first_model: Model, second_model:
151
151
)
152
152
153
153
154
- @markers .juju3
155
- @pytest .mark .abort_on_fail
156
- async def test_create_replication (first_model : Model , second_model : Model ) -> None :
157
- """Run the create replication and wait for the applications to settle."""
158
- logger .info ("Running create replication action" )
159
- leader_unit = await get_leader_unit (None , MYSQL_APP1 , first_model )
160
- assert leader_unit is not None , "No leader unit found"
161
-
162
- await juju_ .run_action (
163
- leader_unit ,
164
- "create-replication" ,
165
- ** {"--wait" : "5m" },
166
- )
167
-
168
- logger .info ("Waiting for the applications to settle" )
169
- await gather (
170
- first_model .wait_for_idle (
171
- apps = [MYSQL_APP1 ],
172
- status = "active" ,
173
- timeout = 5 * MINUTE ,
174
- ),
175
- second_model .wait_for_idle (
176
- apps = [MYSQL_APP2 ],
177
- status = "active" ,
178
- timeout = 5 * MINUTE ,
179
- ),
180
- )
181
-
182
-
183
154
@markers .juju3
184
155
@pytest .mark .abort_on_fail
185
156
async def test_deploy_router_and_app (first_model : Model ) -> None :
@@ -216,6 +187,35 @@ async def test_deploy_router_and_app(first_model: Model) -> None:
216
187
)
217
188
218
189
190
+ @markers .juju3
191
+ @pytest .mark .abort_on_fail
192
+ async def test_create_replication (first_model : Model , second_model : Model ) -> None :
193
+ """Run the create replication and wait for the applications to settle."""
194
+ logger .info ("Running create replication action" )
195
+ leader_unit = await get_leader_unit (None , MYSQL_APP1 , first_model )
196
+ assert leader_unit is not None , "No leader unit found"
197
+
198
+ await juju_ .run_action (
199
+ leader_unit ,
200
+ "create-replication" ,
201
+ ** {"--wait" : "5m" },
202
+ )
203
+
204
+ logger .info ("Waiting for the applications to settle" )
205
+ await gather (
206
+ first_model .wait_for_idle (
207
+ apps = [MYSQL_APP1 ],
208
+ status = "active" ,
209
+ timeout = 5 * MINUTE ,
210
+ ),
211
+ second_model .wait_for_idle (
212
+ apps = [MYSQL_APP2 ],
213
+ status = "active" ,
214
+ timeout = 5 * MINUTE ,
215
+ ),
216
+ )
217
+
218
+
219
219
@markers .juju3
220
220
@pytest .mark .abort_on_fail
221
221
async def test_data_replication (
@@ -317,14 +317,6 @@ async def test_remove_relation_and_relate(
317
317
first_model : Model , second_model : Model , continuous_writes
318
318
) -> None :
319
319
"""Test removing and re-relating the two mysql clusters."""
320
- logger .info ("Stopping continuous writes after 5s" )
321
- # part 1/2 of workaround for https://github.com/canonical/mysql-k8s-operator/issues/399
322
- # sleep is need to ensure there is enough time for the `continuous_writes` database be
323
- # created/populated (by the fixture) before stopping the continuous writes
324
- sleep (5 )
325
- application_unit = first_model .applications [APPLICATION_APP_NAME ].units [0 ]
326
- await juju_ .run_action (application_unit , "stop-continuous-writes" )
327
-
328
320
logger .info ("Remove async relation" )
329
321
await second_model .applications [MYSQL_APP2 ].remove_relation (
330
322
f"{ MYSQL_APP2 } :replication" , MYSQL_APP1
@@ -387,9 +379,6 @@ async def test_remove_relation_and_relate(
387
379
),
388
380
)
389
381
390
- # part 2/2 of workaround for https://github.com/canonical/mysql-k8s-operator/issues/399
391
- await juju_ .run_action (application_unit , "start-continuous-writes" )
392
-
393
382
results = await get_max_written_value (first_model , second_model )
394
383
assert len (results ) == 6 , f"Expected 6 results, got { len (results )} "
395
384
assert all (x == results [0 ] for x in results ), "Data is not consistent across units"
0 commit comments