qa: Run all tests even if wallet is not compiled

Github-Pull: #14180
Rebased-From: fac9539836
This commit is contained in:
MarcoFalke 2018-09-09 13:32:37 -04:00 committed by Anthony Fieroni
parent 3a102216f4
commit 70998ac794
45 changed files with 153 additions and 0 deletions

View file

@ -85,6 +85,9 @@ class ExampleTest(BitcoinTestFramework):
# self.log.info("I've finished set_test_params") # Oops! Can't run self.log before run_test()
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
# Use skip_test_if_missing_module() to skip the test if your test requires certain modules to be present.
# This test uses generate which requires wallet to be compiled
def skip_test_if_missing_module(self):

View file

@ -37,6 +37,9 @@ class BIP68Test(BitcoinTestFramework):
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
self.relayfee = self.nodes[0].getnetworkinfo()["relayfee"]

View file

@ -84,6 +84,9 @@ class FullBlockTest(BitcoinTestFramework):
self.setup_clean_chain = True
self.extra_args = [['-acceptnonstdtxn=1']] # This is a consensus block test, we don't care about tx policy
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
node = self.nodes[0] # convenience reference to the node

View file

@ -16,6 +16,9 @@ class BlocksdirTest(BitcoinTestFramework):
self.setup_clean_chain = True
self.num_nodes = 1
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
self.stop_node(0)
assert os.path.isdir(os.path.join(self.nodes[0].datadir, self.chain, "blocks"))

View file

@ -77,6 +77,9 @@ class BIP65Test(BitcoinTestFramework):
},
)
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
self.nodes[0].add_p2p_connection(P2PInterface())

View file

@ -14,6 +14,9 @@ class ConfArgsTest(BitcoinTestFramework):
self.setup_clean_chain = True
self.num_nodes = 1
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def test_config_file_parser(self):
# Assume node is stopped

View file

@ -60,6 +60,9 @@ class BIP66Test(BitcoinTestFramework):
},
)
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
self.nodes[0].add_p2p_connection(P2PInterface())

View file

