Skip to content

test(continuous): per-instance trigger-miss hook#542

Open
julio4 wants to merge 1 commit into
mainfrom
fix/continuous-test-hook-isolation
Open

test(continuous): per-instance trigger-miss hook#542
julio4 wants to merge 1 commit into
mainfrom
fix/continuous-test-hook-isolation

Conversation

@julio4

@julio4 julio4 commented Jun 16, 2026

Copy link
Copy Markdown
Member

Fallback test was flaky with the force trigger-miss hook, that relied on a process-global count that any concurrent test could consume. Replaced with per-builder Arc.

… process global

The previous `FORCE_TAKE_MISS_COUNT` static in `shared_best.rs` was a
process-global AtomicU64, so under `cargo test` (all tests in one process,
parallel threads) any other continuous-mode test calling `SharedBest::take()`
in its build loop could consume the forced miss intended for
`smoke_continuous_trigger_miss_fallback_publishes_candidate`, causing the
fallback test to pass vacuously or perturbing a sibling test.

Replace the global with a per-builder `Arc<AtomicU64>` seeded from a new
`initial_force_take_miss_count` field on `FlashblocksConfig` (and
`FlashblocksArgs`, `#[arg(skip)]`).  `OpPayloadBuilderInner` holds the Arc
(`#[cfg(test)]`), clones it into every `SharedBest` via
`start_flashblock_interval`, and `SharedBest::take()` does the decrement on
`self.force_take_miss` rather than the global.  The test sets
`initial_force_take_miss_count: 1` in its `OpRbuilderArgs` literal; all
global hook infrastructure (`ForceTakeMissGuard`, `force_next_take_misses`,
`should_force_take_miss`, and the `continuous_test_hooks` re-exports) is
deleted.  Verified with both `cargo nextest run` and `cargo test`.
/// Number of forced `SharedBest::take()` misses for test isolation.
/// Consumed only under `#[cfg(test)]`; else always 0.
#[arg(skip)]
pub initial_force_take_miss_count: u64,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this not be refactored such that the test instance can be configured with a test SharedBest instance with test config?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants