[test] Disable cq verifier logs for stress test (#33467)

They were tipping this test off into timeout land... but they're proving
useful for non-stress tests, so added an option just for here to
disable.
pull/33470/head
Craig Tiller 1 year ago committed by GitHub
parent ecb7549a99
commit a5272fa3c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      test/core/end2end/cq_verifier.cc
  2. 8
      test/core/end2end/cq_verifier.h
  3. 3
      test/core/iomgr/stranded_event_test.cc

@ -344,8 +344,10 @@ grpc_event CqVerifier::Step(gpr_timespec deadline) {
void CqVerifier::Verify(Duration timeout, SourceLocation location) { void CqVerifier::Verify(Duration timeout, SourceLocation location) {
if (expectations_.empty()) return; if (expectations_.empty()) return;
if (log_verifications_) {
gpr_log(GPR_ERROR, "Verify %s for %s", ToShortString().c_str(), gpr_log(GPR_ERROR, "Verify %s for %s", ToShortString().c_str(),
timeout.ToString().c_str()); timeout.ToString().c_str());
}
const gpr_timespec deadline = const gpr_timespec deadline =
grpc_timeout_milliseconds_to_deadline(timeout.millis()); grpc_timeout_milliseconds_to_deadline(timeout.millis());
while (!expectations_.empty()) { while (!expectations_.empty()) {
@ -402,8 +404,10 @@ bool CqVerifier::AllMaybes() const {
} }
void CqVerifier::VerifyEmpty(Duration timeout, SourceLocation location) { void CqVerifier::VerifyEmpty(Duration timeout, SourceLocation location) {
if (log_verifications_) {
gpr_log(GPR_ERROR, "Verify empty completion queue for %s", gpr_log(GPR_ERROR, "Verify empty completion queue for %s",
timeout.ToString().c_str()); timeout.ToString().c_str());
}
const gpr_timespec deadline = const gpr_timespec deadline =
gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), timeout.as_timespec()); gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), timeout.as_timespec());
GPR_ASSERT(expectations_.empty()); GPR_ASSERT(expectations_.empty());

@ -110,6 +110,13 @@ class CqVerifier {
std::string ToShortString() const; std::string ToShortString() const;
std::vector<std::string> ToShortStrings() const; std::vector<std::string> ToShortStrings() const;
// Logging verifications helps debug CI problems a lot.
// Only disable if the logging prevents a stress test like scenario from
// passing.
void SetLogVerifications(bool log_verifications) {
log_verifications_ = log_verifications;
}
static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); } static void* tag(intptr_t t) { return reinterpret_cast<void*>(t); }
private: private:
@ -134,6 +141,7 @@ class CqVerifier {
absl::AnyInvocable<void( absl::AnyInvocable<void(
grpc_event_engine::experimental::EventEngine::Duration) const> grpc_event_engine::experimental::EventEngine::Duration) const>
step_fn_; step_fn_;
bool log_verifications_ = true;
}; };
} // namespace grpc_core } // namespace grpc_core

@ -102,6 +102,7 @@ void StartCall(TestCall* test_call) {
test_call->call, ops, static_cast<size_t>(op - ops), tag, nullptr); test_call->call, ops, static_cast<size_t>(op - ops), tag, nullptr);
GPR_ASSERT(GRPC_CALL_OK == error); GPR_ASSERT(GRPC_CALL_OK == error);
grpc_core::CqVerifier cqv(test_call->cq); grpc_core::CqVerifier cqv(test_call->cq);
cqv.SetLogVerifications(false);
cqv.Expect(tag, true); cqv.Expect(tag, true);
cqv.Verify(); cqv.Verify();
} }
@ -123,6 +124,7 @@ void SendMessage(grpc_call* call, grpc_completion_queue* cq) {
call, ops, static_cast<size_t>(op - ops), tag, nullptr); call, ops, static_cast<size_t>(op - ops), tag, nullptr);
GPR_ASSERT(GRPC_CALL_OK == error); GPR_ASSERT(GRPC_CALL_OK == error);
grpc_core::CqVerifier cqv(cq); grpc_core::CqVerifier cqv(cq);
cqv.SetLogVerifications(false);
cqv.Expect(tag, true); cqv.Expect(tag, true);
cqv.Verify(); cqv.Verify();
grpc_byte_buffer_destroy(request_payload); grpc_byte_buffer_destroy(request_payload);
@ -143,6 +145,7 @@ void ReceiveMessage(grpc_call* call, grpc_completion_queue* cq) {
call, ops, static_cast<size_t>(op - ops), tag, nullptr); call, ops, static_cast<size_t>(op - ops), tag, nullptr);
GPR_ASSERT(GRPC_CALL_OK == error); GPR_ASSERT(GRPC_CALL_OK == error);
grpc_core::CqVerifier cqv(cq); grpc_core::CqVerifier cqv(cq);
cqv.SetLogVerifications(false);
cqv.Expect(tag, true); cqv.Expect(tag, true);
cqv.Verify(); cqv.Verify();
grpc_byte_buffer_destroy(request_payload); grpc_byte_buffer_destroy(request_payload);

Loading…
Cancel
Save