@ -138,6 +138,9 @@ class EstimateFeeTest(BitcoinTestFramework):
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self):
"""
We'll setup the network to have 3 nodes that all mine with different parameters.

View file

@ -15,6 +15,9 @@ class LoggingTest(BitcoinTestFramework):
self.num_nodes = 1
self.setup_clean_chain = True
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def relative_log_path(self, name):
return os.path.join(self.nodes[0].datadir, "regtest", name)

View file

@ -31,6 +31,9 @@ class MinimumChainWorkTest(BitcoinTestFramework):
self.extra_args = [[], ["-minimumchainwork=0x65"], ["-minimumchainwork=0x65"]]
self.node_min_work = [0, 101, 101]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self):
# This test relies on the chain setup being:
# node0 <- node1 <- node2

View file

@ -19,6 +19,9 @@ class NotificationsTest(BitcoinTestFramework):
self.num_nodes = 2
self.setup_clean_chain = True
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self):
self.alertnotify_dir = os.path.join(self.options.tmpdir, "alertnotify")
self.blocknotify_dir = os.path.join(self.options.tmpdir, "blocknotify")

View file

@ -46,6 +46,9 @@ class NULLDUMMYTest(BitcoinTestFramework):
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
self.address = self.nodes[0].getnewaddress()
self.ms_address = self.nodes[0].addmultisigaddress(1, [self.address])['address']

View file

@ -79,6 +79,9 @@ class ReplaceByFeeTest(BitcoinTestFramework):
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
# Leave IBD
self.nodes[0].generate(1)

View file

@ -18,6 +18,9 @@ class ReindexTest(BitcoinTestFramework):
self.setup_clean_chain = True
self.num_nodes = 1
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def reindex(self, justchainstate=False):
self.nodes[0].generatetoaddress(3, self.nodes[0].get_deterministic_priv_key().address)
blockcount = self.nodes[0].getblockcount()

View file

@ -30,6 +30,9 @@ class VersionBitsWarningTest(BitcoinTestFramework):
self.setup_clean_chain = True
self.num_nodes = 1
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self):
self.alert_filename = os.path.join(self.options.tmpdir, "alert.txt")
# Open and close to create zero-length file

View file

@ -12,6 +12,9 @@ class TestBitcoinCli(BitcoinTestFramework):
self.setup_clean_chain = True
self.num_nodes = 1
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
"""Main test logic"""

View file

@ -9,12 +9,14 @@ from test_framework.address import ADDRESS_BCRT1_UNSPENDABLE
from test_framework.test_framework import BitcoinTestFramework
from test_framework.messages import CTransaction, hash256
from test_framework.util import assert_equal, connect_nodes
assert_equal,
from io import BytesIO
from time import sleep
def hash256_reversed(byte_str):
return hash256(byte_str)[::-1]
class ZMQSubscriber:
def __init__(self, socket, topic):
self.sequence = 0
@ -41,6 +43,8 @@ class ZMQTest (BitcoinTestFramework):
def skip_test_if_missing_module(self):
self.skip_if_no_py3_zmq()
self.skip_if_no_bitcoind_zmq()
self.skip_if_no_wallet()
def setup_nodes(self):
def run_test(self):
import zmq

View file

@ -22,6 +22,9 @@ class MempoolLimitTest(BitcoinTestFramework):
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
txouts = gen_return_txouts()
relayfee = self.nodes[0].getnetworkinfo()['relayfee']

View file

@ -56,6 +56,9 @@ class MiningTest(BitcoinTestFramework):
self.restart_node(0)
connect_nodes(self.nodes[0], 1)
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
self.mine_chain()
node = self.nodes[0]

View file

@ -22,6 +22,9 @@ class PrioritiseTransactionTest(BitcoinTestFramework):
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
# Test `prioritisetransaction` required parameters
assert_raises_rpc_error(-1, "prioritisetransaction", self.nodes[0].prioritisetransaction)

View file

@ -30,6 +30,9 @@ class P2PFingerprintTest(BitcoinTestFramework):
self.setup_clean_chain = True
self.num_nodes = 1
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
# Build a chain of blocks on top of given one
def build_chain(self, nblocks, prev_hash, prev_height, prev_median_time):
blocks = []

View file

@ -24,6 +24,9 @@ class InvalidBlockRequestTest(BitcoinTestFramework):
self.setup_clean_chain = True
self.extra_args = [["-whitelist=127.0.0.1"]]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
# Add p2p connection to node0
node = self.nodes[0] # convenience reference to the node

View file

@ -15,6 +15,9 @@ class InvalidLocatorTest(BitcoinTestFramework):
self.num_nodes = 1
self.setup_clean_chain = False
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
node = self.nodes[0] # convenience reference to the node
node.generatetoaddress(1, node.get_deterministic_priv_key().address) # Get node out of IBD

View file

@ -30,6 +30,9 @@ class InvalidTxRequestTest(BitcoinTestFramework):
]]
self.setup_clean_chain = True
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def bootstrap_p2p(self, *, num_connections=1):
"""Add a P2P connection to the node.

View file

@ -93,6 +93,9 @@ class P2PLeakTest(BitcoinTestFramework):
self.num_nodes = 1
self.extra_args = [['-banscore=' + str(banscore)]]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
no_version_bannode = self.nodes[0].add_p2p_connection(CNodeNoVersionBan(), send_version=False, wait_for_verack=False)
no_version_idlenode = self.nodes[0].add_p2p_connection(CNodeNoVersionIdle(), send_version=False, wait_for_verack=False)

View file

@ -40,6 +40,9 @@ class NodeNetworkLimitedTest(BitcoinTestFramework):
self.num_nodes = 3
self.extra_args = [['-prune=550', '-addrmantest'], [], []]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def disconnect_all(self):
disconnect_nodes(self.nodes[0], 1)
disconnect_nodes(self.nodes[1], 0)

View file

@ -195,6 +195,9 @@ class SegWitTest(BitcoinTestFramework):
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self):
self.setup_nodes()
connect_nodes(self.nodes[0], 1)

View file

@ -207,6 +207,9 @@ class SendHeadersTest(BitcoinTestFramework):
self.setup_clean_chain = True
self.num_nodes = 2
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def mine_blocks(self, count):
"""Mine count blocks and return the new tip."""

View file

@ -70,6 +70,9 @@ class AcceptBlockTest(BitcoinTestFramework):
self.num_nodes = 2
self.extra_args = [[], ["-minimumchainwork=0x10"]]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self):
# Node0 will be used to test behavior of processing unrequested blocks
# from peers which are not whitelisted, while Node1 will be used for

View file

