Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated fix for refs/heads/Chttp2GracefulGoawayMessages #311

Open
wants to merge 1 commit into
base: Chttp2GracefulGoawayMessages
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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