Skip to content

Commit 490b332

Browse files
authored
[TST] Add shuttle rng (#2272)
## Description of changes *Summarize the changes made by this PR.* - Improvements & Bug fixes - Uses shuttle rng for the test in #2271 for more exhaustive + determinstic testing. - New functionality - None ## Test plan *How are these changes tested?* - [x] Tests pass locally with `pytest` for python, `yarn test` for js, `cargo test` for rust ## Documentation Changes *Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the [docs repository](https://github.com/chroma-core/docs)?* None
1 parent 31d957e commit 490b332

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

rust/worker/src/blockstore/arrow/concurrency_test.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ mod tests {
44
blockstore::arrow::provider::ArrowBlockfileProvider,
55
storage::{local::LocalStorage, Storage},
66
};
7-
use shuttle::{check_random, future, thread};
7+
use rand::Rng;
8+
use shuttle::{future, thread};
89

910
#[test]
1011
fn test_blockfile_shuttle() {
@@ -17,8 +18,12 @@ mod tests {
1718
let id = writer.id();
1819

1920
// Generate N datapoints and then have T threads write them to the blockfile
20-
let n = 1000;
21-
let t = 5;
21+
let range_min = 10;
22+
let range_max = 10000;
23+
let n = shuttle::rand::thread_rng().gen_range(range_min..range_max);
24+
// Make the max threads the number of cores * 2
25+
let max_threads = num_cpus::get() * 2;
26+
let t = shuttle::rand::thread_rng().gen_range(2..max_threads);
2227
let mut join_handles = Vec::with_capacity(t);
2328
for i in 0..t {
2429
let writer = writer.clone();

0 commit comments

Comments
 (0)