drainAntiEntropy

fun TestScope.drainAntiEntropy(interval: Duration, rounds: Int, settleWindow: Duration = Duration.ZERO, postSettleRounds: Int = 0)

Advances virtual time in bounded steps to let a never-quiescing background system (e.g. Quilter anti-entropy) converge — the safe replacement for kotlinx.coroutines.test.TestCoroutineScheduler.advanceUntilIdle, which would spin forever on a re-arming timer (see the file KDoc).

The sequence is:

  1. rounds pumps of interval (drive delta-exchange / anti-entropy convergence),

  2. one settleWindow one-shot delay if it is positive (e.g. a claim/settle window),

  3. postSettleRounds further pumps of interval (post-settle convergence).

Each pump is followed by runCurrent to flush tasks scheduled at the boundary instant — advanceTimeBy does not run tasks scheduled at exactly the new current time.

Parameters

interval

the background cadence, typically QuilterConfig.antiEntropyInterval.

rounds

number of interval pumps before the settle window; must be >= 0.

settleWindow

a one-shot delay after the first convergence pass; Duration.ZERO (the default) skips it.

postSettleRounds

number of interval pumps after the settle window; must be >= 0.