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
This commit is contained in:
many 2021-09-06 13:46:19 +02:00
parent 33514b28be
commit c0f9c891f5
No known key found for this signature in database
GPG Key ID: 2CEF23B75189EACA
2 changed files with 12 additions and 2 deletions

View File

@ -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. /// Returns the total amount of bytes available or `None` if this system isn't supported.
fn total_memory_bytes() -> Option<u64> { fn total_memory_bytes() -> Option<u64> {
if System::IS_SUPPORTED { if System::IS_SUPPORTED {

View File

@ -7,7 +7,7 @@ use tempdir::TempDir;
use urlencoding::encode; use urlencoding::encode;
use meilisearch_http::data::Data; use meilisearch_http::data::Data;
use meilisearch_http::option::{IndexerOpts, Opt}; use meilisearch_http::option::{IndexerOpts, MaxMemory, Opt};
use super::index::Index; use super::index::Index;
use super::service::Service; use super::service::Service;
@ -90,7 +90,11 @@ pub fn default_settings(dir: impl AsRef<Path>) -> Opt {
schedule_snapshot: false, schedule_snapshot: false,
snapshot_interval_sec: 0, snapshot_interval_sec: 0,
import_dump: None, 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(), log_level: "off".into(),
} }
} }