Repository navigation
fix(tests): make five platform-, order- and size-dependent tests dete… - #29
Merged
Merged
Conversation
dundich
force-pushed
the
fix/ci-flaky-tests
branch
from
October 29, 2026 12:10
767ec12 to
d8ea2f1
Compare
…s deterministic
CI was red on both legs, and every failure was a test defect rather than a
product regression.
Sa.Outbox.PostgreSqlTests (ubuntu):
- SelectTenant_ReturnsEveryTenantExactlyOnce relied on the sibling test having
seeded all four tenants in the shared fixture table. xUnit guarantees no
order, and on the runner this test ran first, so DISTINCT saw only the two
tenants it had published itself (expected 4, actual 2). It now seeds every
configured tenant itself, two messages each, keeping the dedup meaningful.
Sa.Utils.WorkQueue.Tests (ubuntu):
- ShutdownAsync_StopsProcessing expected exactly five Cancelled callbacks, but
the default pool is ConcurrencyLimit ?? ProcessorCount readers with a buffer
of the same size. On a 4-core runner only four items were in flight, the
fifth was drained as Faulted ("dropped") instead of Cancelled, and the count
went 5 != 4. The pool is now sized explicitly and the test waits for all five
items to actually start instead of sleeping 50 ms.
- The WorkQueueSyncReaderTests snapshot helper enumerated _readers without the
queue's own _readersSync, so it raced with readers being removed from their
own threads: "Collection was modified; enumeration operation may not execute"
out of ReArm_WhileCancellingReaders_... The fault was in the snapshot, not in
the queue. The helper now takes the very same System.Threading.Lock
(Enter/Exit through reflection, because EnterScope returns a ref struct;
Monitor would take the object's monitor, which a Lock does not use).
Sa.Media.FFmpegTests (windows):
- OwnTimeout_FiresAtTheDeadlineNotAtProcessDeath hardcoded "sleep" in the
timeout message, while LongRunningProcess starts ping on Windows. The
expectation is now platform-aware.
- ConvertToOgg_ShouldBeWork used RequireEncoderAvailable("libvorbis"), which
fails, although the test documents that a stale win-x64 payload should skip.
Switched to EnsureEncoderAvailable, and CodecProbe now trims whitespace
before trimming the punctuation (Windows lines arrive with '\r'). The skip
reason carries the detected executable path, its version and the external
encoders that were found, so a missing encoder can be told apart from the
probe picking up a foreign ffmpeg.
SaTests:
- Levenshtein_Distance_StringsLongerThanStack_DoNotOverflow used two 60 000-char
strings, and the DP is O(n*m): 3.6e9 cell updates, measured 21 s in Release
and well over a minute in Debug, where the test's own 60-second thread Join
turned a slow run into "Test thread did not finish". The size only has to
overflow the stack of a naive stackalloc of the three int rows: 6 000 chars
give 3 * 6 001 * 4 = 72 KB on a dedicated 64 KB stack, so the regression is
still detected while the compute drops to 0.38 s Release / 1.0 s Debug.
RunOnSmallStackThread takes the stack size (default: the 256 KB ASP.NET-like
one) and quadratic work gets SmallStackBytesForQuadraticWork.
dundich
force-pushed
the
fix/ci-flaky-tests
branch
from
October 29, 2026 12:10
d8ea2f1 to
a36f7c0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…rministic
CI was red on both legs, and every failure was a test defect rather than a product regression.
Sa.Outbox.PostgreSqlTests (ubuntu):
Sa.Utils.WorkQueue.Tests (ubuntu):
Sa.Media.FFmpegTests (windows):
SaTests: