Commit d324a0d9 authored by Nicholas Ormrod's avatar Nicholas Ormrod Committed by Facebook GitHub Bot

Fix flakey test

Summary: EventBaseTest/EventBaseTest/0.IdleTime fails under load. Remedy this.

Reviewed By: yfeldblum

Differential Revision: D32965908

fbshipit-source-id: 7f592b6867b9904fe2e2ae83b53e63398d39f9eb
parent 8bdd2efd
......@@ -1942,20 +1942,13 @@ TYPED_TEST_P(EventBaseTest, IdleTime) {
int latencyCallbacks = 0;
eventBase.setMaxLatency(std::chrono::microseconds(6000), [&]() {
++latencyCallbacks;
if (latencyCallbacks != 1) {
FAIL() << "Unexpected latency callback";
}
if (tos0.getTimeouts() < 6) {
if (latencyCallbacks != 1 || tos0.getTimeouts() < 6) {
// This could only happen if the host this test is running
// on is heavily loaded.
int64_t usElapsed = std::chrono::duration_cast<std::chrono::microseconds>(
std::chrono::steady_clock::now() - testStart)
.count();
EXPECT_LE(43800, usElapsed);
hostOverloaded = true;
return;
}
EXPECT_EQ(6, tos0.getTimeouts());
EXPECT_GE(6100, eventBase.getAvgLoopTime() - 1200);
EXPECT_LE(6100, eventBase.getAvgLoopTime() + 1200);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment