From 8fecc6238ddd60937564a4fa55cfe1642d1d62f2 Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Mon, 21 Mar 2022 10:50:55 +0100 Subject: [PATCH] Make the test use the default CLI options --- meilisearch-http/tests/common/server.rs | 27 +++---------------------- meilisearch-lib/src/options.rs | 13 ------------ 2 files changed, 3 insertions(+), 37 deletions(-) diff --git a/meilisearch-http/tests/common/server.rs b/meilisearch-http/tests/common/server.rs index dcb4b6266..9a94085a4 100644 --- a/meilisearch-http/tests/common/server.rs +++ b/meilisearch-http/tests/common/server.rs @@ -1,4 +1,6 @@ #![allow(dead_code)] + +use clap::Parser; use std::path::Path; use actix_web::http::StatusCode; @@ -126,36 +128,13 @@ pub fn default_settings(dir: impl AsRef) -> Opt { Opt { db_path: dir.as_ref().join("db"), dumps_dir: dir.as_ref().join("dump"), - http_addr: "127.0.0.1:7700".to_owned(), - master_key: None, env: "development".to_owned(), #[cfg(all(not(debug_assertions), feature = "analytics"))] no_analytics: true, max_index_size: Byte::from_unit(4.0, ByteUnit::GiB).unwrap(), max_task_db_size: Byte::from_unit(4.0, ByteUnit::GiB).unwrap(), http_payload_size_limit: Byte::from_unit(10.0, ByteUnit::MiB).unwrap(), - ssl_cert_path: None, - ssl_key_path: None, - ssl_auth_path: None, - ssl_ocsp_path: None, - ssl_require_auth: false, - ssl_resumption: false, - ssl_tickets: false, - import_snapshot: None, - ignore_missing_snapshot: false, - ignore_snapshot_if_db_exists: false, snapshot_dir: ".".into(), - schedule_snapshot: false, - snapshot_interval_sec: 0, - import_dump: None, - ignore_missing_dump: false, - ignore_dump_if_db_exists: false, - indexer_options: IndexerOpts { - // memory has to be unlimited because several meilisearch are running in test context. - max_memory: MaxMemory::unlimited(), - ..Default::default() - }, - log_level: "off".into(), - scheduler_options: meilisearch_lib::options::SchedulerConfig::default(), + ..Parser::parse_from(None as Option<&str>) } } diff --git a/meilisearch-lib/src/options.rs b/meilisearch-lib/src/options.rs index 195576799..e04396627 100644 --- a/meilisearch-lib/src/options.rs +++ b/meilisearch-lib/src/options.rs @@ -90,19 +90,6 @@ impl TryFrom<&IndexerOpts> for IndexerConfig { } } -impl Default for IndexerOpts { - fn default() -> Self { - Self { - log_every_n: 100_000, - max_nb_chunks: None, - max_memory: MaxMemory::default(), - chunk_compression_type: CompressionType::None, - chunk_compression_level: None, - indexing_jobs: None, - } - } -} - /// A type used to detect the max memory available and use 2/3 of it. #[derive(Debug, Clone, Copy)] pub struct MaxMemory(Option);