don't use strings for paths

This commit is contained in:
Maxime Van Hees
2025-09-25 16:25:08 +02:00
parent 7f689ae29b
commit 77a53bae86
13 changed files with 54 additions and 41 deletions

View File

@@ -1,4 +1,5 @@
use herodb::{server::Server, options::DBOption};
use std::path::PathBuf;
use std::time::Duration;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::TcpStream;
@@ -22,7 +23,7 @@ async fn debug_hset_simple() {
let port = 16500;
let option = DBOption {
dir: test_dir.to_string(),
dir: PathBuf::from(test_dir),
port,
debug: false,
encrypt: false,

View File

@@ -1,4 +1,5 @@
use herodb::{server::Server, options::DBOption};
use std::path::PathBuf;
use std::time::Duration;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::TcpStream;
@@ -13,7 +14,7 @@ async fn debug_hset_return_value() {
std::fs::create_dir_all(&test_dir).unwrap();
let option = DBOption {
dir: test_dir.to_string(),
dir: PathBuf::from(test_dir),
port: 16390,
debug: false,
encrypt: false,

View File

@@ -1,4 +1,5 @@
use herodb::{server::Server, options::DBOption};
use std::path::PathBuf;
use std::time::Duration;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::TcpStream;
@@ -17,7 +18,7 @@ async fn start_test_server(test_name: &str) -> (Server, u16) {
std::fs::create_dir_all(&test_dir).unwrap();
let option = DBOption {
dir: test_dir,
dir: PathBuf::from(test_dir),
port,
debug: true,
encrypt: false,

View File

@@ -1,6 +1,7 @@
use herodb::rpc::{BackendType, DatabaseConfig};
use herodb::admin_meta;
use herodb::options::BackendType as OptionsBackendType;
use std::path::Path;
#[tokio::test]
async fn test_rpc_server_basic() {
@@ -70,11 +71,11 @@ async fn test_database_name_persistence() {
let _ = std::fs::remove_dir_all(base_dir);
// Set the database name
admin_meta::set_database_name(base_dir, backend.clone(), admin_secret, db_id, test_name)
admin_meta::set_database_name(Path::new(base_dir), backend.clone(), admin_secret, db_id, test_name)
.expect("Failed to set database name");
// Retrieve the database name
let retrieved_name = admin_meta::get_database_name(base_dir, backend, admin_secret, db_id)
let retrieved_name = admin_meta::get_database_name(Path::new(base_dir), backend, admin_secret, db_id)
.expect("Failed to get database name");
// Verify the name matches

View File

@@ -1,4 +1,5 @@
use herodb::{server::Server, options::DBOption};
use std::path::PathBuf;
use std::time::Duration;
use tokio::time::sleep;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
@@ -19,7 +20,7 @@ async fn start_test_server(test_name: &str) -> (Server, u16) {
std::fs::create_dir_all(&test_dir).unwrap();
let option = DBOption {
dir: test_dir,
dir: PathBuf::from(test_dir),
port,
debug: true,
encrypt: false,

View File

@@ -1,4 +1,5 @@
use herodb::{server::Server, options::DBOption};
use std::path::PathBuf;
use std::time::Duration;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::TcpStream;
@@ -17,7 +18,7 @@ async fn start_test_server(test_name: &str) -> (Server, u16) {
std::fs::create_dir_all(&test_dir).unwrap();
let option = DBOption {
dir: test_dir,
dir: PathBuf::from(test_dir),
port,
debug: false,
encrypt: false,

View File

@@ -1,4 +1,5 @@
use herodb::{options::DBOption, server::Server};
use std::path::PathBuf;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::TcpStream;
use tokio::time::{sleep, Duration};
@@ -17,7 +18,7 @@ async fn start_test_server(test_name: &str) -> (Server, u16) {
std::fs::create_dir_all(&test_dir).unwrap();
let option = DBOption {
dir: test_dir,
dir: PathBuf::from(test_dir),
port,
debug: false,
encrypt: false,