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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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 ↗(On Diff #11247)

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 ↗(On Diff #11247)

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.