fix the auto-generated details

This commit is contained in:
Irevoire 2022-10-19 16:44:42 +02:00 committed by Clément Renault
parent aa13fc448d
commit f3c2be1eb5
No known key found for this signature in database
GPG key ID: 92ADA4E935E71FA4
16 changed files with 176 additions and 27 deletions

View file

@ -1103,6 +1103,53 @@ mod tests {
snapshot!(snapshot_index_scheduler(&index_scheduler));
}
#[test]
fn document_addition_and_index_deletion() {
let (index_scheduler, handle) = IndexScheduler::test(true);
let content = r#"
{
"id": 1,
"doggo": "bob"
}"#;
index_scheduler
.register(KindWithContent::IndexCreation {
index_uid: S("doggos"),
primary_key: None,
})
.unwrap();
let (uuid, mut file) = index_scheduler.create_update_file_with_uuid(0).unwrap();
let documents_count =
meilisearch_types::document_formats::read_json(content.as_bytes(), file.as_file_mut())
.unwrap() as u64;
file.persist().unwrap();
index_scheduler
.register(KindWithContent::DocumentImport {
index_uid: S("doggos"),
primary_key: Some(S("id")),
method: ReplaceDocuments,
content_file: uuid,
documents_count,
allow_index_creation: true,
})
.unwrap();
index_scheduler
.register(KindWithContent::IndexDeletion {
index_uid: S("doggos"),
})
.unwrap();
snapshot!(snapshot_index_scheduler(&index_scheduler));
handle.wait_till(Breakpoint::Start); // The index creation.
handle.wait_till(Breakpoint::Start); // before anything happens.
handle.wait_till(Breakpoint::Start); // after the execution of the two tasks in a single batch.
snapshot!(snapshot_index_scheduler(&index_scheduler));
}
#[test]
fn do_not_batch_task_of_different_indexes() {
let (index_scheduler, handle) = IndexScheduler::test(true);