forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge #6216: fix: intermittent failures in governance tests with tsan
291716a refactor: move common duplicated code to test_framework/governance.py (Konstantin Akimov) f16b998 fix: intermittent failure in feature_governance.py by bump timeout (Konstantin Akimov) c3d5858 fix: intermittent failure in feature_governance_cl by bumping timeout (Konstantin Akimov) Pull request description: ## Issue being fixed or feature implemented Intermittent failure in functional tests feature_governance and feature_governance_cl: - https://gitlab.com/dashpay/dash/-/jobs/7574959798 - https://gitlab.com/dashpay/dash/-/jobs/7574917439 - https://gitlab.com/dashpay/dash/-/jobs/7576050419 and many other ## What was done? Bump timeout in `feature_governance.py`, `feature_governance_cl.py`; moved code from them to `test_framework/governance.py` ## How Has This Been Tested? Run unit/functional tests in 40 threads locally: amount of failures decreased from 50% to 2.5% ``` test/functional/test_runner.py -j40 feature_governance_cl.py feature_governance_cl.py feature_governance_cl.py feature_governance_cl.py feature_governance_cl.py feature_governance_cl.py feature_governance_cl.py feature_governance_cl.py feature_governance_cl.py feature_governance_cl.py feature_governance.py feature_governance.py feature_governance.py feature_governance.py feature_governance.py feature_governance.py feature_governance.py feature_governance.py feature_governance.py feature_governance_cl.py feature_governance_cl.py feature_governance_cl.py feature_governance_cl.py feature_governance_cl.py feature_governance_cl.py feature_governance_cl.py feature_governance_cl.py feature_governance_cl.py feature_governance_cl.py feature_governance.py feature_governance.py feature_governance.py feature_governance.py feature_governance.py feature_governance.py feature_governance.py feature_governance.py feature_governance.py ``` ## Breaking Changes N/A ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [x] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone ACKs for top commit: PastaPastaPasta: utACK 291716a UdjinM6: utACK 291716a Tree-SHA512: 9e62aad2c79817c7d549e5526a71029c2a363b700de847637622c0c180a8c693eb3b47b32cddfd9f98ceaa95614449b13c60dbd74b381858bae9e5a1dc47358e
- Loading branch information
Showing
4 changed files
with
54 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright (c) 2018-2024 The Dash Core developers | ||
# Distributed under the MIT software license, see the accompanying | ||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||
"""Utils for dash governance tests.""" | ||
|
||
import json | ||
|
||
def prepare_object(node, object_type, parent_hash, creation_time, revision, name, amount, payment_address): | ||
proposal_rev = revision | ||
proposal_time = int(creation_time) | ||
proposal_template = { | ||
"type": object_type, | ||
"name": name, | ||
"start_epoch": proposal_time, | ||
"end_epoch": proposal_time + 24 * 60 * 60, | ||
"payment_amount": float(amount), | ||
"payment_address": payment_address, | ||
"url": "https://dash.org" | ||
} | ||
proposal_hex = ''.join(format(x, '02x') for x in json.dumps(proposal_template).encode()) | ||
collateral_hash = node.gobject("prepare", parent_hash, proposal_rev, proposal_time, proposal_hex) | ||
return { | ||
"parentHash": parent_hash, | ||
"collateralHash": collateral_hash, | ||
"createdAt": proposal_time, | ||
"revision": proposal_rev, | ||
"hex": proposal_hex, | ||
"data": proposal_template, | ||
} | ||
|
||
def have_trigger_for_height(nodes, sb_block_height): | ||
count = 0 | ||
for node in nodes: | ||
valid_triggers = node.gobject("list", "valid", "triggers") | ||
for trigger in list(valid_triggers.values()): | ||
if json.loads(trigger["DataString"])["event_block_height"] != sb_block_height: | ||
continue | ||
if trigger['AbsoluteYesCount'] > 0: | ||
count = count + 1 | ||
break | ||
return count == len(nodes) | ||
|