Fix for 'First update does not appear before being processed' #542

This commit is contained in:
sgummaluri 2020-04-04 23:18:43 +05:30
parent 5e5702833c
commit e5a336a042
3 changed files with 32 additions and 2 deletions

View file

@ -1,5 +1,6 @@
use assert_json_diff::assert_json_eq;
use serde_json::json;
use serde_json::Value;
mod common;
@ -657,3 +658,31 @@ fn check_add_documents_without_primary_key() {
assert_eq!(status_code, 400);
assert_json_eq!(response, expected, ordered: false);
}
#[test]
fn check_first_update_should_bring_up_enqueued_status_before_processing(){
let mut server = common::Server::with_uid("movies");
let body = json!({
"uid": "movies",
});
// 1. Create Index
let (response, status_code) = server.create_index(body);
assert_eq!(status_code, 201);
assert_eq!(response["primaryKey"], json!(null));
let dataset = include_bytes!("assets/movies.json");
let body: Value = serde_json::from_slice(dataset).unwrap();
// 2. Index the documents from movies.json, present inside of assets directory
server.add_or_replace_multiple_documents(body);
// 3. Fetch the status of the indexing done above.
let (response, status_code) = server.get_all_updates_status();
// 4. Verify the fetch is successful and indexing status is 'processed'
assert_eq!(status_code, 200);
assert_eq!(response[0]["status"], "processed");
}