test: allow testing without --all-features (#1882)

This commit is contained in:
Bjerg
2023-03-21 15:19:37 +01:00
committed by GitHub
parent d20a90639c
commit f60b380a1e
10 changed files with 68 additions and 32 deletions

View File

@ -98,3 +98,4 @@ serial_test = "0.10"
default = ["serde"]
serde = ["dep:serde", "dep:humantime-serde", "secp256k1/serde", "enr?/serde", "dep:serde_json"]
test-utils = ["reth-provider/test-utils", "dep:enr", "dep:ethers-core", "dep:tempfile"]
geth-tests = []

View File

@ -52,7 +52,6 @@
//! The [`NetworkConfig`] is used to configure the network.
//! It requires an instance of [`BlockProvider`](reth_provider::BlockProvider).
//!
//!
//! ```
//! # async fn launch() {
//! use reth_network::config::rng_secret_key;
@ -110,7 +109,9 @@
//!
//! # Features
//!
//! - `serde`: Enable serde support for configuration types.
//! - `serde`: Enable serde support for configuration types (enabled by default).
//! - `test-utils`: Various utilities helpful for writing tests
//! - `geth-tests`: Runs tests that require Geth to be installed locally.
#[cfg(any(test, feature = "test-utils"))]
/// Common helpers for network testing.

View File

@ -676,6 +676,7 @@ mod tests {
use secp256k1::SecretKey;
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "geth-tests"), ignore)]
async fn test_ignored_tx_broadcasts_while_syncing() {
reth_tracing::init_test_tracing();

View File

@ -309,6 +309,7 @@ async fn test_connect_to_trusted_peer() {
}
#[tokio::test(flavor = "multi_thread")]
#[cfg_attr(not(feature = "geth-tests"), ignore)]
async fn test_incoming_node_id_blacklist() {
reth_tracing::init_test_tracing();
tokio::time::timeout(GETH_TIMEOUT, async move {
@ -361,6 +362,7 @@ async fn test_incoming_node_id_blacklist() {
#[tokio::test(flavor = "multi_thread")]
#[serial_test::serial]
#[cfg_attr(not(feature = "geth-tests"), ignore)]
async fn test_incoming_connect_with_single_geth() {
reth_tracing::init_test_tracing();
tokio::time::timeout(GETH_TIMEOUT, async move {
@ -404,6 +406,7 @@ async fn test_incoming_connect_with_single_geth() {
#[tokio::test(flavor = "multi_thread")]
#[serial_test::serial]
#[cfg_attr(not(feature = "geth-tests"), ignore)]
async fn test_outgoing_connect_with_single_geth() {
reth_tracing::init_test_tracing();
tokio::time::timeout(GETH_TIMEOUT, async move {
@ -449,6 +452,7 @@ async fn test_outgoing_connect_with_single_geth() {
#[tokio::test(flavor = "multi_thread")]
#[serial_test::serial]
#[cfg_attr(not(feature = "geth-tests"), ignore)]
async fn test_geth_disconnect() {
reth_tracing::init_test_tracing();
tokio::time::timeout(GETH_TIMEOUT, async move {