Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integration test covering for scaling down 3 node cluster #60

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions tests/integration/test_k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,28 @@ 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)]
followers = [unit for idx, unit in enumerate(k8s.units) if idx != leader_idx]
await ready_nodes(leader, expected_nodes)

# Remove a control-plane
log.info("Remove unit %s", follower.name)
await follower.destroy()
# Remove both non-leading control-planes (Replicate issue #277)
log.info("Remove unit %s", followers[0].name)
await followers[0].destroy()
await kubernetes_cluster.wait_for_idle(status="active", timeout=10 * 60)
await ready_nodes(leader, expected_nodes - 1)
await k8s.add_unit()

log.info("Remove unit %s", followers[1].name)
await followers[1].destroy()
await kubernetes_cluster.wait_for_idle(status="active", timeout=10 * 60)
await ready_nodes(leader, expected_nodes - 2)

await k8s.add_unit(count=2)
await kubernetes_cluster.wait_for_idle(status="active", timeout=10 * 60)
await ready_nodes(leader, expected_nodes)

Expand Down
Loading