Permalink
Browse files

Merge #8056: [qa] Remove hardcoded "4 nodes" from test_framework

fad68f7 [qa] Reduce node count for some tests (MarcoFalke)
fac9349 [qa] Remove hardcoded "4 nodes" from test_framework (MarcoFalke)
  • Loading branch information...
MarcoFalke committed May 20, 2016
2 parents 1b87e5b + fad68f7 commit 8844ef15ded02d5ed86fb95aaf251235fcef2396
Showing with 291 additions and 138 deletions.
  1. +4 −0 qa/rpc-tests/abandonconflict.py
  2. +2 −1 qa/rpc-tests/bip65-cltv-p2p.py
  3. +4 −0 qa/rpc-tests/bip65-cltv.py
  4. +2 −1 qa/rpc-tests/bip68-112-113-p2p.py
  5. +4 −0 qa/rpc-tests/bip68-sequence.py
  6. +2 −1 qa/rpc-tests/bip9-softforks.py
  7. +2 −1 qa/rpc-tests/bipdersig-p2p.py
  8. +4 −0 qa/rpc-tests/bipdersig.py
  9. +5 −5 qa/rpc-tests/blockchain.py
  10. +5 −4 qa/rpc-tests/decodescript.py
  11. +5 −4 qa/rpc-tests/disablewallet.py
  12. +5 −0 qa/rpc-tests/forknotify.py
  13. +6 −5 qa/rpc-tests/fundrawtransaction.py
  14. +5 −0 qa/rpc-tests/getblocktemplate_longpoll.py
  15. +9 −0 qa/rpc-tests/getblocktemplate_proposals.py
  16. +4 −1 qa/rpc-tests/getchaintips.py
  17. +7 −2 qa/rpc-tests/httpbasics.py
  18. +5 −4 qa/rpc-tests/importprunedfunds.py
  19. +5 −4 qa/rpc-tests/invalidateblock.py
  20. +1 −0 qa/rpc-tests/invalidblockrequest.py
  21. +1 −0 qa/rpc-tests/invalidtxrequest.py
  22. +5 −6 qa/rpc-tests/keypool.py
  23. +5 −1 qa/rpc-tests/listtransactions.py
  24. +5 −4 qa/rpc-tests/maxblocksinflight.py
  25. +7 −5 qa/rpc-tests/maxuploadtarget.py
  26. +6 −6 qa/rpc-tests/mempool_limit.py
  27. +4 −0 qa/rpc-tests/mempool_packages.py
  28. +4 −0 qa/rpc-tests/mempool_reorg.py
  29. +5 −0 qa/rpc-tests/mempool_resurrect_test.py
  30. +5 −0 qa/rpc-tests/mempool_spendcoinbase.py
  31. +4 −3 qa/rpc-tests/merkle_blocks.py
  32. +11 −5 qa/rpc-tests/multi_rpc.py
  33. +6 −0 qa/rpc-tests/nodehandling.py
  34. +4 −2 qa/rpc-tests/p2p-acceptblock.py
  35. +6 −0 qa/rpc-tests/p2p-feefilter.py
  36. +1 −0 qa/rpc-tests/p2p-fullblocktest.py
  37. +4 −2 qa/rpc-tests/p2p-versionbits-warning.py
  38. +4 −4 qa/rpc-tests/prioritise_transaction.py
  39. +5 −1 qa/rpc-tests/proxy_test.py
  40. +4 −4 qa/rpc-tests/pruning.py
  41. +5 −4 qa/rpc-tests/rawtransactions.py
  42. +6 −1 qa/rpc-tests/receivedby.py
  43. +4 −3 qa/rpc-tests/reindex.py
  44. +5 −0 qa/rpc-tests/replace-by-fee.py
  45. +5 −4 qa/rpc-tests/rest.py
  46. +2 −2 qa/rpc-tests/rpcbind_test.py
  47. +5 −3 qa/rpc-tests/sendheaders.py
  48. +5 −4 qa/rpc-tests/signmessages.py
  49. +5 −4 qa/rpc-tests/signrawtransactions.py
  50. +5 −0 qa/rpc-tests/smartfees.py
  51. +13 −12 qa/rpc-tests/test_framework/test_framework.py
  52. +20 −13 qa/rpc-tests/test_framework/util.py
  53. +5 −0 qa/rpc-tests/txn_clone.py
  54. +5 −0 qa/rpc-tests/txn_doublespend.py
  55. +4 −3 qa/rpc-tests/wallet.py
  56. +5 −4 qa/rpc-tests/walletbackup.py
  57. +5 −4 qa/rpc-tests/zapwallettxes.py
  58. +5 −1 qa/rpc-tests/zmq_test.py
