فهرست منبع

Remove test logger from durio.

Jing Yang 3 سال پیش
والد
کامیت
8bc2df1990
3فایلهای تغییر یافته به همراه9 افزوده شده و 13 حذف شده
  1. 1 2
      durio/Cargo.toml
  2. 1 1
      durio/run_smoke_test.sh
  3. 7 10
      durio/src/main.rs

+ 1 - 2
durio/Cargo.toml

@@ -17,6 +17,7 @@ async-trait = "0.1"
 axum = "0.5.7"
 bytes = "1.1"
 crossbeam-channel = "0.5.4"
+env_logger = "0.9.0"
 futures-util = "0.3.21"
 kvraft = { path = "../kvraft" }
 lazy_static = "1.4.0"
@@ -27,10 +28,8 @@ serde = "1.0"
 serde_derive = "1.0"
 serde_json = "1.0"
 tarpc = { version = ">=0.27", features = ["serde-transport", "tcp"] }
-test_utils = { path = "../test_utils", default-features = false }
 tokio = { version = "1.7", features = ["macros", "rt-multi-thread", "time", "parking_lot"] }
 tokio-serde = { version = "0.8", features = ["json"] }
 
 [dev-dependencies]
 reqwest = { version = "0.11", features = ["json"] }
-env_logger = "0.9.0"

+ 1 - 1
durio/run_smoke_test.sh

@@ -1,2 +1,2 @@
 #!/bin/bash
-RUST_LOG=ruaft=debug,kvraft=debug cargo test -- --nocapture
+RUST_LOG=ruaft=debug,kvraft=debug cargo test -p durio -- --include-ignored --nocapture

+ 7 - 10
durio/src/main.rs

@@ -120,20 +120,15 @@ fn main() {
         .unwrap_or_default()
         .parse()
         .expect("An index of the current instance must be passed in");
-    test_utils::init_log(format!("durio-instance-{}", me).as_str())
-        .expect("Initiating log should not fail");
+    env_logger::init();
 
     // Run RPC servers in a thread pool. This pool
     // 1. Accepts incoming RPC connections for KV and Raft servers.
     // 2. Sends out RPCs to other Raft instances.
     // Timers are used by RPC handling code in the KV server.
-    let local_logger = test_utils::thread_local_logger::get();
     let rpc_server_thread_pool = tokio::runtime::Builder::new_multi_thread()
         .enable_all()
         .thread_name("durio-rpc")
-        .on_thread_start(move || {
-            test_utils::thread_local_logger::set(local_logger.clone())
-        })
         .build()
         .expect("Creating thread pool should not fail");
 
@@ -144,13 +139,9 @@ fn main() {
     // Run web servers in a thread pool. This pool
     // 1. Accepts incoming HTTP connections.
     // 2. Sends out RPCs to KV instances, both local and remote.
-    let local_logger = test_utils::thread_local_logger::get();
     let thread_pool = tokio::runtime::Builder::new_multi_thread()
         .enable_all()
         .thread_name("durio-web")
-        .on_thread_start(move || {
-            test_utils::thread_local_logger::set(local_logger.clone())
-        })
         .build()
         .expect("Creating thread pool should not fail");
 
@@ -166,6 +157,12 @@ mod tests {
     use super::*;
     use std::time::Duration;
 
+    // This test is ignored by default, because it cannot be run with other
+    // Ruaft tests at the same time. All other ruaft tests are compiled with
+    // feature 'integration-test', which is in conflict with this test. This
+    // test intends to verify that durio can be run under normal production
+    // setup, i.e. without 'integration-test'.
+    #[ignore]
     #[tokio::test]
     async fn smoke_test() {
         let kv_addrs: Vec<SocketAddr> = vec![