fix(zebrad/test): stop excessive logging which causes test hangs (#3755)
* fix(zebrad/test): stop excessive logging which causes test hangs If we print a line every time the network upgrade heights are accessed, some tests hang. This could happen because they are expecting different log output, or because the standard output pipes fill up, blocking the `zebrad` subprocess. * doc(test/nu): explain cargo feature unification and test env vars
This commit is contained in:
parent
3342589677
commit
d718f1d922
|
@ -187,20 +187,23 @@ impl NetworkUpgrade {
|
|||
/// and it's a test build, this returns a list of fake activation heights
|
||||
/// used by some tests.
|
||||
pub(crate) fn activation_list(network: Network) -> BTreeMap<block::Height, NetworkUpgrade> {
|
||||
println!(
|
||||
"activation_list called {:?}",
|
||||
std::env::var_os("TEST_FAKE_ACTIVATION_HEIGHTS")
|
||||
);
|
||||
let (mainnet_heights, testnet_heights) = {
|
||||
#[cfg(not(feature = "zebra-test"))]
|
||||
{
|
||||
(MAINNET_ACTIVATION_HEIGHTS, TESTNET_ACTIVATION_HEIGHTS)
|
||||
}
|
||||
|
||||
// To prevent accidentally setting this somehow, only check the env var
|
||||
// when being compiled for tests. We can't use cfg(test) since the
|
||||
// test that uses this is in zebra-state, and cfg(test) is not
|
||||
// set for dependencies. However, zebra-state does set the
|
||||
// zebra-test feature of zebra-chain if it's a dev dependency.
|
||||
//
|
||||
// Cargo features are additive, so all test binaries built along with
|
||||
// zebra-state will have this feature enabled. But we are using
|
||||
// Rust Edition 2021 and Cargo resolver version 2, so the "zebra-test"
|
||||
// feature should only be enabled for tests:
|
||||
// https://doc.rust-lang.org/cargo/reference/features.html#resolver-version-2-command-line-flags
|
||||
#[cfg(feature = "zebra-test")]
|
||||
if std::env::var_os("TEST_FAKE_ACTIVATION_HEIGHTS").is_some() {
|
||||
(
|
||||
|
|
Loading…
Reference in New Issue