Eliminate magic #s, follow API

pull/12854/head
Vijay Pai 7 years ago
parent 39f36b4957
commit 541974a709
  1. 85
      test/cpp/end2end/async_end2end_test.cc

@ -537,33 +537,18 @@ TEST_P(AsyncEnd2endTest, SimpleClientStreamingWithCoalescingApi) {
service_->RequestRequestStream(&srv_ctx, &srv_stream, cq_.get(), cq_.get(), service_->RequestRequestStream(&srv_ctx, &srv_stream, cq_.get(), cq_.get(),
tag(2)); tag(2));
auto verif = Verifier(GetParam().disable_blocking);
verif.Expect(2, true);
cli_stream->Write(send_request, tag(3)); cli_stream->Write(send_request, tag(3));
verif.Expect(3, true);
// 65536(64KB) is the default flow control window size. Should change this // Drain tag 2, optional to get tag 3 now
// number when default flow control window size changes. For the write of while (verif.Next(cq_.get(), false) != 2) {
// send_request larger than the flow control window size, tag:3 will not come
// up until server read is initiated. For write of send_request smaller than
// the flow control window size, the request can take the free ride with
// initial metadata due to coalescing, thus write tag:3 will come up here.
if (GetParam().message_content.length() < 65536 || GetParam().inproc) {
Verifier(GetParam().disable_blocking)
.Expect(2, true)
.Expect(3, true)
.Verify(cq_.get());
} else {
Verifier(GetParam().disable_blocking).Expect(2, true).Verify(cq_.get());
} }
srv_stream.Read(&recv_request, tag(4)); srv_stream.Read(&recv_request, tag(4));
verif.Expect(4, true).Verify(cq_.get());
if (GetParam().message_content.length() < 65536 || GetParam().inproc) {
Verifier(GetParam().disable_blocking).Expect(4, true).Verify(cq_.get());
} else {
Verifier(GetParam().disable_blocking)
.Expect(3, true)
.Expect(4, true)
.Verify(cq_.get());
}
EXPECT_EQ(send_request.message(), recv_request.message()); EXPECT_EQ(send_request.message(), recv_request.message());
@ -832,33 +817,19 @@ TEST_P(AsyncEnd2endTest, SimpleBidiStreamingWithCoalescingApiWAF) {
service_->RequestBidiStream(&srv_ctx, &srv_stream, cq_.get(), cq_.get(), service_->RequestBidiStream(&srv_ctx, &srv_stream, cq_.get(), cq_.get(),
tag(2)); tag(2));
auto verif = Verifier(GetParam().disable_blocking);
verif.Expect(2, true);
cli_stream->WriteLast(send_request, WriteOptions(), tag(3)); cli_stream->WriteLast(send_request, WriteOptions(), tag(3));
verif.Expect(3, true);
// 65536(64KB) is the default flow control window size. Should change this // Drain tag 2, optional to get tag 3 now
// number when default flow control window size changes. For the write of while (verif.Next(cq_.get(), false) != 2) {
// send_request larger than the flow control window size, tag:3 will not come
// up until server read is initiated. For write of send_request smaller than
// the flow control window size, the request can take the free ride with
// initial metadata due to coalescing, thus write tag:3 will come up here.
if (GetParam().message_content.length() < 65536 || GetParam().inproc) {
Verifier(GetParam().disable_blocking)
.Expect(2, true)
.Expect(3, true)
.Verify(cq_.get());
} else {
Verifier(GetParam().disable_blocking).Expect(2, true).Verify(cq_.get());
} }
srv_stream.Read(&recv_request, tag(4)); srv_stream.Read(&recv_request, tag(4));
verif.Expect(4, true).Verify(cq_.get());
if (GetParam().message_content.length() < 65536 || GetParam().inproc) {
Verifier(GetParam().disable_blocking).Expect(4, true).Verify(cq_.get());
} else {
Verifier(GetParam().disable_blocking)
.Expect(3, true)
.Expect(4, true)
.Verify(cq_.get());
}
EXPECT_EQ(send_request.message(), recv_request.message()); EXPECT_EQ(send_request.message(), recv_request.message());
srv_stream.Read(&recv_request, tag(5)); srv_stream.Read(&recv_request, tag(5));
@ -900,33 +871,19 @@ TEST_P(AsyncEnd2endTest, SimpleBidiStreamingWithCoalescingApiWL) {
service_->RequestBidiStream(&srv_ctx, &srv_stream, cq_.get(), cq_.get(), service_->RequestBidiStream(&srv_ctx, &srv_stream, cq_.get(), cq_.get(),
tag(2)); tag(2));
auto verif = Verifier(GetParam().disable_blocking);
verif.Expect(2, true);
cli_stream->WriteLast(send_request, WriteOptions(), tag(3)); cli_stream->WriteLast(send_request, WriteOptions(), tag(3));
verif.Expect(3, true);
// 65536(64KB) is the default flow control window size. Should change this // Drain tag 2, optional to get tag 3 now
// number when default flow control window size changes. For the write of while (verif.Next(cq_.get(), false) != 2) {
// send_request larger than the flow control window size, tag:3 will not come
// up until server read is initiated. For write of send_request smaller than
// the flow control window size, the request can take the free ride with
// initial metadata due to coalescing, thus write tag:3 will come up here.
if (GetParam().message_content.length() < 65536 || GetParam().inproc) {
Verifier(GetParam().disable_blocking)
.Expect(2, true)
.Expect(3, true)
.Verify(cq_.get());
} else {
Verifier(GetParam().disable_blocking).Expect(2, true).Verify(cq_.get());
} }
srv_stream.Read(&recv_request, tag(4)); srv_stream.Read(&recv_request, tag(4));
verif.Expect(4, true).Verify(cq_.get());
if (GetParam().message_content.length() < 65536 || GetParam().inproc) {
Verifier(GetParam().disable_blocking).Expect(4, true).Verify(cq_.get());
} else {
Verifier(GetParam().disable_blocking)
.Expect(3, true)
.Expect(4, true)
.Verify(cq_.get());
}
EXPECT_EQ(send_request.message(), recv_request.message()); EXPECT_EQ(send_request.message(), recv_request.message());
srv_stream.Read(&recv_request, tag(5)); srv_stream.Read(&recv_request, tag(5));

Loading…
Cancel
Save