Skip to content

Commit

Permalink
Merge pull request #1314 from akoshelev/bra-flaky-test
Browse files Browse the repository at this point in the history
Reduce number of iterations for breakdown reveal test
  • Loading branch information
benjaminsavage committed Sep 25, 2024
2 parents 1521f8b + b51e62e commit 4429326
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion ipa-core/src/helpers/transport/stream/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ mod tests {
let stream =
BodyStream::from_bytes_stream(stream::once(future::ready(Ok(Bytes::from(data)))));

stream.try_collect::<Vec<_>>().await.unwrap()
stream.try_collect::<Vec<_>>().await.unwrap();
});
}
}
12 changes: 6 additions & 6 deletions ipa-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ pub(crate) mod test_executor {
pub(crate) mod test_executor {
use std::future::Future;

pub fn run_with<F, Fut, T, const ITER: usize>(f: F) -> T
pub fn run_with<F, Fut, const ITER: usize>(f: F)
where
F: Fn() -> Fut + Send + Sync + 'static,
Fut: Future<Output = T>,
Fut: Future<Output = ()>,
{
tokio::runtime::Builder::new_multi_thread()
// enable_all() is common to use to build Tokio runtime, but it enables both IO and time drivers.
Expand All @@ -134,16 +134,16 @@ pub(crate) mod test_executor {
.enable_time()
.build()
.unwrap()
.block_on(f())
.block_on(f());
}

#[allow(dead_code)]
pub fn run<F, Fut, T>(f: F) -> T
pub fn run<F, Fut>(f: F)
where
F: Fn() -> Fut + Send + Sync + 'static,
Fut: Future<Output = T>,
Fut: Future<Output = ()>,
{
run_with::<_, _, _, 1>(f)
run_with::<_, _, 1>(f);
}
}

Expand Down
8 changes: 6 additions & 2 deletions ipa-core/src/protocol/ipa_prf/aggregation/breakdown_reveal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ pub mod tests {
secret_sharing::{
replicated::semi_honest::AdditiveShare as Replicated, BitDecomposed, TransposeFrom,
},
test_executor::run,
test_executor::run_with,
test_fixture::{Reconstruct, Runner, TestWorld},
};

Expand All @@ -224,7 +224,11 @@ pub mod tests {

#[test]
fn semi_honest_happy_path() {
run(|| async {
// if shuttle executor is enabled, run this test only once.
// it is a very expensive test to explore all possible states,
// sometimes github bails after 40 minutes of running it
// (workers there are really slow).
run_with::<_, _, 3>(|| async {
let world = TestWorld::default();
let mut rng = rand::thread_rng();
let mut expectation = Vec::new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ mod tests {
.await
.unwrap()
})
.await
.await;
});
}

Expand Down

0 comments on commit 4429326

Please sign in to comment.