diff --git a/test/core/end2end/tests/max_connection_age.cc b/test/core/end2end/tests/max_connection_age.cc index f2d0d88a51b..03252855cf1 100644 --- a/test/core/end2end/tests/max_connection_age.cc +++ b/test/core/end2end/tests/max_connection_age.cc @@ -162,10 +162,12 @@ CORE_END2END_TEST(Http2Test, MaxAgeGracefullyClose) { Expect(101, false); } Step(); - // The connection is closed gracefully with goaway, the rpc should still be - // completed. - EXPECT_EQ(server_status.status(), GRPC_STATUS_UNIMPLEMENTED); - EXPECT_EQ(server_status.message(), "xyz"); + if (got_server) { + // The connection is closed gracefully with goaway, the rpc should still be + // completed. + EXPECT_EQ(server_status.status(), GRPC_STATUS_UNIMPLEMENTED); + EXPECT_EQ(server_status.message(), "xyz"); + } } } // namespace