You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2023/06/23 09:43:49 UTC

[incubator-opendal] branch refactor-tests updated: Fix build

This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch refactor-tests
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git


The following commit(s) were added to refs/heads/refactor-tests by this push:
     new e8ba9599b Fix build
e8ba9599b is described below

commit e8ba9599b7270856236a890fe05887b75f9e62c1
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Fri Jun 23 17:43:38 2023 +0800

    Fix build
    
    Signed-off-by: Xuanwo <gi...@xuanwo.io>
---
 core/tests/behavior/main.rs  | 8 ++++++++
 core/tests/behavior/utils.rs | 7 -------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/core/tests/behavior/main.rs b/core/tests/behavior/main.rs
index 49a83789a..301dffaf3 100644
--- a/core/tests/behavior/main.rs
+++ b/core/tests/behavior/main.rs
@@ -152,5 +152,13 @@ fn main() -> anyhow::Result<()> {
     #[cfg(feature = "services-webhdfs")]
     tests.extend(behavior_test::<services::Webhdfs>());
 
+    // Don't init logging while building operator which may break cargo
+    // nextest output
+    let _ = tracing_subscriber::fmt()
+        .pretty()
+        .with_test_writer()
+        .with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
+        .try_init();
+
     libtest_mimic::run(&args, tests).exit();
 }
diff --git a/core/tests/behavior/utils.rs b/core/tests/behavior/utils.rs
index c8dfbb790..4863eeca3 100644
--- a/core/tests/behavior/utils.rs
+++ b/core/tests/behavior/utils.rs
@@ -28,7 +28,6 @@ use futures::Future;
 use libtest_mimic::Failed;
 use libtest_mimic::Trial;
 use log::debug;
-use log::warn;
 use opendal::layers::LoggingLayer;
 use opendal::layers::RetryLayer;
 use opendal::layers::TimeoutLayer;
@@ -44,11 +43,6 @@ use tokio::runtime::Runtime;
 /// - If `opendal_{schema}_test` is on, construct a new Operator with given root.
 /// - Else, returns a `None` to represent no valid config for operator.
 pub fn init_service<B: Builder>() -> Option<Operator> {
-    let _ = tracing_subscriber::fmt()
-        .pretty()
-        .with_test_writer()
-        .with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
-        .try_init();
     let _ = dotenvy::dotenv();
 
     let prefix = format!("opendal_{}_", B::SCHEME);
@@ -64,7 +58,6 @@ pub fn init_service<B: Builder>() -> Option<Operator> {
     let turn_on_test = cfg.get("test").cloned().unwrap_or_default();
 
     if turn_on_test != "on" && turn_on_test != "true" {
-        warn!("service {} not initiated, ignored", B::SCHEME);
         return None;
     }