enable retry proxy tests (#26425)

* Use trailers_only info to guide proxy

* Mark 1 test still unproxyable

* enable retry_too_many_attempts proxy test

* disable retries in proxy

* clang-format

Co-authored-by: Vijay Pai <vpai@google.com>
pull/26442/head
Mark D. Roth 4 years ago committed by GitHub
parent 2f4bc01ab2
commit e8239ceb1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 43
      test/core/end2end/fixtures/proxy.cc
  2. 70
      test/core/end2end/generate_tests.bzl

@ -28,6 +28,7 @@
#include "src/core/lib/gprpp/host_port.h"
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/surface/call.h"
#include "test/core/util/port.h"
struct grpc_end2end_proxy {
@ -99,7 +100,16 @@ grpc_end2end_proxy* grpc_end2end_proxy_create(const grpc_end2end_proxy_def* def,
proxy->cq = grpc_completion_queue_create_for_next(nullptr);
proxy->server = def->create_server(proxy->proxy_port.c_str(), server_args);
proxy->client = def->create_client(proxy->server_port.c_str(), client_args);
const char* arg_to_remove = GRPC_ARG_ENABLE_RETRIES;
grpc_arg arg_to_add = grpc_channel_arg_integer_create(
const_cast<char*>(GRPC_ARG_ENABLE_RETRIES), 0);
grpc_channel_args* proxy_client_args =
grpc_channel_args_copy_and_add_and_remove(client_args, &arg_to_remove, 1,
&arg_to_add, 1);
proxy->client =
def->create_client(proxy->server_port.c_str(), proxy_client_args);
grpc_channel_args_destroy(proxy_client_args);
grpc_server_register_completion_queue(proxy->server, proxy->cq, nullptr);
grpc_server_start(proxy->server);
@ -164,7 +174,7 @@ static void on_p2s_recv_initial_metadata(void* arg, int /*success*/) {
grpc_call_error err;
memset(&op, 0, sizeof(op));
if (!pc->proxy->shutdown) {
if (!pc->proxy->shutdown && !grpc_call_is_trailers_only(pc->p2s)) {
op.op = GRPC_OP_SEND_INITIAL_METADATA;
op.flags = 0;
op.reserved = nullptr;
@ -294,22 +304,33 @@ static void on_c2p_sent_status(void* arg, int /*success*/) {
static void on_p2s_status(void* arg, int success) {
proxy_call* pc = static_cast<proxy_call*>(arg);
grpc_op op;
grpc_op op[2]; // Possibly send empty initial metadata also if trailers-only
grpc_call_error err;
memset(op, 0, sizeof(op));
if (!pc->proxy->shutdown) {
GPR_ASSERT(success);
op.op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op.flags = 0;
op.reserved = nullptr;
op.data.send_status_from_server.trailing_metadata_count =
int op_count = 0;
if (grpc_call_is_trailers_only(pc->p2s)) {
op[op_count].op = GRPC_OP_SEND_INITIAL_METADATA;
op_count++;
}
op[op_count].op = GRPC_OP_SEND_STATUS_FROM_SERVER;
op[op_count].flags = 0;
op[op_count].reserved = nullptr;
op[op_count].data.send_status_from_server.trailing_metadata_count =
pc->p2s_trailing_metadata.count;
op.data.send_status_from_server.trailing_metadata =
op[op_count].data.send_status_from_server.trailing_metadata =
pc->p2s_trailing_metadata.metadata;
op.data.send_status_from_server.status = pc->p2s_status;
op.data.send_status_from_server.status_details = &pc->p2s_status_details;
op[op_count].data.send_status_from_server.status = pc->p2s_status;
op[op_count].data.send_status_from_server.status_details =
&pc->p2s_status_details;
op_count++;
refpc(pc, "on_c2p_sent_status");
err = grpc_call_start_batch(pc->c2p, &op, 1,
err = grpc_call_start_batch(pc->c2p, op, op_count,
new_closure(on_c2p_sent_status, pc), nullptr);
GPR_ASSERT(err == GRPC_CALL_OK);
}

@ -272,89 +272,47 @@ END2END_TESTS = {
"registered_call": _test_options(),
"request_with_flags": _test_options(proxyable = False),
"request_with_payload": _test_options(),
# TODO(roth): Remove proxyable=False for all retry tests once we
# have a way for the proxy to propagate the fact that trailing
# metadata is available when initial metadata is returned.
# See https://github.com/grpc/grpc/issues/14467 for context.
"retry": _test_options(needs_client_channel = True, proxyable = False),
"retry_cancellation": _test_options(
needs_client_channel = True,
proxyable = False,
),
"retry_cancel_during_delay": _test_options(
needs_client_channel = True,
proxyable = False,
),
"retry_disabled": _test_options(needs_client_channel = True, proxyable = False),
"retry": _test_options(needs_client_channel = True),
"retry_cancellation": _test_options(needs_client_channel = True),
"retry_cancel_during_delay": _test_options(needs_client_channel = True),
"retry_disabled": _test_options(needs_client_channel = True),
"retry_exceeds_buffer_size_in_delay": _test_options(
needs_client_channel = True,
proxyable = False,
),
"retry_exceeds_buffer_size_in_initial_batch": _test_options(
needs_client_channel = True,
proxyable = False,
# TODO(jtattermusch): too long bazel test name makes the test flaky on Windows RBE
# See b/151617965
short_name = "retry_exceeds_buffer_size_in_init",
),
"retry_exceeds_buffer_size_in_subsequent_batch": _test_options(
needs_client_channel = True,
proxyable = False,
# TODO(jtattermusch): too long bazel test name makes the test flaky on Windows RBE
# See b/151617965
short_name = "retry_exceeds_buffer_size_in_subseq",
),
"retry_lb_drop": _test_options(
needs_client_channel = True,
proxyable = False,
),
"retry_non_retriable_status": _test_options(
needs_client_channel = True,
proxyable = False,
),
"retry_lb_drop": _test_options(needs_client_channel = True),
"retry_non_retriable_status": _test_options(needs_client_channel = True),
"retry_non_retriable_status_before_recv_trailing_metadata_started": _test_options(
needs_client_channel = True,
proxyable = False,
# TODO(jtattermusch): too long bazel test name makes the test flaky on Windows RBE
# See b/151617965
short_name = "retry_non_retriable_status2",
),
"retry_recv_initial_metadata": _test_options(
needs_client_channel = True,
proxyable = False,
),
"retry_recv_message": _test_options(
needs_client_channel = True,
proxyable = False,
),
"retry_server_pushback_delay": _test_options(
needs_client_channel = True,
proxyable = False,
),
"retry_server_pushback_disabled": _test_options(
needs_client_channel = True,
proxyable = False,
),
"retry_streaming": _test_options(needs_client_channel = True, proxyable = False),
"retry_streaming_after_commit": _test_options(
needs_client_channel = True,
proxyable = False,
),
"retry_recv_initial_metadata": _test_options(needs_client_channel = True),
"retry_recv_message": _test_options(needs_client_channel = True),
"retry_server_pushback_delay": _test_options(needs_client_channel = True),
"retry_server_pushback_disabled": _test_options(needs_client_channel = True),
"retry_streaming": _test_options(needs_client_channel = True),
"retry_streaming_after_commit": _test_options(needs_client_channel = True),
"retry_streaming_succeeds_before_replay_finished": _test_options(
needs_client_channel = True,
proxyable = False,
# TODO(jtattermusch): too long bazel test name makes the test flaky on Windows RBE
# See b/151617965
short_name = "retry_streaming2",
),
"retry_throttled": _test_options(
needs_client_channel = True,
proxyable = False,
),
"retry_too_many_attempts": _test_options(
needs_client_channel = True,
proxyable = False,
),
"retry_throttled": _test_options(needs_client_channel = True),
"retry_too_many_attempts": _test_options(needs_client_channel = True),
"server_finishes_request": _test_options(),
"server_streaming": _test_options(needs_http2 = True),
"shutdown_finishes_calls": _test_options(),

Loading…
Cancel
Save