Skip to content

Commit 7bc210e

Browse files
alyssawilkhtuch
authored andcommitted
test: fixing interactions between waitFor and ignore_spurious_events (#4309)
Making sure if waitForHalfClose stops waiting due to the short waitFor timeout of 5ms, rather than a spurious event occurring, that the test continues waiting for half close. Risk Level: low (test only) Testing: tcp_proxy_integration_testx1000 test/integration:all x1 Docs Changes: n./a Release Notes: n/a Fixes #4031 Signed-off-by: Alyssa Wilk <[email protected]>
1 parent 69474b3 commit 7bc210e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/integration/fake_upstream.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,13 +276,13 @@ AssertionResult FakeConnectionBase::waitForHalfClose(bool ignore_spurious_events
276276
if (std::chrono::steady_clock::now() >= end_time) {
277277
return AssertionFailure() << "Timed out waiting for half close.";
278278
}
279-
connection_event_.waitFor(lock_, 5ms); // Safe since CondVar::waitFor won't throw.
279+
Thread::CondVar::WaitStatus status = connection_event_.waitFor(lock_, 5ms);
280280
// The default behavior of waitForHalfClose is to assume the test cleanly
281281
// calls waitForData, waitForNewStream, etc. to handle all events on the
282282
// connection. If the caller explicitly notes that other events should be
283283
// ignored, continue looping until a disconnect is detected. Otherwise fall
284284
// through and hit the assert below.
285-
if (!ignore_spurious_events) {
285+
if (status == Thread::CondVar::WaitStatus::NoTimeout && !ignore_spurious_events) {
286286
break;
287287
}
288288
}

0 commit comments

Comments
 (0)