0

Remove flakiness from Cast Core gRPC tests.

Due to thread timing, a non-null reactor may be received on the server
side, which is then followed by a proper null-reactor callback. The fix
adjusts for such a behavior.

Bug: 374999320
Change-Id: Ic3b95dddcf8c230da0f69f0672f3065eec8ec51c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5958328
Reviewed-by: Antonio Rivera <antoniori@google.com>
Commit-Queue: Vigen Issahhanjan <vigeni@google.com>
Cr-Commit-Position: refs/heads/main@{#1372974}
This commit is contained in:
Vigen Issahhanjan
2024-10-23 21:59:23 +00:00
committed by Chromium LUCI CQ
parent 7ff58e04b6
commit 7ddcaa33de

@ -230,16 +230,8 @@ TEST_F(GrpcServerStreamingTest, ServerStreamingCallIsCancelledByClient) {
task_environment_.RunUntilIdle();
}
// Flaky on Android and Linux, see https://crbug.com/374999320.
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)
#define MAYBE_ServerStreamingCallIsCancelledByClientInActiveReactor \
DISABLED_ServerStreamingCallIsCancelledByClientInActiveReactor
#else
#define MAYBE_ServerStreamingCallIsCancelledByClientInActiveReactor \
ServerStreamingCallIsCancelledByClientInActiveReactor
#endif
TEST_F(GrpcServerStreamingTest,
MAYBE_ServerStreamingCallIsCancelledByClientInActiveReactor) {
ServerStreamingCallIsCancelledByClientInActiveReactor) {
GrpcServer server;
base::WaitableEvent server_request_received;
@ -275,7 +267,12 @@ TEST_F(GrpcServerStreamingTest,
cancelled_reactor->SetWritesAvailableCallback(base::BindLambdaForTesting(
[&](grpc::Status status,
ServerStreamingServiceHandler::StreamingCall::Reactor* reactor) {
ASSERT_THAT(reactor, IsNull());
if (reactor) {
// Timing between threds may result in server reactor still receiving
// the empty TestResponse from below. Ignore it and continue waiting
// for the null reactor.
return;
}
ASSERT_THAT(status, StatusIs(grpc::StatusCode::ABORTED));
reactor_aborted.Signal();
}));