diff --git a/.gitignore b/.gitignore index 07453a58f..fc24b8306 100644 --- a/.gitignore +++ b/.gitignore @@ -18,5 +18,8 @@ ## ... unreviewed *.snap.new +# Database snapshot +crates/meilisearch/db.snapshot + # Fuzzcheck data for the facet indexing fuzz test crates/milli/fuzz/update::facet::incremental::fuzz::fuzz/ diff --git a/crates/index-scheduler/src/insta_snapshot.rs b/crates/index-scheduler/src/insta_snapshot.rs index d4504c246..a5bb1ea56 100644 --- a/crates/index-scheduler/src/insta_snapshot.rs +++ b/crates/index-scheduler/src/insta_snapshot.rs @@ -367,10 +367,12 @@ pub fn snapshot_batch(batch: &Batch) -> String { snap.push_str(&format!("uid: {uid}, ")); snap.push_str(&format!("details: {}, ", serde_json::to_string(details).unwrap())); snap.push_str(&format!("stats: {}, ", serde_json::to_string(&stats).unwrap())); - snap.push_str(&format!( - "embedder_stats: {}, ", - serde_json::to_string(&embedder_stats).unwrap() - )); + if !embedder_stats.skip_serializing() { + snap.push_str(&format!( + "embedder stats: {}, ", + serde_json::to_string(&embedder_stats).unwrap() + )); + } snap.push_str(&format!("stop reason: {}, ", serde_json::to_string(&stop_reason).unwrap())); snap.push('}'); snap diff --git a/crates/meilisearch/tests/vector/rest.rs b/crates/meilisearch/tests/vector/rest.rs index 363931a86..2c8d3ed7c 100644 --- a/crates/meilisearch/tests/vector/rest.rs +++ b/crates/meilisearch/tests/vector/rest.rs @@ -2195,5 +2195,35 @@ async fn last_error_stats() { receiver.recv().await; let (response, _code) = index.filtered_batches(&[], &[], &[]).await; - snapshot!(response["results"][0], @r###""###); + snapshot!(json_string!(response["results"][0], { ".progress" => "[ignored]", ".stats.embedder.totalCount" => "[ignored]", ".startedAt" => "[ignored]" }), @r#" + { + "uid": 1, + "progress": "[ignored]", + "details": { + "receivedDocuments": 3, + "indexedDocuments": null + }, + "stats": { + "totalNbTasks": 1, + "status": { + "processing": 1 + }, + "types": { + "documentAdditionOrUpdate": 1 + }, + "indexUids": { + "doggo": 1 + }, + "embedder": { + "totalCount": "[ignored]", + "errorCount": 5, + "lastError": "runtime error: received internal error HTTP 500 from embedding server\n - server replied with `{\"error\":\"Service Unavailable\",\"text\":\"will_error\"}`" + } + }, + "duration": null, + "startedAt": "[ignored]", + "finishedAt": null, + "batchStrategy": "batched all enqueued tasks" + } + "#); }