From e961623143b20082c90a563aa425aef28dba70da Mon Sep 17 00:00:00 2001 From: Marcelo Fornet Date: Mon, 19 Aug 2019 16:08:24 -0400 Subject: [PATCH] Network tests as heavy --- Cargo.lock | 1 + chain/network/Cargo.toml | 1 + chain/network/tests/announce_account.rs | 77 +++++++++++++++---------- 3 files changed, 48 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d68b2ab032d..51ca597b12d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2181,6 +2181,7 @@ dependencies = [ "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "testlib 0.1.0", "tokio 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/chain/network/Cargo.toml b/chain/network/Cargo.toml index aee8596ee4f..38f2eda4cbc 100644 --- a/chain/network/Cargo.toml +++ b/chain/network/Cargo.toml @@ -26,3 +26,4 @@ tempdir = "0.3.7" near-client = { path = "../client" } near-telemetry = { path = "../telemetry" } +testlib = { path = "../../test-utils/testlib" } diff --git a/chain/network/tests/announce_account.rs b/chain/network/tests/announce_account.rs index 2839d99e2ec..247cb0b1dba 100644 --- a/chain/network/tests/announce_account.rs +++ b/chain/network/tests/announce_account.rs @@ -12,6 +12,7 @@ use near_store::test_utils::create_test_store; use near_telemetry::{TelemetryActor, TelemetryConfig}; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; +use testlib::test_helpers::heavy_test; /// Sets up a node with a valid Client, Peer pub fn setup_network_node( @@ -135,62 +136,76 @@ fn check_account_id_propagation( #[test] fn two_nodes() { - check_account_id_propagation(vec!["test1", "test2"], vec![vec![1], vec![0]], 5000); + heavy_test(|| { + check_account_id_propagation(vec!["test1", "test2"], vec![vec![1], vec![0]], 5000); + }); } #[test] fn three_nodes_clique() { - check_account_id_propagation( - vec!["test1", "test2", "test3"], - vec![vec![1, 2], vec![0, 2], vec![0, 1]], - 5000, - ); + heavy_test(|| { + check_account_id_propagation( + vec!["test1", "test2", "test3"], + vec![vec![1, 2], vec![0, 2], vec![0, 1]], + 5000, + ); + }); } #[test] fn three_nodes_path() { - check_account_id_propagation( - vec!["test1", "test2", "test3"], - vec![vec![1], vec![0, 2], vec![1]], - 5000, - ); + heavy_test(|| { + check_account_id_propagation( + vec!["test1", "test2", "test3"], + vec![vec![1], vec![0, 2], vec![1]], + 5000, + ); + }); } #[test] fn four_nodes_star() { - check_account_id_propagation( - vec!["test1", "test2", "test3", "test4"], - vec![vec![1, 2, 3], vec![0], vec![0], vec![0]], - 5000, - ); + heavy_test(|| { + check_account_id_propagation( + vec!["test1", "test2", "test3", "test4"], + vec![vec![1, 2, 3], vec![0], vec![0], vec![0]], + 5000, + ); + }); } #[test] #[ignore] fn four_nodes_path() { - check_account_id_propagation( - vec!["test1", "test2", "test3", "test4"], - vec![vec![1], vec![0, 2], vec![1, 3], vec![2]], - 5000, - ); + heavy_test(|| { + check_account_id_propagation( + vec!["test1", "test2", "test3", "test4"], + vec![vec![1], vec![0, 2], vec![1, 3], vec![2]], + 5000, + ); + }); } #[test] #[should_panic] fn four_nodes_disconnected() { - check_account_id_propagation( - vec!["test1", "test2", "test3", "test4"], - vec![vec![1], vec![0], vec![3], vec![2]], - 5000, - ); + heavy_test(|| { + check_account_id_propagation( + vec!["test1", "test2", "test3", "test4"], + vec![vec![1], vec![0], vec![3], vec![2]], + 5000, + ); + }); } #[test] #[ignore] fn four_nodes_directed() { - check_account_id_propagation( - vec!["test1", "test2", "test3", "test4"], - vec![vec![1], vec![], vec![1], vec![2]], - 5000, - ); + heavy_test(|| { + check_account_id_propagation( + vec!["test1", "test2", "test3", "test4"], + vec![vec![1], vec![], vec![1], vec![2]], + 5000, + ); + }); }