HomePhabricator

[test refactoring] move AvaP2PInterface to avatools.py

Description

[test refactoring] move AvaP2PInterface to avatools.py

Summary:
This is a first step in refactoring abc_p2p_avalanche.py, because it is testing too many things. The avalanche enabled P2PInterface used in this file will be reused in multiple tests after this is split up into smaller pieces.

This commit does the following:

  • move abc_p2p_avalanche.TestNode to test_framework.avatools.AvaP2PInterface
  • move get_node (previously defined locally in run_tests) to avatools.py and rename it get_ava_p2p_interface
  • initialize the nodeid attribute in AvaP2PInterface.__init__ instead of monkey-patching the object after instantiation. This is a request from the mypy linter, which raised an error because "AvaP2PInterface has no attribute nodeid" when assigning a nodeid in get_ava_p2p_interface

No other code is changed. The behavior is not changed.

Test Plan: ninja check-functional

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

Differential Revision: https://reviews.bitcoinabc.org/D9678

Details

Provenance
PiRKAuthored on Jun 14 2021, 16:18
jasonbcoxPushed on Jun 15 2021, 06:31
Parents
rSTAGINGf9de217f4912: Protect localhost and block-relay-only peers from eviction
Branches
Unknown
Tags
Unknown
References
tag: phabricator/base/28928, tag: phabricator/base/28922

Event Timeline