Skip to content

Commit

Permalink
Reduce channel size in overflow tests
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinI committed Nov 27, 2024
1 parent 6c5aeb8 commit 1f1f21a
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions crates/shared/src/coordinator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -756,13 +756,16 @@ mod tests {
#[tokio::test]
#[traced_test]
async fn test_transaction_status() {
// Lower for this test not to spend too much time here
const CHANNEL_BUFFER_SIZE: usize = 32;

let coordinator = BuilderStateCoordinator::new(
TEST_CHANNEL_BUFFER_SIZE,
CHANNEL_BUFFER_SIZE,
TEST_INCLUDED_TX_GC_PERIOD,
TEST_TX_STATUS_CACHE_CAPACITY,
);

let enqueued_transactions = (0..TEST_CHANNEL_BUFFER_SIZE)
let enqueued_transactions = (0..CHANNEL_BUFFER_SIZE)
.map(|_| mock::transaction())
.collect::<Vec<_>>();

Expand Down Expand Up @@ -829,14 +832,17 @@ mod tests {
#[tokio::test]
#[traced_test]
async fn test_transaction_overflow() {
// Lower for this test not to spend too much time here
const CHANNEL_BUFFER_SIZE: usize = 32;

let coordinator = BuilderStateCoordinator::new(
TEST_CHANNEL_BUFFER_SIZE,
CHANNEL_BUFFER_SIZE,
TEST_INCLUDED_TX_GC_PERIOD,
TEST_TX_STATUS_CACHE_CAPACITY,
);

// Coordinator should handle transactions while there's space in the buffer
for _ in 0..TEST_CHANNEL_BUFFER_SIZE {
for _ in 0..CHANNEL_BUFFER_SIZE {
coordinator
.handle_transaction(ReceivedTransaction::new(
mock::transaction(),
Expand Down Expand Up @@ -866,7 +872,7 @@ mod tests {
.await;

// After clearing the channel, coordinator should handle transactions again
for _ in 0..TEST_CHANNEL_BUFFER_SIZE {
for _ in 0..CHANNEL_BUFFER_SIZE {
coordinator
.handle_transaction(ReceivedTransaction::new(
mock::transaction(),
Expand Down

0 comments on commit 1f1f21a

Please sign in to comment.