Odin test: with nothing to write, the next change is written on the next pass
Pins the rule that only an attempted write starts the flush interval: a due write with nothing to write leaves the next change to land on the first pass after it. Kills the mutant that starts the interval on every due pass. Soul finding 5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
03f01ddba0
commit
749c6b9bbe
1 changed files with 20 additions and 0 deletions
|
|
@ -3210,6 +3210,26 @@ mod tests {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// A due write with nothing to write does not start the interval: the next
|
||||
/// change is written on the first pass after it.
|
||||
#[test]
|
||||
fn with_nothing_to_write_the_next_change_is_written_on_the_next_pass() -> Result<()> {
|
||||
let mut odin = activated_odin()?;
|
||||
odin.pass()?;
|
||||
let written = file_identity(&odin.store)?;
|
||||
odin.timers.last_projection_refresh = Some(Instant::now());
|
||||
odin.timers.last_heartbeat = Some(Instant::now());
|
||||
odin.timers.last_flush = ago(1_100);
|
||||
odin.pass()?;
|
||||
assert_eq!(file_identity(&odin.store)?, written, "nothing to write");
|
||||
|
||||
odin.heartbeat()?;
|
||||
odin.pass()?;
|
||||
assert_ne!(file_identity(&odin.store)?, written, "the change is written at once");
|
||||
assert_eq!(odin.file_records()?, odin.working_set());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// The lease is checked at the write itself: lost between a change and
|
||||
/// its write, the write is not made and Odin ends.
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Reference in a new issue