Skip to content

test(ceph): stop the control daemon verify test racing its timeout - #975

Open
abrahamperz wants to merge 1 commit into
canonical:mainfrom
abrahamperz:abrahamperz/test-control-daemon-verify-flake
Open

abrahamperz wants to merge 1 commit into
canonical:mainfrom
abrahamperz:abrahamperz/test-control-daemon-verify-flake

Conversation

@abrahamperz

Copy link
Copy Markdown

Description

TestVerifyControlDaemonAbsentReturnsOnceAbsent in microceph/ceph/control_removal_test.go fails intermittently on loaded hosts. The test reports the daemon absent only on the third presence poll, but it runs inside the shrunken verification window shared with the timeout tests (30ms timeout, 5ms poll interval). When the 5ms poll timers fire late, two waits overrun the 30ms window, verifyControlDaemonAbsent returns after the second poll, and the test fails with expected: 3, actual: 2.

I gave this one test a 10s verification window while keeping the 5ms poll interval. The test does not exercise the timeout path, and the loop still returns as soon as the third poll reports the daemon absent, so the test stays as fast as before. The tests that do exercise the timeout keep the 30ms window. No production code changes.

Fixes #773

Type of change

  • Clean code (code refactor, test updates; does not introduce functional changes)

How has this been tested?

I reproduced the flake on main by running the test binary with GOMAXPROCS=1 while eight busy loops kept the CPU saturated: -test.run TestVerifyControlDaemonAbsentReturnsOnceAbsent -test.count=300 failed 10 of 300 runs with expected: 3, actual: 2.

With this change, the same setup running every TestVerifyControlDaemonAbsent*, TestEnsureMgrAbsent* and TestEnsureMdsAbsent* test 300 times passed every run. I also ran go build ./..., go vet ./... and go test ./... from microceph/, all passing, and gofmt -l reports nothing.

Contributor checklist

Please check that you have:

  • self-reviewed the code in this PR
  • added code comments, particularly in less straightforward areas
  • checked and added or updated relevant documentation
  • added or updated HTML meta descriptions for any new or modified documentation pages (see #643)
  • verified that page title and headings accurately represent page content for new or modified documentation pages
  • checked and added or updated relevant release notes
  • added tests to verify effectiveness of this change

TestVerifyControlDaemonAbsentReturnsOnceAbsent only reports the daemon
absent on the third presence poll, but it ran inside the 30ms
verification window shared with the timeout tests. On a loaded host the
5ms poll timers fire late, two waits overrun the window and the verify
loop gives up after the second poll, failing the test.

Give this test a 10s window. It does not exercise the timeout and the
loop still returns on the third poll, so it stays fast, while the
timeout tests keep the 30ms window.

Assisted-by: claude-code:claude-opus-5-5
Signed-off-by: Abraham Perez <abraham1798@gmail.com>
@abrahamperz
abrahamperz force-pushed the abrahamperz/test-control-daemon-verify-flake branch from dcb2537 to 8bdebf1 Compare November 26, 2026 05:51
@abrahamperz
abrahamperz marked this pull request as ready for review November 26, 2026 05:51
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.

Reduce Flaky Tests

1 participant