Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FreshEyes] test: fix RPC coverage check #13

Open
wants to merge 2 commits into
base: bitcoin-fresheyes-staging-master-29387
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions test/functional/create_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
class CreateCache(BitcoinTestFramework):
# Test network and test nodes are not required:

def add_options(self, parser):
self.add_wallet_options(parser)

def set_test_params(self):
self.num_nodes = 0

Expand Down
2 changes: 1 addition & 1 deletion test/functional/test_framework/test_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ def _initialize_chain(self):
cache_node_dir,
chain=self.chain,
extra_conf=["bind=127.0.0.1"],
extra_args=['-disablewallet'],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 authors commented here with:

  • comment link https://github.com/bitcoin/bitcoin/pull/29387#discussion_r1479210925 at 2024/02/06, 04:36:19 UTC
  • comment link https://github.com/bitcoin/bitcoin/pull/29387#discussion_r1479350456 at 2024/02/06, 07:55:10 UTC
  • comment link https://github.com/bitcoin/bitcoin/pull/29387#discussion_r1479680894 at 2024/02/06, 12:17:30 UTC
  • comment link https://github.com/bitcoin/bitcoin/pull/29387#discussion_r1480054753 at 2024/02/06, 15:40:05 UTC
  • comment link https://github.com/bitcoin/bitcoin/pull/29387#discussion_r1480059345 at 2024/02/06, 15:43:05 UTC.

extra_args=[],
rpchost=None,
timewait=self.rpc_timeout,
timeout_factor=self.options.timeout_factor,
Expand Down
9 changes: 7 additions & 2 deletions test/functional/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ def main():
parser.add_argument('--tmpdirprefix', '-t', default=tempfile.gettempdir(), help="Root directory for datadirs")
parser.add_argument('--failfast', '-F', action='store_true', help='stop execution after the first test failure')
parser.add_argument('--filter', help='filter scripts to run by regular expression')
parser.add_argument("--legacy-wallet", action='store_const', const=False, help="Run test using legacy wallets", dest='legacy_wallet')


args, unknown_args = parser.parse_known_args()
Expand Down Expand Up @@ -535,9 +536,10 @@ def main():
combined_logs_len=args.combinedlogslen,
failfast=args.failfast,
use_term_control=args.ansi,
legacy=args.legacy_wallet,
)

def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=False, args=None, combined_logs_len=0, failfast=False, use_term_control):
def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=False, args=None, combined_logs_len=0, failfast=False, use_term_control, legacy=False):
args = args or []

# Warn if bitcoind is already running
Expand Down Expand Up @@ -572,7 +574,10 @@ def run_tests(*, test_list, src_dir, build_dir, tmpdir, jobs=1, enable_coverage=
if len(test_list) > 1 and jobs > 1:
# Populate cache
try:
subprocess.check_output([sys.executable, tests_dir + 'create_cache.py'] + flags + ["--tmpdir=%s/cache" % tmpdir])
# Disable '--descriptors' flag on create_cache if '--legacy-wallet' flag is provided
wallet_flag = '--legacy-wallet' if legacy else '--descriptors'

subprocess.check_output([sys.executable, tests_dir + 'create_cache.py'] + flags + [f"--tmpdir={tmpdir}/cache", wallet_flag])
except subprocess.CalledProcessError as e:
sys.stdout.buffer.write(e.output)
raise
Expand Down
4 changes: 4 additions & 0 deletions test/functional/wallet_transactiontime_rescan.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ def run_test(self):
restorewo_wallet.importaddress(wo2, rescan=False)
restorewo_wallet.importaddress(wo3, rescan=False)

self.log.info('Testing abortrescan when no rescan is in progress')
assert_equal(restorewo_wallet.getwalletinfo()['scanning'], False)
assert_equal(restorewo_wallet.abortrescan(), False)

# check user has 0 balance and no transactions
assert_equal(restorewo_wallet.getbalance(), 0)
assert_equal(len(restorewo_wallet.listtransactions()), 0)
Expand Down