Page MenuHomePhabricator

Improve reliability of avalanche test
ClosedPublic

Authored by deadalnix on Sep 12 2019, 16:08.

Details

Summary

It tends to be flacky because the loop tend to take too long to run when the system is uner load. This bails the loop when it took too long instead of failing the test.

Test Plan

Run the test multiple times in parallel.

Diff Detail

Repository
rABC Bitcoin ABC
Branch
avatest
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 7424
Build 12891: Bitcoin ABC Buildbot (legacy)
Build 12890: arc lint + arc unit

Event Timeline

jasonbcox requested changes to this revision.Sep 12 2019, 16:25
jasonbcox added a subscriber: jasonbcox.
jasonbcox added inline comments.
src/test/avalanche_tests.cpp
637

This can theoretically infinite-loop if something goes wrong. Something like this will be more robust and still retain the retry mechanism that you added:

for (int i = 0; i < maxTries; i++) {
    if (maxTries * timeout > std::chrono::seconds(10)) { throw ... } // Something is clearly wrong if maxTries gets too big. I used a timescale here to help pick a sane value for "too big".
    ...
    if (...) {
        maxTries++;
    }
646

use timeout here

This revision now requires changes to proceed.Sep 12 2019, 16:25
This revision is now accepted and ready to land.Sep 13 2019, 16:48
This revision was automatically updated to reflect the committed changes.