Skip to content

Commit

Permalink
Remove general feature-gate for blockchain tests
Browse files Browse the repository at this point in the history
.. and feature gate the individual test cases, allowing more
fine-grained control going forward.
  • Loading branch information
tnull committed Mar 6, 2025
1 parent e8a7c49 commit b51a330
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
3 changes: 2 additions & 1 deletion client/src/client_sync/v21.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ pub use crate::client_sync::v17::AddressType;
crate::define_jsonrpc_minreq_client!("v21");

// == Blockchain ==
crate::impl_client_v17__getblockchaininfo!();
crate::impl_client_v17__getbestblockhash!();
crate::impl_client_v17__getblock!();
crate::impl_client_v17__getblockchaininfo!();
crate::impl_client_v17__gettxout!();

// == Control ==
crate::impl_client_v17__stop!();
Expand Down
16 changes: 14 additions & 2 deletions integration_test/tests/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

//! Tests for methods found under the `== Blockchain ==` section of the API docs.
#![cfg(any(feature = "0_17_1", feature = "0_18_1"))]

use integration_test::{Node, NodeExt as _};

// FIXME: Do we need this?
Expand Down Expand Up @@ -42,20 +40,23 @@ fn get_block() {
// assert!(json.into_model().is_ok());
}

#[cfg(any(feature = "0_17_1", feature = "0_18_1"))]
#[test]
fn get_block_count() {
let node = Node::new_no_wallet();
let json = node.client.get_block_count().expect("getblockcount");
let _ = json.into_model();
}

#[cfg(any(feature = "0_17_1", feature = "0_18_1"))]
#[test]
fn get_block_hash() {
let node = Node::new_no_wallet();
let json = node.client.get_block_hash(0).expect("getblockhash");
assert!(json.into_model().is_ok());
}

#[cfg(any(feature = "0_17_1", feature = "0_18_1"))]
#[test]
fn get_block_header() { // verbose = false
let node = Node::new_no_wallet();
Expand All @@ -64,6 +65,7 @@ fn get_block_header() { // verbose = false
assert!(json.into_model().is_ok());
}

#[cfg(any(feature = "0_17_1", feature = "0_18_1"))]
#[test]
fn get_block_header_verbose() { // verbose = true
let node = Node::new_no_wallet();
Expand Down Expand Up @@ -96,13 +98,15 @@ fn get_block_stats_by_hash() { // verbose = true
assert!(json.into_model().is_ok());
}

#[cfg(any(feature = "0_17_1", feature = "0_18_1"))]
#[test]
fn get_block_stats_by_height_txindex() {
let node = Node::new_no_wallet_txindex();
let json = node.client.get_block_stats_by_height(0).expect("getblockstats");
assert!(json.into_model().is_ok());
}

#[cfg(any(feature = "0_17_1", feature = "0_18_1"))]
#[test]
fn get_block_stats_by_hash_txindex() { // verbose = true
let node = Node::new_no_wallet_txindex();
Expand All @@ -111,20 +115,23 @@ fn get_block_stats_by_hash_txindex() { // verbose = true
assert!(json.into_model().is_ok());
}

#[cfg(any(feature = "0_17_1", feature = "0_18_1"))]
#[test]
fn get_chain_tips() {
let node = Node::new_no_wallet();
let json = node.client.get_chain_tips().expect("getchaintips");
assert!(json.into_model().is_ok());
}

#[cfg(any(feature = "0_17_1", feature = "0_18_1"))]
#[test]
fn get_chain_tx_stats() {
let node = Node::new_no_wallet();
let json = node.client.get_chain_tx_stats().expect("getchaintxstats");
assert!(json.into_model().is_ok());
}

#[cfg(any(feature = "0_17_1", feature = "0_18_1"))]
#[test]
fn get_difficulty() {
let node = Node::new_no_wallet();
Expand All @@ -146,6 +153,7 @@ fn get_mempool_descendants() {
// same type as `getmempoolentry` which is tested below.
}

#[cfg(any(feature = "0_17_1", feature = "0_18_1"))]
#[test]
fn get_mempool_entry() {
let node = Node::new_with_default_wallet();
Expand All @@ -156,6 +164,7 @@ fn get_mempool_entry() {
assert!(json.into_model().is_ok());
}

#[cfg(any(feature = "0_17_1", feature = "0_18_1"))]
#[test]
fn get_mempool_info() {
let node = Node::new_with_default_wallet();
Expand All @@ -169,6 +178,7 @@ fn get_mempool_info() {
assert_eq!(info.size, 1);
}

#[cfg(any(feature = "0_17_1", feature = "0_18_1"))]
#[test]
fn get_raw_mempool() {
let node = Node::new_with_default_wallet();
Expand Down Expand Up @@ -209,6 +219,7 @@ fn get_tx_out() {
let _ = json.into_model().expect("into_model");
}

#[cfg(any(feature = "0_17_1", feature = "0_18_1"))]
#[test]
fn get_tx_out_set_info() {
let node = Node::new_with_default_wallet();
Expand All @@ -221,6 +232,7 @@ fn get_tx_out_set_info() {

}

#[cfg(any(feature = "0_17_1", feature = "0_18_1"))]
// Implicitly tests the omitted method `gettxoutproof` as well.
#[test]
fn verify_tx_out_proof() {
Expand Down

0 comments on commit b51a330

Please sign in to comment.