Skip to content

fix(test): wait for cluster ready before checking coredns after start - #5546

Merged
ktsakalozos-canonical merged 1 commit into
masterfrom
fix/test-stop-start-coredns-wait
Jun 26, 2026
Merged

fix(test): wait for cluster ready before checking coredns after start#5546
ktsakalozos-canonical merged 1 commit into
masterfrom
fix/test-stop-start-coredns-wait

Conversation

@louiseschmidtgen

Copy link
Copy Markdown
Contributor

Problem

test_microk8s_stop_start was intermittently flaky. After calling microk8s.start (which returns once snap services are started), it immediately checked for coredns processes with no wait. coredns is a pod scheduled by kubelite — it takes a few extra seconds after the services are up to be scheduled and running.

Fix

Add a call to utils.wait_for_installation() after microk8s.start, before asserting coredns is running. This polls until the node is Ready (plus a 30s buffer), which guarantees coredns is scheduled and running. This is the idiomatic pattern already used elsewhere in the test suite.

No logic changes — just inserting the existing wait helper at the right point.

Context

Discovered while working on canonical/k8s-dqlite#369, which runs this test suite in CI and had to use continue-on-error: true to work around the flakiness.

test_microk8s_stop_start was flaky because after microk8s.start it
immediately checked for coredns processes with no wait.  microk8s.start
returns as soon as the snap services are started, but coredns (a pod
managed by kubelite) takes a few more seconds to be scheduled and run.

Fix: call wait_for_installation() after microk8s.start to wait until
the node is Ready and all core services have settled before asserting
that coredns is running.  This is the idiomatic pattern used elsewhere
in the test suite.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
louiseschmidtgen added a commit to canonical/k8s-dqlite that referenced this pull request Jun 11, 2026
canonical/microk8s#5546 adds wait_for_installation() after microk8s.start,
so coredns is guaranteed to be running before the assertion. The flakiness
is fixed upstream; no need to tolerate failures here.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
louiseschmidtgen added a commit to canonical/k8s-dqlite that referenced this pull request Jun 11, 2026
- join_cluster: call 'microk8s status --wait-ready' after joining so the
  node is fully registered in the cluster before wait_until_ready is called
- get_local_node_status: MicroK8s HA nodes do not get the
  node-role.kubernetes.io/control-plane label; check whether
  snap.microk8s.daemon-k8s-dqlite.service is active instead
- Restore continue-on-error on stop/start step until
  canonical/microk8s#5546 merges

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ktsakalozos-canonical
ktsakalozos-canonical merged commit c7feadc into master Jun 26, 2026
23 checks passed
@ktsakalozos-canonical
ktsakalozos-canonical deleted the fix/test-stop-start-coredns-wait branch June 26, 2026 14:17
louiseschmidtgen added a commit to canonical/k8s-dqlite that referenced this pull request Jun 29, 2026
The microk8s flakiness fix (canonical/microk8s#5546) has merged, so the
stop/start lifecycle test no longer needs to tolerate failures.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants