Skip to content

test: wait on conditions instead of fixed delays in timing-sensitive tests - #64

Merged
windischb merged 1 commit into
developfrom
test/deterministic-timing-tests
Oct 6, 2026
Merged

windischb merged 1 commit into
developfrom
test/deterministic-timing-tests

Conversation

@windischb

Copy link
Copy Markdown
Contributor

Summary

Four tests failed intermittently on loaded CI runners; Develop - Push was red in three of its last five runs because of them. No product code changes.

Test Why it was flaky Now
FileProviderStressTests.MalformedJsonRecovery_… Fixed 100 ms sleeps, then emissions read by index Waits for the empty object before writing valid content, then for the recovered content
FileProviderMultiQueryTests.SingleProvider_MultipleQueries_SameFile_ShareChangeStream Compared emission counts while an event could still be in delivery to the second subscriber Waits for equal counts on the final value
FileProviderMultiQueryTests.SingleProvider_DifferentDebouncePerQuery_IndependentThrottling Asserted fast >= slow emission counts, which depends on how writes fall into the debounce windows Checks that neither query misses the final state; renamed accordingly
CertificateFolderTests.FolderRename_DetectsNewCertificates 3 s deadline; a rename right after the watcher is built can be missed and is only found by the 60 s audit pass 90 s deadline, still returns as soon as the folder is usable

Also: emissions are recorded in a lock-protected EmissionLog (they arrive on a watcher thread), and the provider test wait helper defaults to 15 s instead of 2 s.

Test plan

  • Provider tests 10× in a row, certificate folder tests 3×
  • Full suite (Type!=Performance) 3× in a row — all green

🤖 Generated with Claude Code

…tests

Four tests failed intermittently on loaded CI runners and turned the develop
pipeline red in three of its last five runs:

- MalformedJsonRecovery slept 100 ms after each write and then inspected the
  emission list by index. It now waits for the empty object before writing the
  valid content, and for the recovered content afterwards.
- The shared-change-stream test compared emission counts while a file-system
  event could still be on its way to the second subscriber. It now waits for
  equal counts on the final value.
- The per-query debounce test asserted an ordering of emission counts that
  depends on how writes fall into the debounce windows. It keeps what must hold:
  neither query misses the final state. Renamed to say so.
- The certificate folder rename test gave the watcher three seconds. A rename
  right after the watcher is built can be missed as an event and is then found
  by the monitor's 60-second audit pass; the deadline now covers that.

Emissions are recorded in a lock-protected log, because they arrive on a watcher
thread while the test thread reads them. The wait helper's default timeout is
15 seconds; it only bounds a hung test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@windischb
windischb merged commit 0f0eb8a into develop Oct 6, 2026
4 checks passed
@windischb
windischb deleted the test/deterministic-timing-tests branch October 6, 2026 06:43
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.

1 participant