Skip to content

Commit 7f89b55

Browse files
iduartgomezclaude
andauthored
test: improve logging for test_multiple_clients_subscription (#1987)
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 4ab850e commit 7f89b55

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

crates/core/tests/operations.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use freenet::{
66
server::serve_gateway,
77
test_utils::{
88
self, load_delegate, make_get, make_put, make_subscribe, make_update,
9-
verify_contract_exists, with_peer_id,
9+
verify_contract_exists, with_peer_id, TestLogger,
1010
},
1111
};
1212
use freenet_stdlib::{
@@ -544,6 +544,12 @@ async fn test_update_contract() -> TestResult {
544544
// If this test becomes flaky again, see issue #1798 for historical context.
545545
#[test_log::test(tokio::test(flavor = "multi_thread", worker_threads = 4))]
546546
async fn test_multiple_clients_subscription() -> TestResult {
547+
// Initialize test logger with JSON format for better debugging
548+
let _logger = TestLogger::new()
549+
.with_json()
550+
.with_level("freenet::operations::connect=debug,freenet::node::network_bridge::p2p_protoc=info,info")
551+
.init();
552+
547553
// Load test contract
548554
const TEST_CONTRACT: &str = "test-contract-integration";
549555
let contract = test_utils::load_contract(TEST_CONTRACT, vec![].into())?;
@@ -606,33 +612,42 @@ async fn test_multiple_clients_subscription() -> TestResult {
606612

607613
// Start node A (first client)
608614
let node_a = async move {
615+
let _span = with_peer_id("node-a");
616+
tracing::info!("Starting node A");
609617
let config = config_a.build().await?;
610618
let node = NodeConfig::new(config.clone())
611619
.await?
612620
.build(serve_gateway(config.ws_api).await)
613621
.await?;
622+
tracing::info!("Node A running");
614623
node.run().await
615624
}
616625
.boxed_local();
617626

618627
// Start GW node
619628
let node_gw = async {
629+
let _span = with_peer_id("gateway");
630+
tracing::info!("Starting gateway node");
620631
let config = config_gw.build().await?;
621632
let node = NodeConfig::new(config.clone())
622633
.await?
623634
.build(serve_gateway(config.ws_api).await)
624635
.await?;
636+
tracing::info!("Gateway node running");
625637
node.run().await
626638
}
627639
.boxed_local();
628640

629641
// Start node B (second client)
630642
let node_b = async {
643+
let _span = with_peer_id("node-b");
644+
tracing::info!("Starting node B");
631645
let config = config_b.build().await?;
632646
let node = NodeConfig::new(config.clone())
633647
.await?
634648
.build(serve_gateway(config.ws_api).await)
635649
.await?;
650+
tracing::info!("Node B running");
636651
node.run().await
637652
}
638653
.boxed_local();

0 commit comments

Comments
 (0)