qa-tests: Add test for timeouts due to missing init errors
What changed, and why it matters
This commit only adds a new automated test to Bitcoin Core's internal quality-assurance suite. It checks that a helper function used during testing raises exactly one exception when a node startup error does not occur within the expected timeout. There is no change to production code, no user-facing behavior change, and no security vulnerability being fixed.
No security action required. This is a normal QA/test-only commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds a regression test in test/functional/feature_framework_startup_failures.py. The new test, TestMissingInitErrorTimeout, verifies that assert_start_raises_init_error() raises a single AssertionError (rather than multiple exceptions) when the underlying bitcoind process does not exit with an init error before the timeout. It also fixes a minor typo in a log message (‘test’ to ‘tests’). The commit references an earlier fix and ensures it remains intact.
Changed components
test/functional/feature_framework_startup_failures.pyInspect captured patch +22 / −1
diff --git a/test/functional/feature_framework_startup_failures.py b/test/functional/feature_framework_startup_failures.py
index 1949952e..115b36ad 100755
--- a/test/functional/feature_framework_startup_failures.py
+++ b/test/functional/feature_framework_startup_failures.py
@@ -76,7 +76,7 @@ class FeatureFrameworkStartupFailures(BitcoinTestFramework):
"NonExistentError",
)
- self.log.info("Parent process is measuring node startup duration in order to obtain a reasonable timeout value for later test...")
+ self.log.info("Parent process is measuring node startup duration in order to obtain a reasonable timeout value for later tests...")
node_start_time = time.time()
self.nodes[0].start()
self.nodes[0].wait_for_rpc_connection()
@@ -90,6 +90,12 @@ class FeatureFrameworkStartupFailures(BitcoinTestFramework):
r"AssertionError: \[node 0\] Unable to connect to bitcoind after \d+s \(ignored errors: {[^}]*'OSError \w+'?: \d+[^}]*}, latest: '[\w ]+'/\w+\([^)]+\)\)"
)
+ self.log.info("Verifying timeout while waiting for init errors that do not occur results in only one exception.")
+ self._verify_startup_failure(
+ TestMissingInitErrorTimeout, [f"--internal_node_start_duration={node_start_duration}"],
+ r"AssertionError: \[node 0\] bitcoind should have exited within \d+s with an error \(cmd:"
+ )
+
self.log.info("Verifying startup failure due to invalid arg results in only one exception.")
self._verify_startup_failure(
TestInitErrorStartupFailure, [],
@@ -131,6 +137,21 @@ class TestWrongRpcPortStartupFailure(InternalDurationTestMixin, BitcoinTestFrame
def run_test(self):
assert False, "Should have failed earlier during startup."
+class TestMissingInitErrorTimeout(InternalDurationTestMixin, BitcoinTestFramework):
+ def set_test_params(self):
+ self.num_nodes = 1
+ # Override the timeout to avoid waiting unnecessarily long for an init
+ # error which never occurs.
+ self.rpc_timeout = self.get_reasonable_rpc_timeout()
+
+ def setup_network(self):
+ self.add_nodes(self.num_nodes, self.extra_args)
+ self.nodes[0].assert_start_raises_init_error()
+ assert False, "assert_start_raises_init_error() should raise an exception due to timeout since we don't expect an init error."
+
+ def run_test(self):
+ assert False, "Should have failed earlier during startup."
+
class TestInitErrorStartupFailure(InternalTestMixin, BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.