e2e test increasing file limit
This commit is contained in:
parent
65feec3406
commit
c4888d5123
2 changed files with 8 additions and 4 deletions
|
|
@ -10,7 +10,7 @@ use tokio::{
|
||||||
spawn,
|
spawn,
|
||||||
time::{interval, timeout},
|
time::{interval, timeout},
|
||||||
};
|
};
|
||||||
use tracing::{error_span, info, Instrument};
|
use tracing::{error, error_span, info, Instrument};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
create_torrent,
|
create_torrent,
|
||||||
|
|
@ -35,6 +35,10 @@ async fn test_e2e_download() {
|
||||||
|
|
||||||
async fn _test_e2e_download() {
|
async fn _test_e2e_download() {
|
||||||
let _ = tracing_subscriber::fmt::try_init();
|
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();
|
spawn_debug_server();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ use axum::{response::IntoResponse, routing::get, Router};
|
||||||
use librqbit_core::Id20;
|
use librqbit_core::Id20;
|
||||||
use rand::{thread_rng, Rng, RngCore, SeedableRng};
|
use rand::{thread_rng, Rng, RngCore, SeedableRng};
|
||||||
use tempfile::TempDir;
|
use tempfile::TempDir;
|
||||||
use tracing::info;
|
use tracing::{debug, info};
|
||||||
|
|
||||||
pub fn create_new_file_with_random_content(path: &Path, mut size: usize) {
|
pub fn create_new_file_with_random_content(path: &Path, mut size: usize) {
|
||||||
let mut file = std::fs::OpenOptions::new()
|
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)
|
.open(path)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
eprintln!("creating temp file {:?}", path);
|
debug!(?path, "creating temp file");
|
||||||
|
|
||||||
const BUF_SIZE: usize = 8192 * 16;
|
const BUF_SIZE: usize = 8192 * 16;
|
||||||
let mut rng = rand::rngs::SmallRng::from_entropy();
|
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_prefix: Option<&str>,
|
||||||
) -> TempDir {
|
) -> TempDir {
|
||||||
let dir = TempDir::with_prefix(tempdir_prefix.unwrap_or("rqbit_test")).unwrap();
|
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 {
|
for f in 0..num_files {
|
||||||
create_new_file_with_random_content(&dir.path().join(&format!("{f}.data")), file_size);
|
create_new_file_with_random_content(&dir.path().join(&format!("{f}.data")), file_size);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue