Skip to content

Commit

Permalink
Sanitize
Browse files Browse the repository at this point in the history
  • Loading branch information
yashykt committed Jan 23, 2025
1 parent 5285c1b commit baf55d3
Showing 1 changed file with 21 additions and 28 deletions.
49 changes: 21 additions & 28 deletions test/core/transport/chttp2/graceful_shutdown_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -312,19 +312,17 @@ TEST_F(GracefulShutdownTest, GracefulGoaway) {
// Initiate shutdown on the server
grpc_server_shutdown_and_notify(server_, cq_, Tag(1));
// Wait for first goaway
WaitForGoaway(
(1u << 31) - 1, /*error_code=*/0,
/*message=*/
grpc_core::Slice::FromStaticString("Server shutdown").TakeCSlice());
WaitForGoaway((1u << 31) - 1, /*error_code=*/0,
/*message=*/
Slice::FromStaticString("Server shutdown").TakeCSlice());
// Wait for the ping
uint64_t ping_id = WaitForPing();
// Reply to the ping
SendPingAck(ping_id);
// Wait for final goaway
WaitForGoaway(
0, /*error_code=*/0,
/*message=*/
grpc_core::Slice::FromStaticString("Server shutdown").TakeCSlice());
WaitForGoaway(0, /*error_code=*/0,
/*message=*/
Slice::FromStaticString("Server shutdown").TakeCSlice());
// The shutdown should successfully complete.
cqv_->Expect(Tag(1), true);
cqv_->Verify();
Expand All @@ -343,10 +341,9 @@ TEST_F(GracefulShutdownTest, RequestStartedBeforeFinalGoaway) {
// Initiate shutdown on the server
grpc_server_shutdown_and_notify(server_, cq_, Tag(1));
// Wait for first goaway
WaitForGoaway(
(1u << 31) - 1, /*error_code=*/0,
/*message=*/
grpc_core::Slice::FromStaticString("Server shutdown").TakeCSlice());
WaitForGoaway((1u << 31) - 1, /*error_code=*/0,
/*message=*/
Slice::FromStaticString("Server shutdown").TakeCSlice());
// Wait for the ping
uint64_t ping_id = WaitForPing();
// Start a request
Expand All @@ -367,10 +364,9 @@ TEST_F(GracefulShutdownTest, RequestStartedBeforeFinalGoaway) {
SendPingAck(ping_id);
// Wait for final goaway with last stream ID 1 to show that the HTTP2
// transport accepted the stream.
WaitForGoaway(
1, /*error_code=*/0,
/*message=*/
grpc_core::Slice::FromStaticString("Server shutdown").TakeCSlice());
WaitForGoaway(1, /*error_code=*/0,
/*message=*/
Slice::FromStaticString("Server shutdown").TakeCSlice());
// TODO(yashykt): The surface layer automatically cancels calls received after
// shutdown has been called. Once that is fixed, this should be a success.
cqv_->Expect(Tag(100), false);
Expand Down Expand Up @@ -413,19 +409,17 @@ TEST_F(GracefulShutdownTest, RequestStartedAfterFinalGoawayIsIgnored) {
// Initiate shutdown on the server
grpc_server_shutdown_and_notify(server_, cq_, Tag(1));
// Wait for first goaway
WaitForGoaway(
(1u << 31) - 1, /*error_code=*/0,
/*message=*/
grpc_core::Slice::FromStaticString("Server shutdown").TakeCSlice());
WaitForGoaway((1u << 31) - 1, /*error_code=*/0,
/*message=*/
Slice::FromStaticString("Server shutdown").TakeCSlice());
// Wait for the ping
uint64_t ping_id = WaitForPing();
// Reply to the ping
SendPingAck(ping_id);
// Wait for final goaway
WaitForGoaway(
1, /*error_code=*/0,
/*message=*/
grpc_core::Slice::FromStaticString("Server shutdown").TakeCSlice());
WaitForGoaway(1, /*error_code=*/0,
/*message=*/
Slice::FromStaticString("Server shutdown").TakeCSlice());

// Send another request from the client which should be ignored.
constexpr char kNewRequestFrame[] =
Expand Down Expand Up @@ -485,10 +479,9 @@ TEST_F(GracefulShutdownTest, UnresponsiveClient) {
// Initiate shutdown on the server
grpc_server_shutdown_and_notify(server_, cq_, Tag(1));
// Wait for first goaway
WaitForGoaway(
(1u << 31) - 1, /*error_code=*/0,
/*message=*/
grpc_core::Slice::FromStaticString("Server shutdown").TakeCSlice());
WaitForGoaway((1u << 31) - 1, /*error_code=*/0,
/*message=*/
Slice::FromStaticString("Server shutdown").TakeCSlice());
// Wait for the ping
std::ignore = WaitForPing();
// Wait for final goaway without sending a ping ACK.
Expand Down

0 comments on commit baf55d3

Please sign in to comment.