[tests] allow tests to be run with --usecli
test_framework accepts a new --usecli parameter. Running the test with this parameter will cause all RPCs to be sent through bitcoin-cli rather than directly over http. By default, individual test cases do not support --usecli, and self.supports_cli must be set to True in the set_test_params method. We can make supports_cli default to True in future once we know which tests will fail with use_cli.
This commit is contained in:
parent
ff9a363ff7
commit
f6ade9ce1a
3 changed files with 24 additions and 9 deletions
test/functional/test_framework
|
@ -62,6 +62,7 @@ class BitcoinTestFramework():
|
|||
self.setup_clean_chain = False
|
||||
self.nodes = []
|
||||
self.mocktime = 0
|
||||
self.supports_cli = False
|
||||
self.set_test_params()
|
||||
|
||||
assert hasattr(self, "num_nodes"), "Test must set self.num_nodes in set_test_params()"
|
||||
|
@ -91,6 +92,8 @@ class BitcoinTestFramework():
|
|||
help="Location of the test framework config file")
|
||||
parser.add_option("--pdbonfailure", dest="pdbonfailure", default=False, action="store_true",
|
||||
help="Attach a python debugger if test fails")
|
||||
parser.add_option("--usecli", dest="usecli", default=False, action="store_true",
|
||||
help="use bitcoin-cli instead of RPC for all commands")
|
||||
self.add_options(parser)
|
||||
(self.options, self.args) = parser.parse_args()
|
||||
|
||||
|
@ -113,6 +116,8 @@ class BitcoinTestFramework():
|
|||
success = TestStatus.FAILED
|
||||
|
||||
try:
|
||||
if self.options.usecli and not self.supports_cli:
|
||||
raise SkipTest("--usecli specified but test does not support using CLI")
|
||||
self.setup_chain()
|
||||
self.setup_network()
|
||||
self.run_test()
|
||||
|
@ -213,7 +218,7 @@ class BitcoinTestFramework():
|
|||
assert_equal(len(extra_args), num_nodes)
|
||||
assert_equal(len(binary), num_nodes)
|
||||
for i in range(num_nodes):
|
||||
self.nodes.append(TestNode(i, self.options.tmpdir, extra_args[i], rpchost, timewait=timewait, binary=binary[i], stderr=None, mocktime=self.mocktime, coverage_dir=self.options.coveragedir))
|
||||
self.nodes.append(TestNode(i, self.options.tmpdir, extra_args[i], rpchost, timewait=timewait, binary=binary[i], stderr=None, mocktime=self.mocktime, coverage_dir=self.options.coveragedir, use_cli=self.options.usecli))
|
||||
|
||||
def start_node(self, i, extra_args=None, stderr=None):
|
||||
"""Start a bitcoind"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue