From 52f2fc4c469d06a07fda9fed007009b3e655dddf Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Tue, 19 Nov 2024 15:35:21 +0100 Subject: [PATCH] Fail in case of user error in tests --- crates/milli/src/index.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/milli/src/index.rs b/crates/milli/src/index.rs index dd3a6f299..7653bfa2a 100644 --- a/crates/milli/src/index.rs +++ b/crates/milli/src/index.rs @@ -1757,7 +1757,7 @@ pub(crate) mod tests { indexer.add_documents(&documents).unwrap(); let indexer_alloc = Bump::new(); - let (document_changes, _operation_stats, primary_key) = indexer.into_changes( + let (document_changes, operation_stats, primary_key) = indexer.into_changes( &indexer_alloc, &self.inner, &rtxn, @@ -1765,6 +1765,10 @@ pub(crate) mod tests { &mut new_fields_ids_map, )?; + if let Some(error) = operation_stats.into_iter().find_map(|stat| stat.error) { + return Err(error.into()); + } + pool.install(|| { indexer::index( wtxn, @@ -1841,7 +1845,7 @@ pub(crate) mod tests { indexer.delete_documents(external_document_ids.as_slice()); let indexer_alloc = Bump::new(); - let (document_changes, _operation_stats, primary_key) = indexer.into_changes( + let (document_changes, operation_stats, primary_key) = indexer.into_changes( &indexer_alloc, &self.inner, &rtxn, @@ -1849,6 +1853,10 @@ pub(crate) mod tests { &mut new_fields_ids_map, )?; + if let Some(error) = operation_stats.into_iter().find_map(|stat| stat.error) { + return Err(error.into()); + } + pool.install(|| { indexer::index( wtxn,