From a8cf4aba7724016f05ad5ad76e312c8dcc070cc3 Mon Sep 17 00:00:00 2001 From: Paul Masurel Date: Wed, 14 Dec 2022 14:10:51 +0900 Subject: [PATCH] Updating to tokio 1.23 and updating unit tests. Closes #2571 --- quickwit/Cargo.lock | 6 +++--- quickwit/Cargo.toml | 2 +- quickwit/quickwit-actors/src/mailbox.rs | 4 ++++ quickwit/quickwit-actors/src/tests.rs | 4 ++++ .../src/actors/delete_task_planner.rs | 11 ++++++----- quickwit/quickwit-storage/Cargo.toml | 2 +- 6 files changed, 19 insertions(+), 10 deletions(-) diff --git a/quickwit/Cargo.lock b/quickwit/Cargo.lock index b47d1887a8..01176f85a8 100644 --- a/quickwit/Cargo.lock +++ b/quickwit/Cargo.lock @@ -5376,9 +5376,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.22.0" +version = "1.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76ce4a75fb488c605c54bf610f221cea8b0dafb53333c1a67e8ee199dcd2ae3" +checksum = "eab6d665857cc6ca78d6e80303a02cea7a7851e85dfbd77cbdc09bd129f1ef46" dependencies = [ "autocfg", "bytes", @@ -5392,7 +5392,7 @@ dependencies = [ "socket2", "tokio-macros", "tracing", - "winapi 0.3.9", + "windows-sys 0.42.0", ] [[package]] diff --git a/quickwit/Cargo.toml b/quickwit/Cargo.toml index 58cf8cb27a..1410186254 100644 --- a/quickwit/Cargo.toml +++ b/quickwit/Cargo.toml @@ -155,7 +155,7 @@ thousands = "0.2.0" tikv-jemalloc-ctl = "0.5" tikv-jemallocator = "0.5" time = { version = "0.3.17", features = ["std", "formatting", "macros"] } -tokio = { version = "^1.22", features = ["full", "test-util"] } +tokio = { version = "1.23", features = ["full"] } tokio-stream = { version = "0.1", features = ["sync"] } tokio-util = { version = "0.7", features = ["full"] } toml = "0.5.9" diff --git a/quickwit/quickwit-actors/src/mailbox.rs b/quickwit/quickwit-actors/src/mailbox.rs index c7b730821e..b6df4c7542 100644 --- a/quickwit/quickwit-actors/src/mailbox.rs +++ b/quickwit/quickwit-actors/src/mailbox.rs @@ -421,6 +421,10 @@ mod tests { fn queue_capacity(&self) -> QueueCapacity { QueueCapacity::Bounded(0) } + + fn yield_after_each_message(&self) -> bool { + false + } } use async_trait::async_trait; diff --git a/quickwit/quickwit-actors/src/tests.rs b/quickwit/quickwit-actors/src/tests.rs index 5ece6c5183..02529fae7a 100644 --- a/quickwit/quickwit-actors/src/tests.rs +++ b/quickwit/quickwit-actors/src/tests.rs @@ -513,6 +513,10 @@ struct Adder(u64); impl Actor for Adder { type ObservableState = u64; + fn yield_after_each_message(&self) -> bool { + false + } + fn observable_state(&self) -> Self::ObservableState { self.0 } diff --git a/quickwit/quickwit-janitor/src/actors/delete_task_planner.rs b/quickwit/quickwit-janitor/src/actors/delete_task_planner.rs index 27f418c604..69af73b8e5 100644 --- a/quickwit/quickwit-janitor/src/actors/delete_task_planner.rs +++ b/quickwit/quickwit-janitor/src/actors/delete_task_planner.rs @@ -423,11 +423,12 @@ mod tests { fast: true "#; let test_sandbox = TestSandbox::create(index_id, doc_mapping_yaml, "{}", &["body"]).await?; - let docs = vec![ + let docs = [ serde_json::json!({"body": "info", "ts": 0 }), serde_json::json!({"body": "info", "ts": 0 }), serde_json::json!({"body": "delete", "ts": 0 }), ]; + // Creates 3 splits for doc in docs { test_sandbox.add_documents(vec![doc]).await?; } @@ -506,8 +507,8 @@ mod tests { let (delete_planner_mailbox, delete_planner_handle) = universe.spawn_builder().spawn(delete_planner_executor); delete_planner_handle.process_pending_and_observe().await; - let downloader_msgs = - downloader_inbox.drain_for_test_typed::>(); + let downloader_msgs: Vec> = + downloader_inbox.drain_for_test_typed(); assert_eq!(downloader_msgs.len(), 1); // The last split will undergo a delete operation. assert_eq!( @@ -522,7 +523,7 @@ mod tests { ); // Trigger new plan evaluation and check that we don't have new merge operation. delete_planner_mailbox - .send_message(PlanDeleteOperations) + .ask(PlanDeleteOperations) .await .unwrap(); assert!(downloader_inbox.drain_for_test().is_empty()); @@ -538,7 +539,7 @@ mod tests { // Trigger operations planning. delete_planner_mailbox - .send_message(PlanDeleteOperations) + .ask(PlanDeleteOperations) .await .unwrap(); let downloader_last_msgs = diff --git a/quickwit/quickwit-storage/Cargo.toml b/quickwit/quickwit-storage/Cargo.toml index 9f16220dc5..079f7d1024 100644 --- a/quickwit/quickwit-storage/Cargo.toml +++ b/quickwit/quickwit-storage/Cargo.toml @@ -32,7 +32,7 @@ serde_json = { workspace = true } tantivy = { workspace = true } tempfile = { workspace = true } thiserror = { workspace = true } -tokio = { workspace = true } +tokio = { workspace = true, features = ["test-util"] } tokio-stream = { workspace = true } tokio-util = { workspace = true } tracing = { workspace = true }