Unverified Commit 14b0937c authored by Niklas Adolfsson's avatar Niklas Adolfsson
Browse files

no more env_logger

parent cb327993
......@@ -8,7 +8,6 @@ publish = false
[dev-dependencies]
anyhow = "1"
env_logger = "0.9"
futures = "0.3"
jsonrpsee = { path = "../jsonrpsee", features = ["full"] }
tracing = "0.1"
......
......@@ -21,7 +21,6 @@ serde = "1"
tokio = { version = "1.16", features = ["rt-multi-thread", "macros"] }
[dev-dependencies]
env_logger = "0.9.0"
tracing-subscriber = { version = "0.3.3", features = ["env-filter"] }
jsonrpsee-test-utils = { path = "../test-utils" }
jsonrpsee = { path = "../jsonrpsee", features = ["full"] }
......
......@@ -37,6 +37,12 @@ use jsonrpsee_test_utils::mocks::{Id, StatusCode, TestContext};
use jsonrpsee_test_utils::TimeoutFutureExt;
use serde_json::Value as JsonValue;
fn init_logger() {
let _ = tracing_subscriber::FmtSubscriber::builder()
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
.try_init();
}
async fn server() -> (SocketAddr, ServerHandle) {
let server = HttpServerBuilder::default().build("127.0.0.1:0").await.unwrap();
let ctx = TestContext;
......@@ -85,7 +91,7 @@ async fn server() -> (SocketAddr, ServerHandle) {
#[tokio::test]
async fn single_method_call_works() {
let _ = env_logger::try_init();
init_logger();
let (addr, _handle) = server().with_default_timeout().await.unwrap();
let uri = to_http_uri(addr);
......@@ -99,7 +105,7 @@ async fn single_method_call_works() {
#[tokio::test]
async fn async_method_call_works() {
let _ = env_logger::try_init();
init_logger();
let (addr, _handle) = server().with_default_timeout().await.unwrap();
let uri = to_http_uri(addr);
......@@ -113,7 +119,7 @@ async fn async_method_call_works() {
#[tokio::test]
async fn invalid_single_method_call() {
let _ = env_logger::try_init();
init_logger();
let (addr, _handle) = server().with_default_timeout().await.unwrap();
let uri = to_http_uri(addr);
......@@ -192,7 +198,7 @@ async fn async_method_call_with_ok_context() {
#[tokio::test]
async fn valid_batched_method_calls() {
let _ = env_logger::try_init();
init_logger();
let (addr, _handle) = server().with_default_timeout().await.unwrap();
let uri = to_http_uri(addr);
......@@ -213,7 +219,7 @@ async fn valid_batched_method_calls() {
#[tokio::test]
async fn batched_notifications() {
let _ = env_logger::try_init();
init_logger();
let (addr, _handle) = server().with_default_timeout().await.unwrap();
let uri = to_http_uri(addr);
......@@ -227,7 +233,7 @@ async fn batched_notifications() {
#[tokio::test]
async fn invalid_batched_method_calls() {
let _ = env_logger::try_init();
init_logger();
let (addr, _handle) = server().with_default_timeout().await.unwrap();
let uri = to_http_uri(addr);
......@@ -390,7 +396,7 @@ async fn can_register_modules() {
#[tokio::test]
async fn stop_works() {
let _ = env_logger::try_init();
init_logger();
let (_addr, server_handle) = server().with_default_timeout().await.unwrap();
assert!(matches!(server_handle.stop().unwrap().await, Ok(_)));
}
......@@ -399,7 +405,7 @@ async fn stop_works() {
async fn run_forever() {
const TIMEOUT: Duration = Duration::from_millis(200);
let _ = env_logger::try_init();
init_logger();
let (_addr, server_handle) = server().with_default_timeout().await.unwrap();
assert!(matches!(server_handle.with_timeout(TIMEOUT).await, Err(_timeout_err)));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment