Skip to content

Commit

Permalink
Add integration test covering for scaling down 3 node cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
bschimke95 committed Apr 2, 2024
1 parent 304bdf7 commit f17cf46
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions tests/integration/test_k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,21 +136,32 @@ 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"]
expected_nodes = len(k8s.units) + len(worker.units)
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)
Expand Down

0 comments on commit f17cf46

Please sign in to comment.