bitcoin/test/functional/test_framework
Ryan Ofsky ad5cd129f3
Merge bitcoin/bitcoin#30660: qa: Verify clean shutdown on startup failure
10845cd7cc qa: Add feature_framework_startup_failures.py (Hodlinator)
28e282ef9a qa: assert_raises_message() - Stop assuming certain structure for exceptions (Hodlinator)
1f639efca5 qa: Work around Python socket timeout issue (Hodlinator)
9b24a403fa qa: Only allow calling TestNode.stop() after connecting (Hodlinator)
6ad21b4c01 qa: Include ignored errors in RPC connection timeout (Hodlinator)
879243e81f qa refactor: wait_for_rpc_connection - Treat OSErrors the same (Hodlinator)

Pull request description:

  Improves handling of startup errors in functional tests and puts tests in place to ensure knock-on errors don't creep in.
  - `wait_for_rpc_connection()` now appends specific failures leading up to the `Unable to connect to bitcoind` error to that error message:
    `[node 0] Unable to connect to bitcoind after 60s (ignored errors: {'missing_credentials': 1, 'OSError.ECONNREFUSED': 239}, latest error: ConnectionRefusedError(111, 'Connection refused'))`
  - Fixes Windows Python issue where `socket.timeout` exceptions end up with unset `errno`-fields.
  - Also adds comments, refactors code, improves logging.

  The underlying purpose is to ensure developer efficiency in finding root causes of test failures.

  Prior iterations of the PR partially focused on fixing the same issue as #31620.
  Originally inspired by #30390.

  ### Testing

  Can be tested by reverting either faf2f2c654 or fae3bf6b87 from #31620, or the "qa: Avoid calling stop-RPC if not connected" from this PR, and running *feature_framework_startup_failures.py*.

ACKs for top commit:
  l0rinc:
    ACK 10845cd7cc
  ryanofsky:
    Code review ACK 10845cd7cc. Only changes since last review were adding a new commit tweaking assert_raises_message(), extending the new test to have a self-check, and to pass through all options to child tests instead of a hardcoded list of options. I left some cleanup suggestions below but they are not important.

Tree-SHA512: f0235c5cbb6d1bb85d8dc5de492a08a34f6edc83499cbf0a5f9a3824809ff84635888c62c9c01101e3cc9ef9f1cdee2c9ab6537fea6feeb005b29f428caf8b22
2025-05-08 16:57:46 -04:00
..
crypto test: create assert_not_equal util and add to where imports are needed 2025-04-01 08:39:24 -04:00
__init__.py Rename rpc-tests directory to functional 2017-03-20 10:40:31 -04:00
address.py test: check that keyless P2A 'signing' via signrawtransactionwithkey succeeds 2024-08-02 20:13:07 +02:00
authproxy.py test: Fix authproxy named args debug logging 2025-02-25 22:41:17 +01:00
bip340_test_vectors.csv tests: add BIP340 Schnorr signature support to test framework 2020-10-12 17:18:47 -07:00
blockfilter.py Merge bitcoin/bitcoin#28605: Fix typos 2023-11-16 10:35:49 +00:00
blocktools.py test: avoid unneeded hash -> uint256 -> hash roundtrips 2025-03-13 01:41:25 +01:00
compressor.py test: introduce output amount (de)compression routines 2025-03-04 12:50:17 -05:00
coverage.py test: fix PEP484 no implicit optional argument types errors 2023-06-29 16:14:07 -06:00
descriptors.py Output a descriptor in createmultisig and addmultisigaddress 2020-01-30 23:55:36 -05:00
key.py test: create assert_not_equal util and add to where imports are needed 2025-04-01 08:39:24 -04:00
mempool_util.py assert_mempool_contents: assert not duplicates expected 2024-11-20 13:49:41 -05:00
messages.py Merge bitcoin/bitcoin#31953: rpc: Allow fullrbf fee bump in (psbt)bumpfee 2025-04-21 13:25:52 -07:00
netutil.py Merge bitcoin/bitcoin#31614: test: expect that files may disappear from /proc/PID/fd/ 2025-02-10 15:58:09 -08:00
p2p.py test: create assert_not_equal util and add to where imports are needed 2025-04-01 08:39:24 -04:00
psbt.py test: PSBT: eliminate magic numbers for global unsigned tx key (0) 2023-03-04 12:43:38 +01:00
script_util.py test: Add anchor mempool acceptance test 2024-07-30 14:06:58 -04:00
script.py test: avoid unneeded hash -> uint256 -> hash roundtrips 2025-03-13 01:41:25 +01:00
segwit_addr.py Use Bech32m encoding for v1+ segwit addresses 2021-03-16 10:48:36 -07:00
socks5.py test: Avoid F541 (f-string without any placeholders) 2024-12-05 08:39:09 +01:00
test_framework.py test: Remove unused options and variables, correct comments 2025-05-06 12:33:16 -07:00
test_node.py Merge bitcoin/bitcoin#30660: qa: Verify clean shutdown on startup failure 2025-05-08 16:57:46 -04:00
test_shell.py test: remove legacy wallet functional tests 2025-04-23 12:10:30 -07:00
util.py Merge bitcoin/bitcoin#30660: qa: Verify clean shutdown on startup failure 2025-05-08 16:57:46 -04:00
v2_p2p.py test: Check that disconnection happens when >4095 garbage bytes is sent 2024-06-21 19:37:13 +05:30
wallet_util.py Fix typos in description.md and wallet_util.py 2024-04-25 16:14:10 +08:00
wallet.py Merge bitcoin/bitcoin#30226: test: add validation for gettxout RPC response 2025-02-05 13:30:51 +00:00