Fix warnings in tests

This commit is contained in:
Valentin Brandl 2022-10-11 10:32:37 +02:00
parent 0e6224dd7b
commit af7163711d
No known key found for this signature in database
GPG Key ID: 62E7C7F2C48DBBF2

View File

@ -14,8 +14,9 @@ lazy_static::lazy_static! {
pub struct TestApp { pub struct TestApp {
pub address: String, pub address: String,
repo_dir: TempDir, // Those are unused but are hold to be dropped and deleted after the TestApp goes out of scope
cache_dir: TempDir, _repo_dir: TempDir,
_cache_dir: TempDir,
} }
pub async fn spawn_app() -> TestApp { pub async fn spawn_app() -> TestApp {
@ -26,15 +27,12 @@ pub async fn spawn_app() -> TestApp {
let port = listener.local_addr().unwrap().port(); let port = listener.local_addr().unwrap().port();
let address = format!("http://127.0.0.1:{}", port); let address = format!("http://127.0.0.1:{}", port);
let repo_dir = tempdir().expect("Cannot create repo_dir"); let _repo_dir = tempdir().expect("Cannot create repo_dir");
let cache_dir = tempdir().expect("Cannot create cache_dir"); let _cache_dir = tempdir().expect("Cannot create cache_dir");
let mut settings = Settings::load().expect("Failed to read configuration."); let mut settings = Settings::load().expect("Failed to read configuration.");
settings.repodir = repo_dir.path().to_path_buf(); settings.repodir = _repo_dir.path().to_path_buf();
settings.cachedir = cache_dir.path().to_path_buf(); settings.cachedir = _cache_dir.path().to_path_buf();
// configuration.database.database_name = Uuid::new_v4().to_string();
// let connection_pool = configure_database(&configuration.database).await;
let server = hoc::run(listener, settings) let server = hoc::run(listener, settings)
.await .await
@ -44,7 +42,7 @@ pub async fn spawn_app() -> TestApp {
TestApp { TestApp {
address, address,
repo_dir, _repo_dir,
cache_dir, _cache_dir,
} }
} }