|
24 | 24 | ensure_all_units_continuous_writes_incrementing,
|
25 | 25 | ensure_n_online_mysql_members,
|
26 | 26 | ensure_process_not_running,
|
| 27 | + get_application_name, |
27 | 28 | get_process_stat,
|
28 |
| - high_availability_test_setup, |
29 | 29 | insert_data_into_mysql_and_validate_replication,
|
30 | 30 | isolate_instance_from_cluster,
|
31 | 31 | remove_instance_isolation,
|
|
40 | 40 | TIMEOUT = 40 * 60
|
41 | 41 |
|
42 | 42 |
|
43 |
| -@pytest.mark.group(1) |
44 |
| -async def test_build_and_deploy(ops_test: OpsTest) -> None: |
45 |
| - """Simple test to ensure that the mysql and application charms get deployed.""" |
46 |
| - await high_availability_test_setup(ops_test) |
47 |
| - |
48 |
| - |
49 | 43 | @pytest.mark.group(1)
|
50 | 44 | @pytest.mark.abort_on_fail
|
51 |
| -async def test_kill_db_process(ops_test: OpsTest, continuous_writes) -> None: |
| 45 | +async def test_kill_db_process( |
| 46 | + ops_test: OpsTest, highly_available_cluster, continuous_writes |
| 47 | +) -> None: |
52 | 48 | """Test to send a SIGKILL to the primary db process and ensure that the cluster self heals."""
|
53 |
| - mysql_application_name, _ = await high_availability_test_setup(ops_test) |
| 49 | + mysql_application_name = get_application_name(ops_test, "mysql") |
54 | 50 |
|
55 | 51 | logger.info("Waiting until 3 mysql instances are online")
|
56 | 52 | # ensure all units in the cluster are online
|
@@ -109,12 +105,14 @@ async def test_kill_db_process(ops_test: OpsTest, continuous_writes) -> None:
|
109 | 105 | await clean_up_database_and_table(ops_test, database_name, table_name)
|
110 | 106 |
|
111 | 107 |
|
112 |
| -@pytest.mark.group(1) |
| 108 | +@pytest.mark.group(2) |
113 | 109 | @pytest.mark.abort_on_fail
|
114 | 110 | @pytest.mark.unstable
|
115 |
| -async def test_freeze_db_process(ops_test: OpsTest, continuous_writes) -> None: |
| 111 | +async def test_freeze_db_process( |
| 112 | + ops_test: OpsTest, highly_available_cluster, continuous_writes |
| 113 | +) -> None: |
116 | 114 | """Test to send a SIGSTOP to the primary db process and ensure that the cluster self heals."""
|
117 |
| - mysql_application_name, _ = await high_availability_test_setup(ops_test) |
| 115 | + mysql_application_name = get_application_name(ops_test, "mysql") |
118 | 116 |
|
119 | 117 | # ensure all units in the cluster are online
|
120 | 118 | assert await ensure_n_online_mysql_members(
|
@@ -230,11 +228,13 @@ async def test_freeze_db_process(ops_test: OpsTest, continuous_writes) -> None:
|
230 | 228 | await ensure_all_units_continuous_writes_incrementing(ops_test)
|
231 | 229 |
|
232 | 230 |
|
233 |
| -@pytest.mark.group(1) |
| 231 | +@pytest.mark.group(3) |
234 | 232 | @pytest.mark.abort_on_fail
|
235 |
| -async def test_graceful_crash_of_primary(ops_test: OpsTest, continuous_writes) -> None: |
| 233 | +async def test_graceful_crash_of_primary( |
| 234 | + ops_test: OpsTest, highly_available_cluster, continuous_writes |
| 235 | +) -> None: |
236 | 236 | """Test to send SIGTERM to primary instance and then verify recovery."""
|
237 |
| - mysql_application_name, _ = await high_availability_test_setup(ops_test) |
| 237 | + mysql_application_name = get_application_name(ops_test, "mysql") |
238 | 238 |
|
239 | 239 | logger.info("Ensuring that there are 3 online mysql members")
|
240 | 240 | assert await ensure_n_online_mysql_members(
|
@@ -293,13 +293,13 @@ async def test_graceful_crash_of_primary(ops_test: OpsTest, continuous_writes) -
|
293 | 293 | await ensure_all_units_continuous_writes_incrementing(ops_test)
|
294 | 294 |
|
295 | 295 |
|
296 |
| -@pytest.mark.group(1) |
| 296 | +@pytest.mark.group(4) |
297 | 297 | @pytest.mark.abort_on_fail
|
298 | 298 | async def test_network_cut_affecting_an_instance(
|
299 |
| - ops_test: OpsTest, continuous_writes, chaos_mesh |
| 299 | + ops_test: OpsTest, highly_available_cluster, continuous_writes, chaos_mesh |
300 | 300 | ) -> None:
|
301 | 301 | """Test for a network cut affecting an instance."""
|
302 |
| - mysql_application_name, _ = await high_availability_test_setup(ops_test) |
| 302 | + mysql_application_name = get_application_name(ops_test, "mysql") |
303 | 303 |
|
304 | 304 | logger.info("Ensuring that there are 3 online mysql members")
|
305 | 305 | assert await ensure_n_online_mysql_members(
|
@@ -377,12 +377,14 @@ async def test_network_cut_affecting_an_instance(
|
377 | 377 | await ensure_all_units_continuous_writes_incrementing(ops_test)
|
378 | 378 |
|
379 | 379 |
|
380 |
| -@pytest.mark.group(1) |
| 380 | +@pytest.mark.group(5) |
381 | 381 | @pytest.mark.abort_on_fail
|
382 | 382 | @pytest.mark.unstable
|
383 |
| -async def test_graceful_full_cluster_crash_test(ops_test: OpsTest, continuous_writes) -> None: |
| 383 | +async def test_graceful_full_cluster_crash_test( |
| 384 | + ops_test: OpsTest, highly_available_cluster, continuous_writes |
| 385 | +) -> None: |
384 | 386 | """Test to send SIGTERM to all units and then ensure that the cluster recovers."""
|
385 |
| - mysql_application_name, _ = await high_availability_test_setup(ops_test) |
| 387 | + mysql_application_name = get_application_name(ops_test, "mysql") |
386 | 388 |
|
387 | 389 | logger.info("Ensure there are 3 online mysql members")
|
388 | 390 | assert await ensure_n_online_mysql_members(
|
@@ -448,11 +450,11 @@ async def test_graceful_full_cluster_crash_test(ops_test: OpsTest, continuous_wr
|
448 | 450 | await ensure_all_units_continuous_writes_incrementing(ops_test)
|
449 | 451 |
|
450 | 452 |
|
451 |
| -@pytest.mark.group(1) |
| 453 | +@pytest.mark.group(6) |
452 | 454 | @pytest.mark.abort_on_fail
|
453 |
| -async def test_single_unit_pod_delete(ops_test: OpsTest) -> None: |
| 455 | +async def test_single_unit_pod_delete(ops_test: OpsTest, highly_available_cluster) -> None: |
454 | 456 | """Delete the pod in a single unit deployment and write data to new pod."""
|
455 |
| - mysql_application_name, _ = await high_availability_test_setup(ops_test) |
| 457 | + mysql_application_name = get_application_name(ops_test, "mysql") |
456 | 458 |
|
457 | 459 | logger.info("Scale mysql application to 1 unit that is active")
|
458 | 460 | async with ops_test.fast_forward("60s"):
|
|
0 commit comments