From 25cd3c75cc6145a2f65a0257e9934f2c7824a492 Mon Sep 17 00:00:00 2001 From: Igor Katson Date: Tue, 5 Mar 2024 01:53:41 -0800 Subject: [PATCH] Tests now compile but take too long on github actions --- crates/librqbit/Cargo.toml | 1 + crates/librqbit/src/tests/test_util.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/librqbit/Cargo.toml b/crates/librqbit/Cargo.toml index 5f43844..6fec66f 100644 --- a/crates/librqbit/Cargo.toml +++ b/crates/librqbit/Cargo.toml @@ -76,3 +76,4 @@ futures = {version = "0.3"} tracing-subscriber = "0.3" tokio-test = "0.4" tempfile = "3" +rand = {version = "0.8", features = ["small_rng"]} diff --git a/crates/librqbit/src/tests/test_util.rs b/crates/librqbit/src/tests/test_util.rs index e72780a..aac8af0 100644 --- a/crates/librqbit/src/tests/test_util.rs +++ b/crates/librqbit/src/tests/test_util.rs @@ -1,7 +1,7 @@ use std::{io::Write, path::Path}; use librqbit_core::Id20; -use rand::RngCore; +use rand::{RngCore, SeedableRng}; use tempfile::TempDir; pub fn create_new_file_with_random_content(path: &Path, mut size: usize) { @@ -14,7 +14,7 @@ pub fn create_new_file_with_random_content(path: &Path, mut size: usize) { eprintln!("creating temp file {:?}", path); const BUF_SIZE: usize = 8192 * 16; - let mut rng = rand::rngs::OsRng; + let mut rng = rand::rngs::SmallRng::from_entropy(); let mut write_buf = [0; BUF_SIZE]; while size > 0 { rng.fill_bytes(&mut write_buf[..]);