Merge pull request #183 from ikatson/speed-up-e2e-test

Speed up e2e test
This commit is contained in:
Igor Katson 2024-08-14 12:14:42 +01:00 committed by GitHub
commit dee8106338
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View file

@ -20,7 +20,7 @@ use crate::{
}; };
#[tokio::test(flavor = "multi_thread", worker_threads = 64)] #[tokio::test(flavor = "multi_thread", worker_threads = 64)]
async fn test_e2e() { async fn test_e2e_download() {
let _ = tracing_subscriber::fmt::try_init(); let _ = tracing_subscriber::fmt::try_init();
// 1. Create a torrent // 1. Create a torrent
@ -57,7 +57,7 @@ async fn test_e2e() {
async move { async move {
let peer_id = TestPeerMetadata { let peer_id = TestPeerMetadata {
server_id: i, server_id: i,
max_random_sleep_ms: rand::thread_rng().gen_range(0u8..128), max_random_sleep_ms: rand::thread_rng().gen_range(0u8..16),
} }
.as_peer_id(); .as_peer_id();
let session = crate::Session::new_with_opts( let session = crate::Session::new_with_opts(

View file

@ -58,14 +58,14 @@ impl TestPeerMetadata {
} }
pub fn disconnect_probability(&self) -> f64 { pub fn disconnect_probability(&self) -> f64 {
if self.server_id % 2 == 0 { if self.server_id % 2 == 1 {
return 0.05f64; return 0.05f64;
} }
0f64 0f64
} }
pub fn bad_data_probability(&self) -> f64 { pub fn bad_data_probability(&self) -> f64 {
if self.server_id % 2 == 0 { if self.server_id % 2 == 1 {
return 0.05f64; return 0.05f64;
} }
0f64 0f64