Add regression tests for record renewal in credentials-core

Merged
IC
1d ago
+506-1

Refs #88

This pull request changes tests only. If it fits, please label it trivial, as CONTRIBUTING.md allows when there is no design to agree.

What changes

  1. test(credentials-core): cover record renewal adds 15 tests for the renewal coordinator and its store writes: refresh intents, report cooldowns, parked records, forced reads, and the lock registry. They are in engine_tests.rs, store_tests.rs, and the #[cfg(test)] mod lock_registry_tests in engine.rs. No production code changes.
  2. test(credentials-core): let RefreshLogs see cached callsites is a separate commit with the subscriber change you asked for: RefreshLogs returns Interest::always() from register_callsite and filters by target in event(), as connectors_tests.rs does. This is a suspected cause of the auth_events_refresh_outage_logs_onset_and_recovery_across_restarts flake, not a proven one: in our runs that test still failed once with this change applied. You can drop this commit and keep the first one.

How it was checked

The 32 code changes in the issue table are the ones these tests catch. Each new test fails on its change and passes on unchanged code. After review, three assertions became stricter (an exact error variant, a success read before a refusal, and no deferral row on a forced read), and a planted change proved each one again.

On the head of this branch (master 1a40f031 plus these two commits), on Linux: cargo fmt --all -- --check and cargo clippy --workspace --all-targets -- -D warnings pass. cargo test -p credentials-core --all-features passed in two of three runs (1278 tests each). The third run failed only auth_events_refresh_outage_logs_onset_and_recovery_across_restarts at engine_tests.rs:1188. That is the flake that the second commit is for, so the second commit does not remove it completely.

AI helped write this draft.


Summary by cubic

Adds regression tests covering the record renewal coordinator and its store writes, tied to the failing cases from issue #88. Tests only, no production code changes.

  • Adds 15 tests across engine_tests.rs, store_tests.rs, and engine.rs for refresh intents, report cooldowns, parked records, forced reads, and the lock registry.
  • Updates RefreshLogs in engine_tests.rs to register callsites with Interest::always() and filter by target in event(), matching how connectors_tests.rs works. This is a suspected cause of the auth_events_refresh_outage_logs_onset_and_recovery_across_restarts flake, not a proven one—the test still failed once with the change applied. Drop this commit if you prefer to keep the PR strictly tests-only.