From a14b6269279cde391e92414e9615a8ead27f9cfc Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 22 Jun 2022 14:41:40 -0700 Subject: [PATCH] Enable env log in peer tests --- Cargo.lock | 2 ++ crates/rpc/Cargo.toml | 2 ++ crates/rpc/src/peer.rs | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index b96bcce581..0d2c47efc8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3826,6 +3826,8 @@ dependencies = [ "base64 0.13.0", "clock", "collections", + "ctor", + "env_logger", "futures", "gpui", "parking_lot 0.11.2", diff --git a/crates/rpc/Cargo.toml b/crates/rpc/Cargo.toml index a6b146e1cc..7baba26702 100644 --- a/crates/rpc/Cargo.toml +++ b/crates/rpc/Cargo.toml @@ -38,3 +38,5 @@ collections = { path = "../collections", features = ["test-support"] } gpui = { path = "../gpui", features = ["test-support"] } smol = "1.2.5" tempdir = "0.3.7" +ctor = "0.1" +env_logger = "0.9" diff --git a/crates/rpc/src/peer.rs b/crates/rpc/src/peer.rs index 2361812409..57656c7b5c 100644 --- a/crates/rpc/src/peer.rs +++ b/crates/rpc/src/peer.rs @@ -499,6 +499,13 @@ mod tests { use async_tungstenite::tungstenite::Message as WebSocketMessage; use gpui::TestAppContext; + #[ctor::ctor] + fn init_logger() { + if std::env::var("RUST_LOG").is_ok() { + env_logger::init(); + } + } + #[gpui::test(iterations = 50)] async fn test_request_response(cx: &mut TestAppContext) { let executor = cx.foreground();