From c4888d5123b9647e17b7e5ed6876c44a563fcaec Mon Sep 17 00:00:00 2001 From: Igor Katson Date: Tue, 20 Aug 2024 21:53:43 +0100 Subject: [PATCH] e2e test increasing file limit --- crates/librqbit/src/tests/e2e.rs | 6 +++++- crates/librqbit/src/tests/test_util.rs | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/crates/librqbit/src/tests/e2e.rs b/crates/librqbit/src/tests/e2e.rs index 01496d0..d7ccdb7 100644 --- a/crates/librqbit/src/tests/e2e.rs +++ b/crates/librqbit/src/tests/e2e.rs @@ -10,7 +10,7 @@ use tokio::{ spawn, time::{interval, timeout}, }; -use tracing::{error_span, info, Instrument}; +use tracing::{error, error_span, info, Instrument}; use crate::{ create_torrent, @@ -35,6 +35,10 @@ async fn test_e2e_download() { async fn _test_e2e_download() { let _ = tracing_subscriber::fmt::try_init(); + match crate::try_increase_nofile_limit() { + Ok(limit) => info!(limit, "increased ulimit"), + Err(e) => error!(error=?e, "error increasing ulimit"), + }; spawn_debug_server(); diff --git a/crates/librqbit/src/tests/test_util.rs b/crates/librqbit/src/tests/test_util.rs index 4f4dd3b..ad1de10 100644 --- a/crates/librqbit/src/tests/test_util.rs +++ b/crates/librqbit/src/tests/test_util.rs @@ -5,7 +5,7 @@ use axum::{response::IntoResponse, routing::get, Router}; use librqbit_core::Id20; use rand::{thread_rng, Rng, RngCore, SeedableRng}; use tempfile::TempDir; -use tracing::info; +use tracing::{debug, info}; pub fn create_new_file_with_random_content(path: &Path, mut size: usize) { let mut file = std::fs::OpenOptions::new() @@ -14,7 +14,7 @@ pub fn create_new_file_with_random_content(path: &Path, mut size: usize) { .open(path) .unwrap(); - eprintln!("creating temp file {:?}", path); + debug!(?path, "creating temp file"); const BUF_SIZE: usize = 8192 * 16; let mut rng = rand::rngs::SmallRng::from_entropy(); @@ -32,7 +32,7 @@ pub fn create_default_random_dir_with_torrents( tempdir_prefix: Option<&str>, ) -> TempDir { let dir = TempDir::with_prefix(tempdir_prefix.unwrap_or("rqbit_test")).unwrap(); - dbg!(dir.path()); + info!(path=?dir.path(), "created tempdir"); for f in 0..num_files { create_new_file_with_random_content(&dir.path().join(&format!("{f}.data")), file_size); }