Skip to content

Commit e018e96

Browse files
[DPE-6666] Remove async-replication test workaround (#588)
1 parent ff4b62b commit e018e96

File tree

1 file changed

+29
-40
lines changed

1 file changed

+29
-40
lines changed

tests/integration/high_availability/test_async_replication.py

Lines changed: 29 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -151,35 +151,6 @@ async def test_async_relate(ops_test: OpsTest, first_model: Model, second_model:
151151
)
152152

153153

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-
183154
@markers.juju3
184155
@pytest.mark.abort_on_fail
185156
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:
216187
)
217188

218189

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+
219219
@markers.juju3
220220
@pytest.mark.abort_on_fail
221221
async def test_data_replication(
@@ -317,14 +317,6 @@ async def test_remove_relation_and_relate(
317317
first_model: Model, second_model: Model, continuous_writes
318318
) -> None:
319319
"""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-
328320
logger.info("Remove async relation")
329321
await second_model.applications[MYSQL_APP2].remove_relation(
330322
f"{MYSQL_APP2}:replication", MYSQL_APP1
@@ -387,9 +379,6 @@ async def test_remove_relation_and_relate(
387379
),
388380
)
389381

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-
393382
results = await get_max_written_value(first_model, second_model)
394383
assert len(results) == 6, f"Expected 6 results, got {len(results)}"
395384
assert all(x == results[0] for x in results), "Data is not consistent across units"

0 commit comments

Comments
 (0)