Skip to content

Commit

Permalink
Merge #2916: [Test] speed un tiertwo_governance_sync_basic
Browse files Browse the repository at this point in the history
471cae3 Do not sleep after staking and after sending pings (ale)

Pull request description:

  `tiertwo_governance_sync_basic` is by far the slowest test that we have. Profiling showed that most of the time was spent in the function stake() which slept for a total of 2 seconds in each call.

  Those 2 seconds sleep were actually useless and have been removed.
  With this simple change the total running time of the test on my machine dropped from `15` minutes to only `6` minutes.

  To prove that indeed sleeping was useless I tried to run the same test in parallel 15 times, and it never failed, see here:
  https://github.com/panleone/PIVX/actions/runs/8420343441

ACKs for top commit: 471cae3
  Duddino:
    utACK 471cae3
  Liquid369:
    tACK 471cae3
  Fuzzbawls:
    ACK 471cae3

Tree-SHA512: 6b00a18c7edd6dffaf9c5df3f53c8481c4312f7d8a63819010289c17b5ab7715aeafb901c8da885515fa59a093ab6e101c572972823ac2ca5e5c53139921f063
  • Loading branch information
Fuzzbawls committed Apr 2, 2024
2 parents d75c161 + 471cae3 commit e4f61cd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 0 additions & 2 deletions test/functional/test_framework/test_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -1054,14 +1054,12 @@ def send_pings(self, mnodes):
node.mnping()["sent"]
except:
pass
time.sleep(1)


def stake_and_sync(self, node_id, num_blocks):
for i in range(num_blocks):
self.mocktime = self.generate_pos(node_id, self.mocktime)
self.sync_blocks()
time.sleep(1)


def stake_and_ping(self, node_id, num_blocks, with_ping_mns=None):
Expand Down
1 change: 1 addition & 0 deletions test/functional/tiertwo_governance_sync_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ def run_test(self):
self.ownerTwo.setmocktime(self.mocktime)
self.connect_to_all(self.ownerTwoPos)
self.stake(2, [self.remoteOne, self.remoteTwo])
time.sleep(5) # wait a little bit

self.log.info("syncing node..")
self.wait_until_mnsync_finished()
Expand Down

0 comments on commit e4f61cd

Please sign in to comment.