@ -50,6 +50,9 @@ class BlockchainTest(BitcoinTestFramework):
self.setup_clean_chain = True
self.num_nodes = 1
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
self.mine_chain()
self.restart_node(0, extra_args=['-stopatheight=207', '-prune=1']) # Set extra args with pruning after rescan is complete

View file

@ -12,6 +12,9 @@ class DeprecatedRpcTest(BitcoinTestFramework):
self.setup_clean_chain = True
self.extra_args = [[], []]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
# This test should be used to verify correct behaviour of deprecated
# RPC methods with and without the -deprecatedrpc flags. For example:

View file

@ -17,6 +17,9 @@ class GetChainTipsTest (BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 4
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
tips = self.nodes[0].getchaintips()
assert_equal(len(tips), 1)

View file

@ -18,6 +18,9 @@ class InvalidateTest(BitcoinTestFramework):
self.setup_clean_chain = True
self.num_nodes = 3
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self):
self.setup_nodes()

View file

@ -37,6 +37,9 @@ class PreciousTest(BitcoinTestFramework):
self.setup_clean_chain = True
self.num_nodes = 3
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def setup_network(self):
self.setup_nodes()

View file

@ -75,6 +75,9 @@ class PSBTTest(BitcoinTestFramework):
connect_nodes(self.nodes[0], 1)
connect_nodes(self.nodes[0], 2)
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
# Create and fund a raw tx for sending 10 BTC
psbtx1 = self.nodes[0].walletcreatefundedpsbt([], {self.nodes[2].getnewaddress():10})['psbt']

View file

@ -19,6 +19,9 @@ class SignRawTransactionsTest(BitcoinTestFramework):
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def successful_signing_test(self):
"""Create and sign a valid raw transaction with one input.

View file

@ -46,6 +46,13 @@ TEST_EXIT_SKIPPED = 77
TMPDIR_PREFIX = "bitcoin_func_test_"
class SkipTest(Exception):
"""This exception is raised to skip a test"""
def __init__(self, message):
self.message = message
class SkipTest(Exception):
"""This exception is raised to skip a test"""
@ -571,6 +578,23 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
if not self.is_cli_compiled():
raise SkipTest("bitcoin-cli has not been compiled.")
def is_cli_compiled(self):
"""Checks whether bitcoin-cli was compiled."""
return config["components"].getboolean("ENABLE_UTILS")
def is_wallet_compiled(self):
"""Checks whether the wallet module was compiled."""
config = configparser.ConfigParser()
config.read_file(open(self.options.configfile))
return config["components"].getboolean("ENABLE_WALLET")
def is_zmq_compiled(self):
"""Checks whether the zmq module was compiled."""
config = configparser.ConfigParser()
config.read_file(open(self.options.configfile))
def is_cli_compiled(self):
"""Checks whether bitcoin-cli was compiled."""
return self.config["components"].getboolean("ENABLE_CLI")

View file

@ -69,6 +69,7 @@ from test_framework.segwit_addr import (
decode,
)
class AddressTypeTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 6

View file

@ -21,6 +21,9 @@ class WalletGroupTest(BitcoinTestFramework):
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
# Mine some coins
self.nodes[0].generate(110)

View file

@ -24,6 +24,7 @@ class WalletHDTest(BitcoinTestFramework):
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
# Make sure we use hd, keep masterkeyid
masterkeyid = self.nodes[1].getwalletinfo()['hdseedid']

View file

@ -29,6 +29,9 @@ class KeypoolRestoreTest(BitcoinTestFramework):
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
wallet_path = os.path.join(self.nodes[1].datadir, "regtest", "wallets", "wallet.dat")
wallet_backup_path = os.path.join(self.nodes[1].datadir, "wallet.bak")

View file

@ -22,6 +22,9 @@ class WalletLabelsTest(BitcoinTestFramework):
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
# Check that there's no UTXO on the node
node = self.nodes[0]

View file

@ -20,6 +20,9 @@ class ReceivedByTest(BitcoinTestFramework):
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
# Generate block to get out of IBD
self.nodes[0].generate(1)

View file

@ -27,6 +27,9 @@ class ListTransactionsTest(BitcoinTestFramework):
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
self.nodes[0].generate(1) # Get out of IBD
self.sync_all()

View file

@ -31,6 +31,9 @@ class ResendWalletTransactionsTest(BitcoinTestFramework):
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
def run_test(self):
node = self.nodes[0] # alias