From bdb17954d25e4e4e1018a37ef7ebc1c97a21e40f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lecrenier?= Date: Wed, 19 Oct 2022 17:29:51 +0200 Subject: [PATCH] Fix bug where assert used != instead of == And update snapshot tests. --- .../document_addition_and_index_deletion/1.snap | 9 +++++++++ .../document_addition_and_index_deletion/2.snap | 13 +++++++++++++ .../initial_tasks_processed.snap | 2 +- .../initial_tasks_processed.snap | 2 +- index-scheduler/src/utils.rs | 4 ++-- 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/index-scheduler/src/snapshots/lib.rs/document_addition_and_index_deletion/1.snap b/index-scheduler/src/snapshots/lib.rs/document_addition_and_index_deletion/1.snap index 8d8d5c3ea..6f42a289e 100644 --- a/index-scheduler/src/snapshots/lib.rs/document_addition_and_index_deletion/1.snap +++ b/index-scheduler/src/snapshots/lib.rs/document_addition_and_index_deletion/1.snap @@ -24,6 +24,15 @@ doggos [0,1,2,] ### Index Mapper: [] ---------------------------------------------------------------------- +### Enqueued At: +[timestamp] [0,] +[timestamp] [1,] +[timestamp] [2,] +---------------------------------------------------------------------- +### Started At: +---------------------------------------------------------------------- +### Finished At: +---------------------------------------------------------------------- ### File Store: 00000000-0000-0000-0000-000000000000 diff --git a/index-scheduler/src/snapshots/lib.rs/document_addition_and_index_deletion/2.snap b/index-scheduler/src/snapshots/lib.rs/document_addition_and_index_deletion/2.snap index 170d174b7..35f81814b 100644 --- a/index-scheduler/src/snapshots/lib.rs/document_addition_and_index_deletion/2.snap +++ b/index-scheduler/src/snapshots/lib.rs/document_addition_and_index_deletion/2.snap @@ -25,6 +25,19 @@ doggos [0,1,2,] ### Index Mapper: [] ---------------------------------------------------------------------- +### Enqueued At: +[timestamp] [0,] +[timestamp] [1,] +[timestamp] [2,] +---------------------------------------------------------------------- +### Started At: +[timestamp] [0,] +[timestamp] [2,] +---------------------------------------------------------------------- +### Finished At: +[timestamp] [0,] +[timestamp] [2,] +---------------------------------------------------------------------- ### File Store: ---------------------------------------------------------------------- diff --git a/index-scheduler/src/snapshots/lib.rs/task_deletion_delete_same_task_twice/initial_tasks_processed.snap b/index-scheduler/src/snapshots/lib.rs/task_deletion_delete_same_task_twice/initial_tasks_processed.snap index 84699ab64..585dc6104 100644 --- a/index-scheduler/src/snapshots/lib.rs/task_deletion_delete_same_task_twice/initial_tasks_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/task_deletion_delete_same_task_twice/initial_tasks_processed.snap @@ -7,7 +7,7 @@ source: index-scheduler/src/lib.rs ---------------------------------------------------------------------- ### All Tasks: 0 {uid: 0, status: succeeded, details: { received_documents: 1, indexed_documents: Some(1) }, kind: DocumentImport { index_uid: "catto", primary_key: None, method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000000, documents_count: 1, allow_index_creation: true }} -1 {uid: 1, status: enqueued, details: { received_documents: 1, indexed_documents: Some(0) }, kind: DocumentImport { index_uid: "doggo", primary_key: Some("bone"), method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000001, documents_count: 1, allow_index_creation: true }} +1 {uid: 1, status: enqueued, details: { received_documents: 1, indexed_documents: None }, kind: DocumentImport { index_uid: "doggo", primary_key: Some("bone"), method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000001, documents_count: 1, allow_index_creation: true }} ---------------------------------------------------------------------- ### Status: enqueued [1,] diff --git a/index-scheduler/src/snapshots/lib.rs/task_deletion_deleteable/initial_tasks_processed.snap b/index-scheduler/src/snapshots/lib.rs/task_deletion_deleteable/initial_tasks_processed.snap index 84699ab64..585dc6104 100644 --- a/index-scheduler/src/snapshots/lib.rs/task_deletion_deleteable/initial_tasks_processed.snap +++ b/index-scheduler/src/snapshots/lib.rs/task_deletion_deleteable/initial_tasks_processed.snap @@ -7,7 +7,7 @@ source: index-scheduler/src/lib.rs ---------------------------------------------------------------------- ### All Tasks: 0 {uid: 0, status: succeeded, details: { received_documents: 1, indexed_documents: Some(1) }, kind: DocumentImport { index_uid: "catto", primary_key: None, method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000000, documents_count: 1, allow_index_creation: true }} -1 {uid: 1, status: enqueued, details: { received_documents: 1, indexed_documents: Some(0) }, kind: DocumentImport { index_uid: "doggo", primary_key: Some("bone"), method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000001, documents_count: 1, allow_index_creation: true }} +1 {uid: 1, status: enqueued, details: { received_documents: 1, indexed_documents: None }, kind: DocumentImport { index_uid: "doggo", primary_key: Some("bone"), method: ReplaceDocuments, content_file: 00000000-0000-0000-0000-000000000001, documents_count: 1, allow_index_creation: true }} ---------------------------------------------------------------------- ### Status: enqueued [1,] diff --git a/index-scheduler/src/utils.rs b/index-scheduler/src/utils.rs index 2f980385c..f82976b3d 100644 --- a/index-scheduler/src/utils.rs +++ b/index-scheduler/src/utils.rs @@ -80,8 +80,8 @@ impl IndexScheduler { })?; } - assert!( - old_task.enqueued_at != task.enqueued_at, + assert_eq!( + old_task.enqueued_at, task.enqueued_at, "Cannot update a task's enqueued_at time" ); if old_task.started_at != task.started_at {