Fix check in channel.cc and tweak direct channel tests

reviewable/pr14615/r6
David Garcia Quintas 7 years ago
parent 2040ae1ff4
commit f73e76d596
  1. 2
      src/core/lib/surface/channel.cc
  2. 9
      test/core/end2end/fixtures/h2_sockpair+trace.cc
  3. 8
      test/core/end2end/fixtures/h2_sockpair.cc
  4. 8
      test/core/end2end/fixtures/h2_sockpair_1byte.cc
  5. 9
      test/core/end2end/fuzzers/client_fuzzer.cc

@ -156,7 +156,7 @@ static grpc_core::UniquePtr<char> get_default_authority(
default_authority.reset(gpr_strdup(ssl_override));
}
if (channel_stack_type == GRPC_CLIENT_DIRECT_CHANNEL &&
default_authority == nullptr) {
!has_default_authority) {
gpr_log(GPR_ERROR,
"Direct channels must specify a value for the "
"GRPC_ARG_DEFAULT_AUTHORITY channel arg.");

@ -63,9 +63,14 @@ typedef struct {
static void client_setup_transport(void* ts, grpc_transport* transport) {
sp_client_setup* cs = static_cast<sp_client_setup*>(ts);
cs->f->client = grpc_channel_create("socketpair-target", cs->client_args,
grpc_arg authority_arg = grpc_channel_arg_string_create(
const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY),
const_cast<char*>("test-authority"));
grpc_channel_args* args =
grpc_channel_args_copy_and_add(cs->client_args, &authority_arg, 1);
cs->f->client = grpc_channel_create("socketpair-target", args,
GRPC_CLIENT_DIRECT_CHANNEL, transport);
grpc_channel_args_destroy(args);
}
static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(

@ -58,8 +58,14 @@ typedef struct {
static void client_setup_transport(void* ts, grpc_transport* transport) {
sp_client_setup* cs = static_cast<sp_client_setup*>(ts);
cs->f->client = grpc_channel_create("socketpair-target", cs->client_args,
grpc_arg authority_arg = grpc_channel_arg_string_create(
const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY),
const_cast<char*>("test-authority"));
grpc_channel_args* args =
grpc_channel_args_copy_and_add(cs->client_args, &authority_arg, 1);
cs->f->client = grpc_channel_create("socketpair-target", args,
GRPC_CLIENT_DIRECT_CHANNEL, transport);
grpc_channel_args_destroy(args);
}
static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(

@ -58,8 +58,14 @@ typedef struct {
static void client_setup_transport(void* ts, grpc_transport* transport) {
sp_client_setup* cs = static_cast<sp_client_setup*>(ts);
cs->f->client = grpc_channel_create("socketpair-target", cs->client_args,
grpc_arg authority_arg = grpc_channel_arg_string_create(
const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY),
const_cast<char*>("test-authority"));
grpc_channel_args* args =
grpc_channel_args_copy_and_add(cs->client_args, &authority_arg, 1);
cs->f->client = grpc_channel_create("socketpair-target", args,
GRPC_CLIENT_DIRECT_CHANNEL, transport);
grpc_channel_args_destroy(args);
}
static grpc_end2end_test_fixture chttp2_create_fixture_socketpair(

@ -20,6 +20,7 @@
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/iomgr/executor.h"
@ -58,8 +59,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
grpc_create_chttp2_transport(nullptr, mock_endpoint, true);
grpc_chttp2_transport_start_reading(transport, nullptr, nullptr);
grpc_arg authority_arg = grpc_channel_arg_string_create(
const_cast<char*>(GRPC_ARG_DEFAULT_AUTHORITY),
const_cast<char*>("test-authority"));
grpc_channel_args* args =
grpc_channel_args_copy_and_add(nullptr, &authority_arg, 1);
grpc_channel* channel = grpc_channel_create(
"test-target", nullptr, GRPC_CLIENT_DIRECT_CHANNEL, transport);
"test-target", args, GRPC_CLIENT_DIRECT_CHANNEL, transport);
grpc_channel_args_destroy(args);
grpc_slice host = grpc_slice_from_static_string("localhost");
grpc_call* call = grpc_channel_create_call(
channel, nullptr, 0, cq, grpc_slice_from_static_string("/foo"), &host,

Loading…
Cancel
Save