Skip to content

Commit

Permalink
Fixing functional tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
fulmicoton committed Nov 5, 2023
1 parent ef603c8 commit 4f8925d
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/aggregation/agg_limits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ impl AggregationLimits {
/// Create a new ResourceLimitGuard, that will release the memory when dropped.
pub fn new_guard(&self) -> ResourceLimitGuard {
ResourceLimitGuard {
/// The counter which is shared between the aggregations for one request.
// The counter which is shared between the aggregations for one request.
memory_consumption: Arc::clone(&self.memory_consumption),
/// The memory_limit in bytes
// The memory_limit in bytes
memory_limit: self.memory_limit,
allocated_with_the_guard: 0,
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ impl Index {
/// Using a single thread gives us a deterministic allocation of DocId.
#[cfg(test)]
pub fn writer_for_tests<D: Document>(&self) -> crate::Result<IndexWriter<D>> {
self.writer_with_num_threads(1, 15_000_000)
self.writer_with_num_threads(1, MEMORY_BUDGET_NUM_BYTES_MIN)
}

/// Creates a multithreaded writer
Expand Down
2 changes: 1 addition & 1 deletion src/docset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub trait DocSet: Send {
///
/// The DocId of the next element is returned.
/// In other words we should always have :
/// ```ignore
/// ```compile_fail
/// let doc = docset.advance();
/// assert_eq!(doc, docset.doc());
/// ```
Expand Down
8 changes: 5 additions & 3 deletions src/functional_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fn test_functional_store() -> crate::Result<()> {
let mut rng = thread_rng();

let mut index_writer: IndexWriter =
index.writer_with_num_threads(3, MEMORY_BUDGET_NUM_BYTES_MIN)?;
index.writer_with_num_threads(3, 3 * MEMORY_BUDGET_NUM_BYTES_MIN)?;

let mut doc_set: Vec<u64> = Vec::new();

Expand Down Expand Up @@ -92,7 +92,8 @@ fn test_functional_indexing_sorted() -> crate::Result<()> {

let mut rng = thread_rng();

let mut index_writer: IndexWriter = index.writer_with_num_threads(3, 120_000_000)?;
let mut index_writer: IndexWriter =
index.writer_with_num_threads(3, 3 * MEMORY_BUDGET_NUM_BYTES_MIN)?;

let mut committed_docs: HashSet<u64> = HashSet::new();
let mut uncommitted_docs: HashSet<u64> = HashSet::new();
Expand Down Expand Up @@ -167,7 +168,8 @@ fn test_functional_indexing_unsorted() -> crate::Result<()> {

let mut rng = thread_rng();

let mut index_writer: IndexWriter = index.writer_with_num_threads(3, 120_000_000)?;
let mut index_writer: IndexWriter =
index.writer_with_num_threads(3, 3 * MEMORY_BUDGET_NUM_BYTES_MIN)?;

let mut committed_docs: HashSet<u64> = HashSet::new();
let mut uncommitted_docs: HashSet<u64> = HashSet::new();
Expand Down
2 changes: 1 addition & 1 deletion src/query/range_query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mod range_query;
mod range_query_ip_fastfield;
mod range_query_u64_fastfield;

pub use self::range_query::{RangeQuery, RangeWeight};
pub use self::range_query::RangeQuery;
pub use self::range_query_ip_fastfield::IPFastFieldRangeWeight;
pub use self::range_query_u64_fastfield::FastFieldRangeWeight;

Expand Down
2 changes: 0 additions & 2 deletions src/query/term_query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ mod term_weight;

pub use self::term_query::TermQuery;
pub use self::term_scorer::TermScorer;
pub use self::term_weight::TermWeight;

#[cfg(test)]
mod tests {

Expand Down
4 changes: 3 additions & 1 deletion src/query/term_query/term_scorer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ impl Scorer for TermScorer {
mod tests {
use proptest::prelude::*;

use crate::indexer::index_writer::MEMORY_BUDGET_NUM_BYTES_MIN;
use crate::merge_policy::NoMergePolicy;
use crate::postings::compression::COMPRESSION_BLOCK_SIZE;
use crate::query::term_query::TermScorer;
Expand Down Expand Up @@ -296,7 +297,8 @@ mod tests {
let text_field = schema_builder.add_text_field("text", TEXT);
let schema = schema_builder.build();
let index = Index::create_in_ram(schema);
let mut writer: IndexWriter = index.writer_with_num_threads(3, 30_000_000)?;
let mut writer: IndexWriter =
index.writer_with_num_threads(3, 3 * MEMORY_BUDGET_NUM_BYTES_MIN)?;
use rand::Rng;
let mut rng = rand::thread_rng();
writer.set_merge_policy(Box::new(NoMergePolicy));
Expand Down

0 comments on commit 4f8925d

Please sign in to comment.