Skip to content

Commit cbd1ef6

Browse files
authoredFeb 5, 2025··
Merge branch 'torrust:develop' into develop
2 parents 96c568d + 109aef6 commit cbd1ef6

File tree

30 files changed

+1329
-368
lines changed

30 files changed

+1329
-368
lines changed
 

‎packages/test-helpers/src/configuration.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//! Tracker configuration factories for testing.
22
use std::env;
33
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr};
4+
use std::path::PathBuf;
45
use std::time::Duration;
56

67
use torrust_tracker_configuration::{Configuration, HttpApi, HttpTracker, Threshold, UdpTracker};
@@ -63,15 +64,19 @@ pub fn ephemeral() -> Configuration {
6364
tsl_config: None,
6465
}]);
6566

66-
// Ephemeral sqlite database
67-
let temp_directory = env::temp_dir();
68-
let random_db_id = random::string(16);
69-
let temp_file = temp_directory.join(format!("data_{random_db_id}.db"));
67+
let temp_file = ephemeral_sqlite_database();
7068
temp_file.to_str().unwrap().clone_into(&mut config.core.database.path);
7169

7270
config
7371
}
7472

73+
#[must_use]
74+
pub fn ephemeral_sqlite_database() -> PathBuf {
75+
let temp_directory = env::temp_dir();
76+
let random_db_id = random::string(16);
77+
temp_directory.join(format!("data_{random_db_id}.db"))
78+
}
79+
7580
/// Ephemeral configuration with reverse proxy enabled.
7681
#[must_use]
7782
pub fn ephemeral_with_reverse_proxy() -> Configuration {

‎packages/tracker-core/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.coverage

‎packages/tracker-core/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ bittorrent-http-protocol = { version = "3.0.0-develop", path = "../http-protocol
2020
bittorrent-primitives = "0.1.0"
2121
chrono = { version = "0", default-features = false, features = ["clock"] }
2222
derive_more = { version = "1", features = ["as_ref", "constructor", "from"] }
23+
mockall = "0"
2324
r2d2 = "0"
2425
r2d2_mysql = "25"
2526
r2d2_sqlite = { version = "0", features = ["bundled"] }

‎packages/tracker-core/src/announce_handler.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ mod tests {
425425

426426
config.core.tracker_policy.persistent_torrent_completed_stat = true;
427427

428-
let database = initialize_database(&config);
428+
let database = initialize_database(&config.core);
429429
let in_memory_torrent_repository = Arc::new(InMemoryTorrentRepository::default());
430430
let db_torrent_repository = Arc::new(DatabasePersistentTorrentRepository::new(&database));
431431
let torrents_manager = Arc::new(TorrentsManager::new(

0 commit comments

Comments
 (0)
Please sign in to comment.