From c2d2220ba50b8c56bb963b6ec79c0b86507946a1 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Fri, 14 Aug 2020 10:30:48 -0700 Subject: [PATCH] Make MaybeExpect guarantee at-most-once and allow Verify reuse --- test/cpp/end2end/async_end2end_test.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index a91a0027afd..39bab5be2bd 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -120,6 +120,7 @@ class Verifier { while (!expectations_.empty()) { Next(cq, ignore_ok); } + maybe_expectations_.clear(); } // This version of Verify stops after a certain deadline @@ -139,6 +140,7 @@ class Verifier { GotTag(got_tag, ok, false); } } + maybe_expectations_.clear(); } // This version of Verify stops after a certain deadline, and uses the @@ -161,6 +163,7 @@ class Verifier { GotTag(got_tag, ok, false); } } + maybe_expectations_.clear(); } private: @@ -181,6 +184,7 @@ class Verifier { if (!ignore_ok) { EXPECT_EQ(it2->second.ok, ok); } + maybe_expectations_.erase(it2); } else { gpr_log(GPR_ERROR, "Unexpected tag: %p", got_tag); abort();