okio icon indicating copy to clipboard operation
okio copied to clipboard

ThrottlerTest fails on an OSX Travis box

Open Egorand opened this issue 5 years ago • 5 comments

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.

Egorand avatar May 04 '19 21:05 Egorand

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.

Egorand avatar May 07 '19 14:05 Egorand

Additionally, I'm considering @Ignore-ing the entire test file to unblock OSX builds on Travis, which unblocks my work on Wire - any objections?

Egorand avatar May 07 '19 14:05 Egorand

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.

swankjesse avatar May 07 '19 14:05 swankjesse

BTW, we already have a “FakeClock” style test for Throttler in ThrottlerTakeTest. It simulates time to complete instantly.

swankjesse avatar May 07 '19 14:05 swankjesse

.... 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.

swankjesse avatar May 07 '19 14:05 swankjesse