service_config_end2end_test.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2016 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #include <algorithm>
20 #include <memory>
21 #include <mutex>
22 #include <random>
23 #include <set>
24 #include <string>
25 #include <thread>
26 
27 #include <gmock/gmock.h>
28 #include <gtest/gtest.h>
29 
30 #include "absl/memory/memory.h"
31 #include "absl/strings/str_cat.h"
32 
33 #include <grpc/grpc.h>
34 #include <grpc/support/alloc.h>
35 #include <grpc/support/atm.h>
36 #include <grpc/support/log.h>
37 #include <grpc/support/time.h>
38 #include <grpcpp/channel.h>
39 #include <grpcpp/client_context.h>
40 #include <grpcpp/create_channel.h>
43 #include <grpcpp/server.h>
44 #include <grpcpp/server_builder.h>
46 
62 #include "src/proto/grpc/testing/echo.grpc.pb.h"
63 #include "test/core/util/port.h"
67 
68 using grpc::testing::EchoRequest;
69 using grpc::testing::EchoResponse;
70 
71 namespace grpc {
72 namespace testing {
73 namespace {
74 
75 // Subclass of TestServiceImpl that increments a request counter for
76 // every call to the Echo RPC.
77 class MyTestServiceImpl : public TestServiceImpl {
78  public:
79  MyTestServiceImpl() : request_count_(0) {}
80 
81  Status Echo(ServerContext* context, const EchoRequest* request,
82  EchoResponse* response) override {
83  {
86  }
87  AddClient(context->peer());
89  }
90 
91  int request_count() {
93  return request_count_;
94  }
95 
96  void ResetCounters() {
98  request_count_ = 0;
99  }
100 
101  std::set<std::string> clients() {
103  return clients_;
104  }
105 
106  private:
107  void AddClient(const std::string& client) {
109  clients_.insert(client);
110  }
111 
115  std::set<std::string> clients_;
116 };
117 
118 class ServiceConfigEnd2endTest : public ::testing::Test {
119  protected:
120  ServiceConfigEnd2endTest()
121  : server_host_("localhost"),
122  kRequestMessage_("Live long and prosper."),
123  creds_(new SecureChannelCredentials(
125 
126  static void SetUpTestCase() {
127  // Make the backup poller poll very frequently in order to pick up
128  // updates from all the subchannels's FDs.
129  GPR_GLOBAL_CONFIG_SET(grpc_client_channel_backup_poll_interval_ms, 1);
130  }
131 
132  void SetUp() override {
133  grpc_init();
135  grpc_core::MakeRefCounted<grpc_core::FakeResolverResponseGenerator>();
136  bool localhost_resolves_to_ipv4 = false;
137  bool localhost_resolves_to_ipv6 = false;
138  grpc_core::LocalhostResolves(&localhost_resolves_to_ipv4,
139  &localhost_resolves_to_ipv6);
140  ipv6_only_ = !localhost_resolves_to_ipv4 && localhost_resolves_to_ipv6;
141  }
142 
143  void TearDown() override {
144  for (size_t i = 0; i < servers_.size(); ++i) {
145  servers_[i]->Shutdown();
146  }
147  // Explicitly destroy all the members so that we can make sure grpc_shutdown
148  // has finished by the end of this function, and thus all the registered
149  // LB policy factories are removed.
150  stub_.reset();
151  servers_.clear();
152  creds_.reset();
153  grpc_shutdown();
154  }
155 
156  void CreateServers(size_t num_servers,
157  std::vector<int> ports = std::vector<int>()) {
158  servers_.clear();
159  for (size_t i = 0; i < num_servers; ++i) {
160  int port = 0;
161  if (ports.size() == num_servers) port = ports[i];
162  servers_.emplace_back(new ServerData(port));
163  }
164  }
165 
166  void StartServer(size_t index) { servers_[index]->Start(server_host_); }
167 
168  void StartServers(size_t num_servers,
169  std::vector<int> ports = std::vector<int>()) {
170  CreateServers(num_servers, std::move(ports));
171  for (size_t i = 0; i < num_servers; ++i) {
172  StartServer(i);
173  }
174  }
175 
176  grpc_core::Resolver::Result BuildFakeResults(const std::vector<int>& ports) {
178  result.addresses = grpc_core::ServerAddressList();
179  for (const int& port : ports) {
180  std::string lb_uri_str =
181  absl::StrCat(ipv6_only_ ? "ipv6:[::1]:" : "ipv4:127.0.0.1:", port);
183  GPR_ASSERT(lb_uri.ok());
184  grpc_resolved_address address;
185  GPR_ASSERT(grpc_parse_uri(*lb_uri, &address));
186  result.addresses->emplace_back(address.addr, address.len,
187  nullptr /* args */);
188  }
189  return result;
190  }
191 
192  void SetNextResolutionNoServiceConfig(const std::vector<int>& ports) {
194  grpc_core::Resolver::Result result = BuildFakeResults(ports);
196  }
197 
198  void SetNextResolutionValidServiceConfig(const std::vector<int>& ports) {
200  grpc_core::Resolver::Result result = BuildFakeResults(ports);
202  result.service_config =
206  }
207 
208  void SetNextResolutionInvalidServiceConfig(const std::vector<int>& ports) {
210  grpc_core::Resolver::Result result = BuildFakeResults(ports);
211  result.service_config =
212  absl::InvalidArgumentError("error parsing service config");
214  }
215 
216  void SetNextResolutionWithServiceConfig(const std::vector<int>& ports,
217  const char* svc_cfg) {
219  grpc_core::Resolver::Result result = BuildFakeResults(ports);
221  result.service_config =
222  grpc_core::ServiceConfigImpl::Create(nullptr, svc_cfg, &error);
223  if (!GRPC_ERROR_IS_NONE(error)) {
224  result.service_config = grpc_error_to_absl_status(error);
226  }
228  }
229 
230  std::vector<int> GetServersPorts(size_t start_index = 0) {
231  std::vector<int> ports;
232  for (size_t i = start_index; i < servers_.size(); ++i) {
233  ports.push_back(servers_[i]->port_);
234  }
235  return ports;
236  }
237 
238  std::unique_ptr<grpc::testing::EchoTestService::Stub> BuildStub(
239  const std::shared_ptr<Channel>& channel) {
240  return grpc::testing::EchoTestService::NewStub(channel);
241  }
242 
243  std::shared_ptr<Channel> BuildChannel() {
244  ChannelArguments args;
247  return grpc::CreateCustomChannel("fake:///", creds_, args);
248  }
249 
250  std::shared_ptr<Channel> BuildChannelWithDefaultServiceConfig() {
251  ChannelArguments args;
253  ValidDefaultServiceConfig()),
254  ::testing::StrEq(""));
255  args.SetServiceConfigJSON(ValidDefaultServiceConfig());
258  return grpc::CreateCustomChannel("fake:///", creds_, args);
259  }
260 
261  std::shared_ptr<Channel> BuildChannelWithInvalidDefaultServiceConfig() {
262  ChannelArguments args;
264  InvalidDefaultServiceConfig()),
265  ::testing::HasSubstr("JSON parse error"));
266  args.SetServiceConfigJSON(InvalidDefaultServiceConfig());
269  return grpc::CreateCustomChannel("fake:///", creds_, args);
270  }
271 
272  bool SendRpc(
273  const std::unique_ptr<grpc::testing::EchoTestService::Stub>& stub,
274  EchoResponse* response = nullptr, int timeout_ms = 1000,
275  Status* result = nullptr, bool wait_for_ready = false) {
276  const bool local_response = (response == nullptr);
277  if (local_response) response = new EchoResponse;
278  EchoRequest request;
279  request.set_message(kRequestMessage_);
280  ClientContext context;
284  if (result != nullptr) *result = status;
285  if (local_response) delete response;
286  return status.ok();
287  }
288 
289  void CheckRpcSendOk(
290  const std::unique_ptr<grpc::testing::EchoTestService::Stub>& stub,
291  const grpc_core::DebugLocation& location, bool wait_for_ready = false) {
292  EchoResponse response;
293  Status status;
294  const bool success =
296  ASSERT_TRUE(success) << "From " << location.file() << ":" << location.line()
297  << "\n"
298  << "Error: " << status.error_message() << " "
299  << status.error_details();
301  << "From " << location.file() << ":" << location.line();
302  if (!success) abort();
303  }
304 
305  void CheckRpcSendFailure(
306  const std::unique_ptr<grpc::testing::EchoTestService::Stub>& stub) {
307  const bool success = SendRpc(stub);
308  EXPECT_FALSE(success);
309  }
310 
311  struct ServerData {
312  const int port_;
313  std::unique_ptr<Server> server_;
314  MyTestServiceImpl service_;
315  std::unique_ptr<std::thread> thread_;
316 
319  bool server_ready_ ABSL_GUARDED_BY(mu_) = false;
320  bool started_ ABSL_GUARDED_BY(mu_) = false;
321 
322  explicit ServerData(int port = 0)
324 
325  void Start(const std::string& server_host) {
326  gpr_log(GPR_INFO, "starting server on port %d", port_);
328  started_ = true;
329  thread_ = absl::make_unique<std::thread>(
330  std::bind(&ServerData::Serve, this, server_host));
331  while (!server_ready_) {
332  cond_.Wait(&mu_);
333  }
334  server_ready_ = false;
335  gpr_log(GPR_INFO, "server startup complete");
336  }
337 
338  void Serve(const std::string& server_host) {
339  std::ostringstream server_address;
340  server_address << server_host << ":" << port_;
341  ServerBuilder builder;
342  std::shared_ptr<ServerCredentials> creds(new SecureServerCredentials(
344  builder.AddListeningPort(server_address.str(), std::move(creds));
345  builder.RegisterService(&service_);
346  server_ = builder.BuildAndStart();
348  server_ready_ = true;
349  cond_.Signal();
350  }
351 
352  void Shutdown() {
354  if (!started_) return;
356  thread_->join();
357  started_ = false;
358  }
359 
360  void SetServingStatus(const std::string& service, bool serving) {
361  server_->GetHealthCheckService()->SetServingStatus(service, serving);
362  }
363  };
364 
365  void ResetCounters() {
366  for (const auto& server : servers_) server->service_.ResetCounters();
367  }
368 
369  void WaitForServer(
370  const std::unique_ptr<grpc::testing::EchoTestService::Stub>& stub,
371  size_t server_idx, const grpc_core::DebugLocation& location,
372  bool ignore_failure = false) {
373  do {
374  if (ignore_failure) {
375  SendRpc(stub);
376  } else {
377  CheckRpcSendOk(stub, location, true);
378  }
379  } while (servers_[server_idx]->service_.request_count() == 0);
380  ResetCounters();
381  }
382 
383  bool WaitForChannelNotReady(Channel* channel, int timeout_seconds = 5) {
384  const gpr_timespec deadline =
387  while ((state = channel->GetState(false /* try_to_connect */)) ==
389  if (!channel->WaitForStateChange(state, deadline)) return false;
390  }
391  return true;
392  }
393 
394  bool WaitForChannelReady(Channel* channel, int timeout_seconds = 5) {
395  const gpr_timespec deadline =
398  while ((state = channel->GetState(true /* try_to_connect */)) !=
400  if (!channel->WaitForStateChange(state, deadline)) return false;
401  }
402  return true;
403  }
404 
405  bool SeenAllServers() {
406  for (const auto& server : servers_) {
407  if (server->service_.request_count() == 0) return false;
408  }
409  return true;
410  }
411 
412  // Updates \a connection_order by appending to it the index of the newly
413  // connected server. Must be called after every single RPC.
414  void UpdateConnectionOrder(
415  const std::vector<std::unique_ptr<ServerData>>& servers,
416  std::vector<int>* connection_order) {
417  for (size_t i = 0; i < servers.size(); ++i) {
418  if (servers[i]->service_.request_count() == 1) {
419  // Was the server index known? If not, update connection_order.
420  const auto it =
421  std::find(connection_order->begin(), connection_order->end(), i);
422  if (it == connection_order->end()) {
423  connection_order->push_back(i);
424  return;
425  }
426  }
427  }
428  }
429 
430  const char* ValidServiceConfigV1() { return "{\"version\": \"1\"}"; }
431 
432  const char* ValidServiceConfigV2() { return "{\"version\": \"2\"}"; }
433 
434  const char* ValidDefaultServiceConfig() {
435  return "{\"version\": \"valid_default\"}";
436  }
437 
438  const char* InvalidDefaultServiceConfig() {
439  return "{\"version\": \"invalid_default\"";
440  }
441 
442  bool ipv6_only_ = false;
444  std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
445  std::vector<std::unique_ptr<ServerData>> servers_;
449  std::shared_ptr<ChannelCredentials> creds_;
450 };
451 
452 TEST_F(ServiceConfigEnd2endTest, NoServiceConfigTest) {
453  StartServers(1);
454  auto channel = BuildChannel();
455  auto stub = BuildStub(channel);
456  SetNextResolutionNoServiceConfig(GetServersPorts());
457  CheckRpcSendOk(stub, DEBUG_LOCATION);
458  EXPECT_STREQ("{}", channel->GetServiceConfigJSON().c_str());
459 }
460 
461 TEST_F(ServiceConfigEnd2endTest, NoServiceConfigWithDefaultConfigTest) {
462  StartServers(1);
463  auto channel = BuildChannelWithDefaultServiceConfig();
464  auto stub = BuildStub(channel);
465  SetNextResolutionNoServiceConfig(GetServersPorts());
466  CheckRpcSendOk(stub, DEBUG_LOCATION);
467  EXPECT_STREQ(ValidDefaultServiceConfig(),
468  channel->GetServiceConfigJSON().c_str());
469 }
470 
471 TEST_F(ServiceConfigEnd2endTest, InvalidServiceConfigTest) {
472  StartServers(1);
473  auto channel = BuildChannel();
474  auto stub = BuildStub(channel);
475  SetNextResolutionInvalidServiceConfig(GetServersPorts());
476  CheckRpcSendFailure(stub);
477 }
478 
479 TEST_F(ServiceConfigEnd2endTest, ValidServiceConfigUpdatesTest) {
480  StartServers(1);
481  auto channel = BuildChannel();
482  auto stub = BuildStub(channel);
483  SetNextResolutionWithServiceConfig(GetServersPorts(), ValidServiceConfigV1());
484  CheckRpcSendOk(stub, DEBUG_LOCATION);
485  EXPECT_STREQ(ValidServiceConfigV1(), channel->GetServiceConfigJSON().c_str());
486  SetNextResolutionWithServiceConfig(GetServersPorts(), ValidServiceConfigV2());
487  CheckRpcSendOk(stub, DEBUG_LOCATION);
488  EXPECT_STREQ(ValidServiceConfigV2(), channel->GetServiceConfigJSON().c_str());
489 }
490 
491 TEST_F(ServiceConfigEnd2endTest,
492  NoServiceConfigUpdateAfterValidServiceConfigTest) {
493  StartServers(1);
494  auto channel = BuildChannel();
495  auto stub = BuildStub(channel);
496  SetNextResolutionWithServiceConfig(GetServersPorts(), ValidServiceConfigV1());
497  CheckRpcSendOk(stub, DEBUG_LOCATION);
498  EXPECT_STREQ(ValidServiceConfigV1(), channel->GetServiceConfigJSON().c_str());
499  SetNextResolutionNoServiceConfig(GetServersPorts());
500  CheckRpcSendOk(stub, DEBUG_LOCATION);
501  EXPECT_STREQ("{}", channel->GetServiceConfigJSON().c_str());
502 }
503 
504 TEST_F(ServiceConfigEnd2endTest,
505  NoServiceConfigUpdateAfterValidServiceConfigWithDefaultConfigTest) {
506  StartServers(1);
507  auto channel = BuildChannelWithDefaultServiceConfig();
508  auto stub = BuildStub(channel);
509  SetNextResolutionWithServiceConfig(GetServersPorts(), ValidServiceConfigV1());
510  CheckRpcSendOk(stub, DEBUG_LOCATION);
511  EXPECT_STREQ(ValidServiceConfigV1(), channel->GetServiceConfigJSON().c_str());
512  SetNextResolutionNoServiceConfig(GetServersPorts());
513  CheckRpcSendOk(stub, DEBUG_LOCATION);
514  EXPECT_STREQ(ValidDefaultServiceConfig(),
515  channel->GetServiceConfigJSON().c_str());
516 }
517 
518 TEST_F(ServiceConfigEnd2endTest,
519  InvalidServiceConfigUpdateAfterValidServiceConfigTest) {
520  StartServers(1);
521  auto channel = BuildChannel();
522  auto stub = BuildStub(channel);
523  SetNextResolutionWithServiceConfig(GetServersPorts(), ValidServiceConfigV1());
524  CheckRpcSendOk(stub, DEBUG_LOCATION);
525  EXPECT_STREQ(ValidServiceConfigV1(), channel->GetServiceConfigJSON().c_str());
526  SetNextResolutionInvalidServiceConfig(GetServersPorts());
527  CheckRpcSendOk(stub, DEBUG_LOCATION);
528  EXPECT_STREQ(ValidServiceConfigV1(), channel->GetServiceConfigJSON().c_str());
529 }
530 
531 TEST_F(ServiceConfigEnd2endTest,
532  InvalidServiceConfigUpdateAfterValidServiceConfigWithDefaultConfigTest) {
533  StartServers(1);
534  auto channel = BuildChannelWithDefaultServiceConfig();
535  auto stub = BuildStub(channel);
536  SetNextResolutionWithServiceConfig(GetServersPorts(), ValidServiceConfigV1());
537  CheckRpcSendOk(stub, DEBUG_LOCATION);
538  EXPECT_STREQ(ValidServiceConfigV1(), channel->GetServiceConfigJSON().c_str());
539  SetNextResolutionInvalidServiceConfig(GetServersPorts());
540  CheckRpcSendOk(stub, DEBUG_LOCATION);
541  EXPECT_STREQ(ValidServiceConfigV1(), channel->GetServiceConfigJSON().c_str());
542 }
543 
544 TEST_F(ServiceConfigEnd2endTest,
545  ValidServiceConfigAfterInvalidServiceConfigTest) {
546  StartServers(1);
547  auto channel = BuildChannel();
548  auto stub = BuildStub(channel);
549  SetNextResolutionInvalidServiceConfig(GetServersPorts());
550  CheckRpcSendFailure(stub);
551  SetNextResolutionValidServiceConfig(GetServersPorts());
552  CheckRpcSendOk(stub, DEBUG_LOCATION);
553 }
554 
555 TEST_F(ServiceConfigEnd2endTest, NoServiceConfigAfterInvalidServiceConfigTest) {
556  StartServers(1);
557  auto channel = BuildChannel();
558  auto stub = BuildStub(channel);
559  SetNextResolutionInvalidServiceConfig(GetServersPorts());
560  CheckRpcSendFailure(stub);
561  SetNextResolutionNoServiceConfig(GetServersPorts());
562  CheckRpcSendOk(stub, DEBUG_LOCATION);
563  EXPECT_STREQ("{}", channel->GetServiceConfigJSON().c_str());
564 }
565 
566 TEST_F(ServiceConfigEnd2endTest,
567  AnotherInvalidServiceConfigAfterInvalidServiceConfigTest) {
568  StartServers(1);
569  auto channel = BuildChannel();
570  auto stub = BuildStub(channel);
571  SetNextResolutionInvalidServiceConfig(GetServersPorts());
572  CheckRpcSendFailure(stub);
573  SetNextResolutionInvalidServiceConfig(GetServersPorts());
574  CheckRpcSendFailure(stub);
575 }
576 
577 TEST_F(ServiceConfigEnd2endTest, InvalidDefaultServiceConfigTest) {
578  StartServers(1);
579  auto channel = BuildChannelWithInvalidDefaultServiceConfig();
580  auto stub = BuildStub(channel);
581  // An invalid default service config results in a lame channel which fails all
582  // RPCs
583  CheckRpcSendFailure(stub);
584 }
585 
586 TEST_F(ServiceConfigEnd2endTest,
587  InvalidDefaultServiceConfigTestWithValidServiceConfig) {
588  StartServers(1);
589  auto channel = BuildChannelWithInvalidDefaultServiceConfig();
590  auto stub = BuildStub(channel);
591  CheckRpcSendFailure(stub);
592  // An invalid default service config results in a lame channel which fails all
593  // RPCs
594  SetNextResolutionValidServiceConfig(GetServersPorts());
595  CheckRpcSendFailure(stub);
596 }
597 
598 TEST_F(ServiceConfigEnd2endTest,
599  InvalidDefaultServiceConfigTestWithInvalidServiceConfig) {
600  StartServers(1);
601  auto channel = BuildChannelWithInvalidDefaultServiceConfig();
602  auto stub = BuildStub(channel);
603  CheckRpcSendFailure(stub);
604  // An invalid default service config results in a lame channel which fails all
605  // RPCs
606  SetNextResolutionInvalidServiceConfig(GetServersPorts());
607  CheckRpcSendFailure(stub);
608 }
609 
610 TEST_F(ServiceConfigEnd2endTest,
611  InvalidDefaultServiceConfigTestWithNoServiceConfig) {
612  StartServers(1);
613  auto channel = BuildChannelWithInvalidDefaultServiceConfig();
614  auto stub = BuildStub(channel);
615  CheckRpcSendFailure(stub);
616  // An invalid default service config results in a lame channel which fails all
617  // RPCs
618  SetNextResolutionNoServiceConfig(GetServersPorts());
619  CheckRpcSendFailure(stub);
620 }
621 
622 } // namespace
623 } // namespace testing
624 } // namespace grpc
625 
626 int main(int argc, char** argv) {
627  ::testing::InitGoogleTest(&argc, argv);
628  grpc::testing::TestEnvironment env(&argc, argv);
629  const auto result = RUN_ALL_TESTS();
630  return result;
631 }
grpc::EXPECT_THAT
EXPECT_THAT(status.error_message(), ::testing::HasSubstr("subject_token_type"))
EXPECT_FALSE
#define EXPECT_FALSE(condition)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:1970
absl::InvalidArgumentError
Status InvalidArgumentError(absl::string_view message)
Definition: third_party/abseil-cpp/absl/status/status.cc:351
grpc::ClientContext::peer
std::string peer() const
Definition: client_context.cc:174
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
GPR_INFO
#define GPR_INFO
Definition: include/grpc/impl/codegen/log.h:56
testing
Definition: aws_request_signer_test.cc:25
servers_
std::vector< std::unique_ptr< ServerData > > servers_
Definition: service_config_end2end_test.cc:445
grpc::status
auto status
Definition: cpp/client/credentials_test.cc:200
GRPC_CHANNEL_READY
@ GRPC_CHANNEL_READY
Definition: include/grpc/impl/codegen/connectivity_state.h:36
grpc_core::LocalhostResolves
void LocalhostResolves(bool *ipv4, bool *ipv6)
Definition: resolve_localhost_ip46.cc:50
clients_mu_
grpc::internal::Mutex clients_mu_
Definition: service_config_end2end_test.cc:114
regen-readme.it
it
Definition: regen-readme.py:15
fake_credentials.h
validate_service_config.h
GRPC_ERROR_NONE
#define GRPC_ERROR_NONE
Definition: error.h:234
grpc_timeout_seconds_to_deadline
gpr_timespec grpc_timeout_seconds_to_deadline(int64_t time_s)
Definition: test/core/util/test_config.cc:81
log.h
port.h
backoff.h
grpc_core::DebugLocation
Definition: debug_location.h:31
resolve_localhost_ip46.h
generate.env
env
Definition: generate.py:37
absl::StrCat
std::string StrCat(const AlphaNum &a, const AlphaNum &b)
Definition: abseil-cpp/absl/strings/str_cat.cc:98
find
static void ** find(grpc_chttp2_stream_map *map, uint32_t key)
Definition: stream_map.cc:99
thread_
std::unique_ptr< std::thread > thread_
Definition: service_config_end2end_test.cc:315
grpc::internal::Mutex
Definition: include/grpcpp/impl/codegen/sync.h:59
grpc
Definition: grpcpp/alarm.h:33
grpc_core::RefCountedPtr::get
T * get() const
Definition: ref_counted_ptr.h:146
grpc_core::FakeResolverResponseGenerator::SetResponse
void SetResponse(Resolver::Result result)
Definition: fake_resolver.cc:229
run_interop_tests.timeout_seconds
timeout_seconds
Definition: run_interop_tests.py:1553
client
Definition: examples/python/async_streaming/client.py:1
TestServiceImpl::Echo
grpc::Status Echo(grpc::ServerContext *context, const grpc::testing::EchoRequest *request, grpc::testing::EchoResponse *response)
grpc::ClientContext::set_wait_for_ready
void set_wait_for_ready(bool wait_for_ready)
Definition: grpcpp/impl/codegen/client_context.h:285
grpc::ASSERT_EQ
ASSERT_EQ(sizeof(valid_json), fwrite(valid_json, 1, sizeof(valid_json), creds_file))
benchmark.request
request
Definition: benchmark.py:77
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
error
grpc_error_handle error
Definition: retry_filter.cc:499
fake_resolver.h
secure_credentials.h
grpc::ClientContext::set_deadline
void set_deadline(const T &deadline)
Definition: grpcpp/impl/codegen/client_context.h:274
grpc_resolved_address
Definition: resolved_address.h:34
stub_
std::unique_ptr< grpc::testing::EchoTestService::Stub > stub_
Definition: service_config_end2end_test.cc:444
health_check_service_interface.h
ABSL_GUARDED_BY
#define ABSL_GUARDED_BY(x)
Definition: abseil-cpp/absl/base/thread_annotations.h:62
time.h
service_
MyTestServiceImpl service_
Definition: service_config_end2end_test.cc:314
async_greeter_client.stub
stub
Definition: hellostreamingworld/async_greeter_client.py:26
grpc_core::URI::Parse
static absl::StatusOr< URI > Parse(absl::string_view uri_text)
Definition: uri_parser.cc:209
kRequestMessage_
const std::string kRequestMessage_
Definition: service_config_end2end_test.cc:448
grpc_core::DebugLocation::file
const char * file() const
Definition: debug_location.h:34
grpc::internal::MutexLock
Definition: include/grpcpp/impl/codegen/sync.h:86
server_address
std::string server_address("0.0.0.0:10000")
testing::Test
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:402
grpc_connectivity_state
grpc_connectivity_state
Definition: include/grpc/impl/codegen/connectivity_state.h:30
test_service_impl.h
global_subchannel_pool.h
server_
std::unique_ptr< Server > server_
Definition: service_config_end2end_test.cc:313
grpc_parse_uri
bool grpc_parse_uri(const grpc_core::URI &uri, grpc_resolved_address *resolved_addr)
Definition: parse_address.cc:293
DEBUG_LOCATION
#define DEBUG_LOCATION
Definition: debug_location.h:41
framework.rpc.grpc_channelz.Channel
Channel
Definition: grpc_channelz.py:32
clients
static client_t clients[NUM_CLIENTS]
Definition: test-pipe-connect-multiple.c:40
parse_address.h
profile_analyzer.builder
builder
Definition: profile_analyzer.py:159
channel
wrapped_grpc_channel * channel
Definition: src/php/ext/grpc/call.h:33
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
sync.h
grpc_core::RefCountedPtr< grpc_core::FakeResolverResponseGenerator >
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
GPR_ASSERT
#define GPR_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:94
grpc_core::DebugLocation::line
int line() const
Definition: debug_location.h:35
grpc::internal::CondVar::Wait
void Wait(Mutex *mu)
Definition: include/grpcpp/impl/codegen/sync.h:135
grpc_timeout_milliseconds_to_deadline
gpr_timespec grpc_timeout_milliseconds_to_deadline(int64_t time_ms)
Definition: test/core/util/test_config.cc:89
gpr_log
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
mu_
grpc::internal::Mutex mu_
Definition: service_config_end2end_test.cc:112
grpc_core::Resolver::Result
Results returned by the resolver.
Definition: resolver/resolver.h:56
GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR
#define GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR
Definition: fake_resolver.h:31
grpc.h
grpc_fake_transport_security_credentials_create
grpc_channel_credentials * grpc_fake_transport_security_credentials_create()
Definition: fake_credentials.cc:79
started_
bool started_
Definition: xds_cluster_impl.cc:357
channel.h
cond_
grpc::internal::CondVar cond_
Definition: service_config_end2end_test.cc:318
server_address.h
port_
const int port_
Definition: service_config_end2end_test.cc:312
backup_poller.h
grpc_resolved_address::len
socklen_t len
Definition: resolved_address.h:36
grpc_fake_transport_security_server_credentials_create
grpc_server_credentials * grpc_fake_transport_security_server_credentials_create()
Definition: fake_credentials.cc:84
benchmark::Shutdown
void Shutdown()
Definition: benchmark/src/benchmark.cc:607
RUN_ALL_TESTS
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2471
grpc_pick_unused_port_or_die
int grpc_pick_unused_port_or_die(void)
grpc_core::ServerAddressList
std::vector< ServerAddress > ServerAddressList
Definition: server_address.h:120
grpc_core::ExecCtx
Definition: exec_ctx.h:97
response_generator_
grpc_core::RefCountedPtr< grpc_core::FakeResolverResponseGenerator > response_generator_
Definition: service_config_end2end_test.cc:447
GPR_GLOBAL_CONFIG_SET
#define GPR_GLOBAL_CONFIG_SET(name, value)
Definition: global_config_generic.h:26
tcp_client.h
grpc_core::ServiceConfigImpl::Create
static RefCountedPtr< ServiceConfig > Create(const grpc_channel_args *args, absl::string_view json_string, grpc_error_handle *error)
Definition: service_config_impl.cc:41
tests.unit._exit_scenarios.port
port
Definition: _exit_scenarios.py:179
test_config.h
EXPECT_STREQ
#define EXPECT_STREQ(s1, s2)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2095
secure_server_credentials.h
wait_for_ready
bool wait_for_ready
Definition: rls_end2end_test.cc:240
absl::StatusOr::ok
ABSL_MUST_USE_RESULT bool ok() const
Definition: abseil-cpp/absl/status/statusor.h:491
client_context.h
testing::InitGoogleTest
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
Definition: bloaty/third_party/googletest/googletest/src/gtest.cc:6106
debug_location.h
http2_server_health_check.server_host
server_host
Definition: http2_server_health_check.py:27
grpc::testing::TEST_F
TEST_F(ChannelArgumentsTest, SetInt)
Definition: channel_arguments_test.cc:134
server
Definition: examples/python/async_streaming/server.py:1
exec_ctx
grpc_core::ExecCtx exec_ctx
Definition: end2end_binder_transport_test.cc:75
grpc_error_std_string
std::string grpc_error_std_string(grpc_error_handle error)
Definition: error.cc:944
StartServer
void StartServer(JNIEnv *env, jobject obj, jmethodID is_cancelled_mid, int port)
Definition: grpc-helloworld.cc:48
ipv6_only_
bool ipv6_only_
Definition: service_config_end2end_test.cc:442
index
int index
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:1184
alloc.h
main
int main(int argc, char **argv)
Definition: service_config_end2end_test.cc:626
clients_
std::set< std::string > clients_
Definition: service_config_end2end_test.cc:115
asyncio_get_stats.response
response
Definition: asyncio_get_stats.py:28
grpc::testing::TestEnvironment
Definition: test/core/util/test_config.h:54
service_config_impl.h
grpc::CreateCustomChannel
std::shared_ptr< Channel > CreateCustomChannel(const grpc::string &target, const std::shared_ptr< ChannelCredentials > &creds, const ChannelArguments &args)
timeout_ms
int timeout_ms
Definition: rls_end2end_test.cc:239
grpc::protobuf::util::Status
GRPC_CUSTOM_UTIL_STATUS Status
Definition: include/grpcpp/impl/codegen/config_protobuf.h:93
ASSERT_TRUE
#define ASSERT_TRUE(condition)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:1973
state
Definition: bloaty/third_party/zlib/contrib/blast/blast.c:41
server_host_
const std::string server_host_
Definition: service_config_end2end_test.cc:443
GRPC_ERROR_UNREF
#define GRPC_ERROR_UNREF(err)
Definition: error.h:262
ref_counted_ptr.h
channel_args.h
grpc::experimental::ValidateServiceConfigJSON
std::string ValidateServiceConfigJSON(const std::string &service_config_json)
Definition: validate_service_config.cc:30
grpc::internal::CondVar
Definition: include/grpcpp/impl/codegen/sync.h:124
context
grpc::ClientContext context
Definition: istio_echo_server_lib.cc:61
testing::StrEq
PolymorphicMatcher< internal::StrEqualityMatcher< internal::string > > StrEq(const internal::string &str)
Definition: cares/cares/test/gmock-1.8.0/gmock/gmock.h:8774
atm.h
request_count_
int request_count_
Definition: service_config_end2end_test.cc:113
absl::StatusOr
Definition: abseil-cpp/absl/status/statusor.h:187
server.h
grpc::internal::CondVar::Signal
void Signal()
Definition: include/grpcpp/impl/codegen/sync.h:132
gpr_timespec
Definition: gpr_types.h:50
grpc_init
GRPCAPI void grpc_init(void)
Definition: init.cc:146
service
__attribute__((deprecated("Please use GRPCProtoMethod."))) @interface ProtoMethod NSString * service
Definition: ProtoMethod.h:25
grpc_error
Definition: error_internal.h:42
grpc_error_to_absl_status
absl::Status grpc_error_to_absl_status(grpc_error_handle error)
Definition: error_utils.cc:156
TestServiceImpl
Definition: interop_server.cc:139
grpc::testing::SendRpc
static void SendRpc(grpc::testing::EchoTestService::Stub *stub, int num_rpcs, bool allow_exhaustion, gpr_atm *errors)
Definition: thread_stress_test.cc:277
testing::HasSubstr
PolymorphicMatcher< internal::HasSubstrMatcher< internal::string > > HasSubstr(const internal::string &substring)
Definition: cares/cares/test/gmock-1.8.0/gmock/gmock.h:8803
grpc_resolved_address::addr
char addr[GRPC_MAX_SOCKADDR_SIZE]
Definition: resolved_address.h:35
grpc_shutdown
GRPCAPI void grpc_shutdown(void)
Definition: init.cc:209
server_builder.h
creds_
std::shared_ptr< ChannelCredentials > creds_
Definition: service_config_end2end_test.cc:449
run_interop_tests.servers
servers
Definition: run_interop_tests.py:1288
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
create_channel.h
state
static struct rpc_state state
Definition: bad_server_response_test.cc:87
error_utils.h
GRPC_ERROR_IS_NONE
#define GRPC_ERROR_IS_NONE(err)
Definition: error.h:241


grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:12