@@ -9,6 +9,10 @@
import urllib.parse
class AbandonConflictTest(BitcoinTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 2
self.setup_clean_chain = False
def setup_network(self):
self.nodes = []
@@ -37,11 +37,12 @@ def cltv_invalidate(tx):
class BIP65Test(ComparisonTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 1
def setup_network(self):
# Must set the blockversion for this test
self.nodes = start_nodes(1, self.options.tmpdir,
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
extra_args=[['-debug', '-whitelist=127.0.0.1', '-blockversion=3']],
binary=[self.options.testbinary])
@@ -11,6 +11,10 @@
from test_framework.util import *
class BIP65Test(BitcoinTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 3
self.setup_clean_chain = False
def setup_network(self):
self.nodes = []
@@ -94,11 +94,12 @@ def all_rlt_txs(txarray):
class BIP68_112_113Test(ComparisonTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 1
def setup_network(self):
# Must set the blockversion for this test
self.nodes = start_nodes(1, self.options.tmpdir,
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
extra_args=[['-debug', '-whitelist=127.0.0.1', '-blockversion=4']],
binary=[self.options.testbinary])
@@ -22,6 +22,10 @@
NOT_FINAL_ERROR = "64: non-BIP68-final"
class BIP68Test(BitcoinTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 2
self.setup_clean_chain = False
def setup_network(self):
self.nodes = []
@@ -32,10 +32,11 @@
class BIP9SoftForksTest(ComparisonTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 1
def setup_network(self):
self.nodes = start_nodes(1, self.options.tmpdir,
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
extra_args=[['-debug', '-whitelist=127.0.0.1']],
binary=[self.options.testbinary])
@@ -45,11 +45,12 @@ def unDERify(tx):
class BIP66Test(ComparisonTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 1
def setup_network(self):
# Must set the blockversion for this test
self.nodes = start_nodes(1, self.options.tmpdir,
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
extra_args=[['-debug', '-whitelist=127.0.0.1', '-blockversion=2']],
binary=[self.options.testbinary])
@@ -11,6 +11,10 @@
from test_framework.util import *
class BIP66Test(BitcoinTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 3
self.setup_clean_chain = False
def setup_network(self):
self.nodes = []
View
@@ -13,7 +13,6 @@
from test_framework.test_framework import BitcoinTestFramework
from test_framework.authproxy import JSONRPCException
from test_framework.util import (
initialize_chain,
assert_equal,
assert_raises,
assert_is_hex_string,
@@ -32,12 +31,13 @@ class BlockchainTest(BitcoinTestFramework):
"""
def setup_chain(self):
print("Initializing test directory " + self.options.tmpdir)
initialize_chain(self.options.tmpdir)
def __init__(self):
super().__init__()
self.setup_clean_chain = False
self.num_nodes = 2
def setup_network(self, split=False):
self.nodes = start_nodes(2, self.options.tmpdir)
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
connect_nodes_bi(self.nodes, 0, 1)
self.is_network_split = False
self.sync_all()
@@ -11,12 +11,13 @@
class DecodeScriptTest(BitcoinTestFramework):
"""Tests decoding scripts via RPC command "decodescript"."""
def setup_chain(self):
print('Initializing test directory ' + self.options.tmpdir)
initialize_chain_clean(self.options.tmpdir, 1)
def __init__(self):
super().__init__()
self.setup_clean_chain = True
self.num_nodes = 1
def setup_network(self, split=False):
self.nodes = start_nodes(1, self.options.tmpdir)
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
self.is_network_split = False
def decodescript_script_sig(self):
@@ -13,12 +13,13 @@
class DisableWalletTest (BitcoinTestFramework):
def setup_chain(self):
print("Initializing test directory "+self.options.tmpdir)
initialize_chain_clean(self.options.tmpdir, 1)
def __init__(self):
super().__init__()
self.setup_clean_chain = True
self.num_nodes = 1
def setup_network(self, split=False):
self.nodes = start_nodes(1, self.options.tmpdir, [['-disablewallet']])
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, [['-disablewallet']])
self.is_network_split = False
self.sync_all()
@@ -12,6 +12,11 @@
class ForkNotifyTest(BitcoinTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 2
self.setup_clean_chain = False
alert_filename = None # Set by setup_network
def setup_network(self):
@@ -9,12 +9,13 @@
# Create one-input, one-output, no-fee transaction:
class RawTransactionsTest(BitcoinTestFramework):
def setup_chain(self):
print(("Initializing test directory "+self.options.tmpdir))
initialize_chain_clean(self.options.tmpdir, 4)
def __init__(self):
super().__init__()
self.setup_clean_chain = True
self.num_nodes = 4
def setup_network(self, split=False):
self.nodes = start_nodes(4, self.options.tmpdir)
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
connect_nodes_bi(self.nodes,0,1)
connect_nodes_bi(self.nodes,1,2)
@@ -521,7 +522,7 @@ def run_test(self):
stop_nodes(self.nodes)
wait_bitcoinds()
self.nodes = start_nodes(4, self.options.tmpdir)
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
# This test is not meant to test fee estimation and we'd like
# to be sure all txs are sent at a consistent desired feerate
for node in self.nodes:
@@ -26,6 +26,11 @@ class GetBlockTemplateLPTest(BitcoinTestFramework):
Test longpolling with getblocktemplate.
'''
def __init__(self):
super().__init__()
self.num_nodes = 4
self.setup_clean_chain = False
def run_test(self):
print("Warning: this test will take about 70 seconds in the best case. Be patient.")
self.nodes[0].generate(10)
@@ -70,6 +70,15 @@ class GetBlockTemplateProposalTest(BitcoinTestFramework):
Test block proposals with getblocktemplate.
'''
def __init__(self):
super().__init__()
self.num_nodes = 2
self.setup_clean_chain = False
def setup_network(self):
self.nodes = self.setup_nodes()
connect_nodes_bi(self.nodes, 0, 1)
def run_test(self):
node = self.nodes[0]
node.generate(1) # Mine a block to leave initial block download
@@ -11,9 +11,12 @@
from test_framework.util import assert_equal
class GetChainTipsTest (BitcoinTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 4
self.setup_clean_chain = False
def run_test (self):
BitcoinTestFramework.run_test (self)
tips = self.nodes[0].getchaintips ()
assert_equal (len (tips), 1)
@@ -14,8 +14,13 @@
import urllib.parse
class HTTPBasicsTest (BitcoinTestFramework):
def setup_nodes(self):
return start_nodes(4, self.options.tmpdir)
def __init__(self):
super().__init__()
self.num_nodes = 3
self.setup_clean_chain = False
def setup_network(self):
self.nodes = self.setup_nodes()
def run_test(self):
@@ -9,12 +9,13 @@
class ImportPrunedFundsTest(BitcoinTestFramework):
def setup_chain(self):
print("Initializing test directory "+self.options.tmpdir)
initialize_chain_clean(self.options.tmpdir, 4)
def __init__(self):
super().__init__()
self.setup_clean_chain = True
self.num_nodes = 2
def setup_network(self, split=False):
self.nodes = start_nodes(2, self.options.tmpdir)
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir)
connect_nodes_bi(self.nodes,0,1)
self.is_network_split=False
self.sync_all()
@@ -13,10 +13,11 @@
class InvalidateTest(BitcoinTestFramework):
def setup_chain(self):
print("Initializing test directory "+self.options.tmpdir)
initialize_chain_clean(self.options.tmpdir, 3)
def __init__(self):
super().__init__()
self.setup_clean_chain = True
self.num_nodes = 3
def setup_network(self):
self.nodes = []
self.is_network_split = False
@@ -25,6 +25,7 @@ class InvalidBlockRequestTest(ComparisonTestFramework):
''' Can either run this test as 1 node with expected answers, or two and compare them.
Change the "outcome" variable from each TestInstance object to only do the comparison. '''
def __init__(self):
super().__init__()
self.num_nodes = 1
def run_test(self):
@@ -19,6 +19,7 @@ class InvalidTxRequestTest(ComparisonTestFramework):
''' Can either run this test as 1 node with expected answers, or two and compare them.
Change the "outcome" variable from each TestInstance object to only do the comparison. '''
def __init__(self):
super().__init__()
self.num_nodes = 1
def run_test(self):
View
@@ -5,8 +5,6 @@
# Exercise the wallet keypool, and interaction with wallet encryption/locking
# Add python-bitcoinrpc to module search path:
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
@@ -65,12 +63,13 @@ def run_test(self):
except JSONRPCException as e:
assert(e.error['code']==-12)
def setup_chain(self):
print("Initializing test directory "+self.options.tmpdir)
initialize_chain(self.options.tmpdir)
def __init__(self):
super().__init__()
self.setup_clean_chain = False
self.num_nodes = 1
def setup_network(self):
self.nodes = start_nodes(1, self.options.tmpdir)
self.nodes = self.setup_nodes()
if __name__ == '__main__':
KeyPoolTest().main()
@@ -17,11 +17,15 @@ def txFromHex(hexstring):
return tx
class ListTransactionsTest(BitcoinTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 4
self.setup_clean_chain = False
def setup_nodes(self):
#This test requires mocktime
enable_mocktime()
return start_nodes(4, self.options.tmpdir)
return start_nodes(self.num_nodes, self.options.tmpdir)
def run_test(self):
# Simple send, 0 to 1:
@@ -76,12 +76,13 @@ def add_options(self, parser):
default=os.getenv("BITCOIND", "bitcoind"),
help="Binary to test max block requests behavior")
def setup_chain(self):
print("Initializing test directory "+self.options.tmpdir)
initialize_chain_clean(self.options.tmpdir, 1)
def __init__(self):
super().__init__()
self.setup_clean_chain = True
self.num_nodes = 1
def setup_network(self):
self.nodes = start_nodes(1, self.options.tmpdir,
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir,
extra_args=[['-debug', '-whitelist=127.0.0.1']],
binary=[self.options.testbinary])
@@ -80,17 +80,19 @@ def received_pong():
return success
class MaxUploadTest(BitcoinTestFramework):
def __init__(self):
self.utxo = []
self.txouts = gen_return_txouts()
def add_options(self, parser):
parser.add_option("--testbinary", dest="testbinary",
default=os.getenv("BITCOIND", "bitcoind"),
help="bitcoind binary to test")
def setup_chain(self):
initialize_chain_clean(self.options.tmpdir, 2)
def __init__(self):
super().__init__()
self.setup_clean_chain = True
self.num_nodes = 1
self.utxo = []
self.txouts = gen_return_txouts()
def setup_network(self):
# Start a node with maxuploadtarget of 200 MB (/24h)
Oops, something went wrong.

0 comments on commit 8844ef1

Please sign in to comment.