Page MenuHomePhabricator

[avalanche] Fix flaky abc_p2p_getavaaddr.py test
Needs ReviewPublic

Authored by Fabien on Thu, Jan 30, 13:37.

Details

Reviewers
PiRK
Group Reviewers
Restricted Project
Summary

The getavaaddr_interval_test checks that the getavaaddr messages are accepted by the node by checking for a response. One of the condition to send addresses (and so reply to this request) is that the peer's address to share have a >= 0 availability score. The test currently ensure this by waiting for the peer to receive a poll message but this is not enough: the peer should also respond to the poll so the score is non negative.

This diff changes the test behavior to actually wait for the availability score to be > 0 (and recompute the statistics in the loop instead of only doing it once) so there is no race condition that could cause the test to be flaky.

Test Plan
./test/functional/test_runner.py abc_p2p_getavaaddr

Diff Detail

Repository
rABC Bitcoin ABC
Branch
fix_getavapeer_test
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 32259
Build 64008: Build Diffbuild-diff · build-without-wallet · build-debug · build-clang-tidy · build-clang
Build 64007: arc lint + arc unit

Event Timeline

Fabien requested review of this revision.Thu, Jan 30, 13:37

Failed tests logs:

====== Bitcoin ABC functional tests: abc_p2p_getavaaddr.py ======

------- Stdout: -------
2025-01-30T13:44:12.454000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_🏃_20250130_134410/abc_p2p_getavaaddr_5
2025-01-30T13:44:17.176000Z TestFramework (ERROR): JSONRPC error
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 149, in main
    self._run_test_internal()
  File "/work/test/functional/test_framework/test_framework.py", line 139, in _run_test_internal
    self.run_test()
  File "/work/test/functional/abc_p2p_getavaaddr.py", line 552, in run_test
    self.getavaaddr_interval_test()
  File "/work/test/functional/abc_p2p_getavaaddr.py", line 177, in getavaaddr_interval_test
    self.wait_until(lambda: all_peers_addr_are_relayable(peers))
  File "/work/test/functional/test_framework/test_framework.py", line 871, in wait_until
    return wait_until_helper(
           ^^^^^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/util.py", line 283, in wait_until_helper
    if predicate():
       ^^^^^^^^^^^
  File "/work/test/functional/abc_p2p_getavaaddr.py", line 177, in <lambda>
    self.wait_until(lambda: all_peers_addr_are_relayable(peers))
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/test/functional/abc_p2p_getavaaddr.py", line 144, in all_peers_addr_are_relayable
    return all(
           ^^^^
  File "/work/test/functional/abc_p2p_getavaaddr.py", line 145, in <genexpr>
    node.getavalanchepeerinfo(uint256_hex(p.proof.proofid))[0][
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/coverage.py", line 46, in __call__
    return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/work/test/functional/test_framework/authproxy.py", line 150, in __call__
    raise JSONRPCException(response["error"], status)
test_framework.authproxy.JSONRPCException: Proofid not found (-8)
2025-01-30T13:44:17.345000Z TestFramework (INFO): Stopping nodes
2025-01-30T13:44:17.496000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_🏃_20250130_134410/abc_p2p_getavaaddr_5
2025-01-30T13:44:17.496000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_🏃_20250130_134410/abc_p2p_getavaaddr_5/test_framework.log
2025-01-30T13:44:17.496000Z TestFramework (ERROR): 
2025-01-30T13:44:17.496000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_🏃_20250130_134410/abc_p2p_getavaaddr_5' to consolidate all logs
2025-01-30T13:44:17.496000Z TestFramework (ERROR): 
2025-01-30T13:44:17.496000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2025-01-30T13:44:17.496000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2025-01-30T13:44:17.497000Z TestFramework (ERROR):

Each failure log is accessible here:
Bitcoin ABC functional tests: abc_p2p_getavaaddr.py

PiRK requested changes to this revision.Thu, Jan 30, 14:52
PiRK added a subscriber: PiRK.

The getavalanchepeerinfo errors probably because a proof is not yet registered when it is called.

This revision now requires changes to proceed.Thu, Jan 30, 14:52

Make sure the proofs all exist