Skip to content

Improve log readability during rpc_tests #7180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: unstable
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 37 additions & 19 deletions beacon_node/lighthouse_network/tests/rpc_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use std::sync::Arc;
use std::time::Duration;
use tokio::runtime::Runtime;
use tokio::time::sleep;
use tracing::{debug, warn};
use tracing::{debug, info_span, warn, Instrument};
use types::{
BeaconBlock, BeaconBlockAltair, BeaconBlockBase, BeaconBlockBellatrix, BlobSidecar, ChainSpec,
EmptyBlock, Epoch, EthSpec, FixedBytesExtended, ForkContext, ForkName, Hash256, MinimalEthSpec,
Expand Down Expand Up @@ -110,7 +110,8 @@ fn test_tcp_status_rpc() {
_ => {}
}
}
};
}
.instrument(info_span!("Sender"));

// build the receiver future
let receiver_future = async {
Expand All @@ -130,7 +131,8 @@ fn test_tcp_status_rpc() {
_ => {} // Ignore other events
}
}
};
}
.instrument(info_span!("Receiver"));

tokio::select! {
_ = sender_future => {}
Expand Down Expand Up @@ -232,7 +234,8 @@ fn test_tcp_blocks_by_range_chunked_rpc() {
_ => {} // Ignore other behaviour events
}
}
};
}
.instrument(info_span!("Sender"));

// build the receiver future
let receiver_future = async {
Expand Down Expand Up @@ -275,7 +278,8 @@ fn test_tcp_blocks_by_range_chunked_rpc() {
_ => {} // Ignore other events
}
}
};
}
.instrument(info_span!("Receiver"));

tokio::select! {
_ = sender_future => {}
Expand Down Expand Up @@ -360,7 +364,8 @@ fn test_blobs_by_range_chunked_rpc() {
_ => {} // Ignore other behaviour events
}
}
};
}
.instrument(info_span!("Sender"));

// build the receiver future
let receiver_future = async {
Expand Down Expand Up @@ -396,7 +401,8 @@ fn test_blobs_by_range_chunked_rpc() {
_ => {} // Ignore other events
}
}
};
}
.instrument(info_span!("Receiver"));

tokio::select! {
_ = sender_future => {}
Expand Down Expand Up @@ -466,7 +472,8 @@ fn test_tcp_blocks_by_range_over_limit() {
_ => {} // Ignore other behaviour events
}
}
};
}
.instrument(info_span!("Sender"));

// build the receiver future
let receiver_future = async {
Expand Down Expand Up @@ -501,7 +508,8 @@ fn test_tcp_blocks_by_range_over_limit() {
_ => {} // Ignore other events
}
}
};
}
.instrument(info_span!("Receiver"));

tokio::select! {
_ = sender_future => {}
Expand Down Expand Up @@ -588,7 +596,8 @@ fn test_tcp_blocks_by_range_chunked_rpc_terminates_correctly() {
_ => {} // Ignore other behaviour events
}
}
};
}
.instrument(info_span!("Sender"));

// determine messages to send (PeerId, RequestId). If some, indicates we still need to send
// messages
Expand Down Expand Up @@ -635,7 +644,8 @@ fn test_tcp_blocks_by_range_chunked_rpc_terminates_correctly() {
}
}
}
};
}
.instrument(info_span!("Receiver"));

tokio::select! {
_ = sender_future => {}
Expand Down Expand Up @@ -719,7 +729,8 @@ fn test_tcp_blocks_by_range_single_empty_rpc() {
_ => {} // Ignore other behaviour events
}
}
};
}
.instrument(info_span!("Sender"));

// build the receiver future
let receiver_future = async {
Expand Down Expand Up @@ -754,7 +765,8 @@ fn test_tcp_blocks_by_range_single_empty_rpc() {
_ => {} // Ignore other events
}
}
};
}
.instrument(info_span!("Receiver"));
tokio::select! {
_ = sender_future => {}
_ = receiver_future => {}
Expand Down Expand Up @@ -862,7 +874,8 @@ fn test_tcp_blocks_by_root_chunked_rpc() {
_ => {} // Ignore other behaviour events
}
}
};
}
.instrument(info_span!("Sender"));

// build the receiver future
let receiver_future = async {
Expand Down Expand Up @@ -902,7 +915,8 @@ fn test_tcp_blocks_by_root_chunked_rpc() {
_ => {} // Ignore other events
}
}
};
}
.instrument(info_span!("Receiver"));
tokio::select! {
_ = sender_future => {}
_ = receiver_future => {}
Expand Down Expand Up @@ -999,7 +1013,8 @@ fn test_tcp_blocks_by_root_chunked_rpc_terminates_correctly() {
_ => {} // Ignore other behaviour events
}
}
};
}
.instrument(info_span!("Sender"));

// determine messages to send (PeerId, RequestId). If some, indicates we still need to send
// messages
Expand Down Expand Up @@ -1046,7 +1061,8 @@ fn test_tcp_blocks_by_root_chunked_rpc_terminates_correctly() {
}
}
}
};
}
.instrument(info_span!("Receiver"));

tokio::select! {
_ = sender_future => {}
Expand Down Expand Up @@ -1092,7 +1108,8 @@ fn goodbye_test(log_level: &str, enable_logging: bool, protocol: Protocol) {
_ => {} // Ignore other RPC messages
}
}
};
}
.instrument(info_span!("Sender"));

// build the receiver future
let receiver_future = async {
Expand All @@ -1102,7 +1119,8 @@ fn goodbye_test(log_level: &str, enable_logging: bool, protocol: Protocol) {
return;
}
}
};
}
.instrument(info_span!("Receiver"));

let total_future = futures::future::join(sender_future, receiver_future);

Expand Down
Loading