[fuzzing] Add ability to listen to ports to api-fuzzer (#35273)

Unsure when this got dropped!

Closes #35273

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35273 from ctiller:server-port be94e30a06
PiperOrigin-RevId: 589919718
pull/35278/head
Craig Tiller 12 months ago committed by Copybara-Service
parent 57dacad8c7
commit 2b1d06f037
  1. 18
      test/core/end2end/fuzzers/api_fuzzer.cc
  2. 13
      test/core/end2end/fuzzers/api_fuzzer.proto

@ -369,6 +369,18 @@ static grpc_channel_credentials* ReadChannelCreds(
}
}
static grpc_server_credentials* ReadServerCreds(
const api_fuzzer::ServerCreds& creds) {
switch (creds.type_case()) {
case api_fuzzer::ServerCreds::TYPE_NOT_SET:
return nullptr;
case api_fuzzer::ServerCreds::kInsecureCreds:
return grpc_insecure_server_credentials_create();
case api_fuzzer::ServerCreds::kNull:
return nullptr;
}
}
namespace grpc_core {
namespace testing {
@ -428,6 +440,12 @@ ApiFuzzer::Result ApiFuzzer::CreateServer(
server_ = grpc_server_create(args.ToC().get(), nullptr);
GPR_ASSERT(server_ != nullptr);
grpc_server_register_completion_queue(server_, cq(), nullptr);
for (const auto& http2_port : create_server.http2_ports()) {
auto* creds = ReadServerCreds(http2_port.server_creds());
auto addr = absl::StrCat("localhost:", http2_port.port());
grpc_server_add_http2_port(server_, addr.c_str(), creds);
grpc_server_credentials_release(creds);
}
grpc_server_start(server_);
ResetServerState();
} else {

@ -78,6 +78,13 @@ message ChannelCreds {
}
}
message ServerCreds {
oneof type {
Empty insecure_creds = 1;
Empty null = 2;
}
}
message Metadatum {
StringSlice key = 1;
ByteSlice value = 2;
@ -89,8 +96,14 @@ message CreateChannel {
ChannelCreds channel_creds = 3;
}
message Http2ServerPort {
int32 port = 1;
ServerCreds server_creds = 2;
}
message CreateServer {
grpc.testing.FuzzingChannelArgs channel_args = 1;
repeated Http2ServerPort http2_ports = 2;
}
message CreateCall {

Loading…
Cancel
Save