From c0f9c891f512c1e622b7a929337b5af2e12ce4a0 Mon Sep 17 00:00:00 2001 From: many Date: Mon, 6 Sep 2021 13:46:19 +0200 Subject: [PATCH] Set max_memory value to unlimited during tests because tests run several meilisearch in parallel, we over estimate the value for max_memory making the tests on widows crash --- meilisearch-http/src/option.rs | 6 ++++++ meilisearch-http/tests/common/server.rs | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/meilisearch-http/src/option.rs b/meilisearch-http/src/option.rs index f3c077c05..e5aa1553a 100644 --- a/meilisearch-http/src/option.rs +++ b/meilisearch-http/src/option.rs @@ -286,6 +286,12 @@ impl Deref for MaxMemory { } } +impl MaxMemory { + pub fn unlimited() -> Self { + Self(None) + } +} + /// Returns the total amount of bytes available or `None` if this system isn't supported. fn total_memory_bytes() -> Option { if System::IS_SUPPORTED { diff --git a/meilisearch-http/tests/common/server.rs b/meilisearch-http/tests/common/server.rs index 6cf1acb6a..52c0e30ea 100644 --- a/meilisearch-http/tests/common/server.rs +++ b/meilisearch-http/tests/common/server.rs @@ -7,7 +7,7 @@ use tempdir::TempDir; use urlencoding::encode; use meilisearch_http::data::Data; -use meilisearch_http::option::{IndexerOpts, Opt}; +use meilisearch_http::option::{IndexerOpts, MaxMemory, Opt}; use super::index::Index; use super::service::Service; @@ -90,7 +90,11 @@ pub fn default_settings(dir: impl AsRef) -> Opt { schedule_snapshot: false, snapshot_interval_sec: 0, import_dump: None, - indexer_options: IndexerOpts::default(), + 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(), } }