drainAntiEntropyUntil

fun TestScope.drainAntiEntropyUntil(interval: Duration, maxRounds: Int, describe: () -> String = { "condition never satisfied" }, predicate: () -> Boolean)

Bounded virtual-time drain that stops as soon as predicate holds — the early-exit companion to drainAntiEntropy.

Pumps interval up to maxRounds times, checking predicate before each pump. Returns as soon as it holds; if it is still false after maxRounds pumps, throws with describe so a genuine non-convergence fails loud and fast instead of silently passing or spinning (the trap of kotlinx.coroutines.test.TestCoroutineScheduler.advanceUntilIdle).

Pure virtual time only — no real-clock sleeps. A test that must bridge a real-IO completion into virtual time needs its own real-time-bounded poll.

Parameters

interval

the background cadence, typically QuilterConfig.antiEntropyInterval.

maxRounds

the hard ceiling on interval pumps; must be > 0.

describe

context for the failure message if predicate never holds.

predicate

the convergence condition to wait for.