okio
okio copied to clipboard
ThrottlerTest fails on an OSX Travis box
Example run: https://travis-ci.org/square/okio/builds/526916855
Those tests are time-based which probably causes them to fail on a slow machine. Need to verify their correctness and potentially use a FakeClock
instead of real time to eliminate flakiness.
CC @bnorm
The tests seem to have the tolerance threshold, which even though seems reasonable enough still doesn't prevent tests from failing. It also feels quite large in correlation with the expected timings (e.g. expected is 0.25 millis + threshold of 0.2 millis). Not familiar that well with the applications of Throttler
, so I'm trying to figure out if there's a problem with the implementation, or just imperfect test setup. If it's the latter - we can either just increase the threshold, or do that + increase the test size, so that the existing threshold is smaller as a % of the expected timing and also harder to miss.
Additionally, I'm considering @Ignore
-ing the entire test file to unblock OSX builds on Travis, which unblocks my work on Wire - any objections?
The test takes 8 seconds right now. Lets try multiplying the times by 4 so it takes 32 seconds? If that’s not enough we should give up and be sad.
BTW, we already have a “FakeClock” style test for Throttler in ThrottlerTakeTest. It simulates time to complete instantly.
.... and so perhaps we also migrate say, 10 of the 13 tests in ThrottlerTest to ThrottlerTakeTest so we get a better balance of test execution time vs. coverage.