Add deterministic scheduler interval regression tests - #5609
Open
samrusani wants to merge 2 commits into
Open
Conversation
samrusani
marked this pull request as ready for review
July 28, 2026 14:18
Shubham8287
reviewed
Jul 28, 2026
| let previous_timestamp = Timestamp::from_micros_since_unix_epoch(1_000_000); | ||
| let previous_instant = Instant::now(); | ||
|
|
||
| let reschedule = interval_reschedule(interval.into(), (previous_timestamp, previous_instant)).unwrap(); |
Contributor
There was a problem hiding this comment.
interval_reschedule method is too trivial to test. I don't think these tests are really testing anything good.
Author
There was a problem hiding this comment.
Agreed — the helper-only assertion did not cover the execution boundary. I replaced it in 6d01046 with a seam used by the actual scheduled-reducer path: the test simulates completion 30 seconds after the captured call time and verifies that both reschedule timestamps still advance from the call time. As a mutation check, temporarily restoring completion-time rescheduling makes the focused test fail; after restoring call-time rescheduling, the focused test, all 151 core library tests, formatting, and clippy pass.
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.
Description of Changes
Closes #5591.
API and ABI breaking changes
None.
Expected complexity level and risk
Testing
cargo fmt --all -- --checkcargo test -p spacetimedb-core reducer_reschedules_from_call_time_not_completion_timecargo test -p spacetimedb-core host::scheduler::testscargo test -p spacetimedb-core --lib(151 passed)cargo clippy -p spacetimedb-core --all-targets -- -D warningsgit diff --check