Skip to content

Commit

Permalink
simplify test
Browse files Browse the repository at this point in the history
  • Loading branch information
jjbayer committed Sep 12, 2024
1 parent 2fc16b4 commit 3769eb2
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions relay-server/src/services/buffer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ impl Service for EnvelopeBufferService {
mod tests {
use std::time::Duration;

use hashbrown::HashSet;
use relay_dynamic_config::GlobalConfig;
use tokio::sync::mpsc;
use uuid::Uuid;
Expand Down Expand Up @@ -466,16 +465,15 @@ mod tests {
}
addr.send(EnvelopeBuffer::Ready(project_key));

tokio::time::sleep(Duration::from_millis(1000)).await;
tokio::time::sleep(Duration::from_millis(100)).await;

let mut messages = vec![];
project_cache_rx.recv_many(&mut messages, 100).await;

let mut messages = HashSet::new();
while let Ok(value) = project_cache_rx.try_recv() {
messages.insert(value.variant());
}
assert_eq!(
messages
.iter()
.filter(|&&x| x == "HandleDequeuedEnvelope")
.filter(|message| matches!(message, ProjectCache::HandleDequeuedEnvelope(..)))
.count(),
1
);
Expand Down

0 comments on commit 3769eb2

Please sign in to comment.