From f17cf46cf82cd6209f77ff28d20c156854cfa0f7 Mon Sep 17 00:00:00 2001 From: Benjamin Schimke Date: Tue, 2 Apr 2024 11:08:58 +0200 Subject: [PATCH] Add integration test covering for scaling down 3 node cluster --- tests/integration/test_k8s.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/integration/test_k8s.py b/tests/integration/test_k8s.py index fc752d35..457d516a 100644 --- a/tests/integration/test_k8s.py +++ b/tests/integration/test_k8s.py @@ -136,7 +136,7 @@ async def test_remove_worker(kubernetes_cluster: model.Model): @pytest.mark.abort_on_fail -async def test_remove_non_leader_control_plane(kubernetes_cluster: model.Model): +async def test_remove_non_leader_control_planes(kubernetes_cluster: model.Model): """Deploy the charm and wait for active/idle status.""" k8s = kubernetes_cluster.applications["k8s"] worker = kubernetes_cluster.applications["k8s-worker"] @@ -144,13 +144,24 @@ async def test_remove_non_leader_control_plane(kubernetes_cluster: model.Model): leader_idx = await get_leader(k8s) leader = k8s.units[leader_idx] follower = k8s.units[(leader_idx + 1) % len(k8s.units)] + follower2 = k8s.units[(leader_idx + 2) % len(k8s.units)] await ready_nodes(leader, expected_nodes) - # Remove a control-plane + # Remove both non-leading control-planes (Replicate issue #277) log.info("Remove unit %s", follower.name) await follower.destroy() await kubernetes_cluster.wait_for_idle(status="active", timeout=5 * 60) await ready_nodes(leader, expected_nodes - 1) + + log.info("Remove unit %s", follower2.name) + await follower2.destroy() + await kubernetes_cluster.wait_for_idle(status="active", timeout=5 * 60) + await ready_nodes(leader, expected_nodes - 2) + + await k8s.add_unit() + await kubernetes_cluster.wait_for_idle(status="active", timeout=5 * 60) + await ready_nodes(leader, expected_nodes) + await k8s.add_unit() await kubernetes_cluster.wait_for_idle(status="active", timeout=5 * 60) await ready_nodes(leader, expected_nodes)