endpoint_config_test.cc
Go to the documentation of this file.
1 // Copyright 2021 The gRPC Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 
16 #include <gmock/gmock.h>
17 #include <gtest/gtest.h>
18 
20 #include <grpc/grpc.h>
21 
25 
26 using ::grpc_event_engine::experimental::ChannelArgsEndpointConfig;
27 
28 TEST(EndpointConfigTest, CanSRetrieveValuesFromChannelArgs) {
29  grpc_arg arg = grpc_channel_arg_integer_create(const_cast<char*>("arst"), 3);
30  const grpc_channel_args args = {1, &arg};
31  ChannelArgsEndpointConfig config(&args);
32  EXPECT_EQ(absl::get<int>(config.Get("arst")), 3);
33 }
34 
35 TEST(EndpointConfigTest, ReturnsMonostateForMissingKeys) {
36  ChannelArgsEndpointConfig config(nullptr);
38  absl::holds_alternative<absl::monostate>(config.Get("nonexistent")));
39 }
40 
41 int main(int argc, char** argv) {
42  testing::InitGoogleTest(&argc, argv);
43  auto result = RUN_ALL_TESTS();
44  return result;
45 }
grpc_arg
Definition: grpc_types.h:103
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
channel_args_endpoint_config.h
grpc_channel_args
Definition: grpc_types.h:132
EXPECT_EQ
#define EXPECT_EQ(a, b)
Definition: iomgr/time_averaged_stats_test.cc:27
main
int main(int argc, char **argv)
Definition: endpoint_config_test.cc:41
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
config
struct config_s config
grpc.h
arg
Definition: cmdline.cc:40
RUN_ALL_TESTS
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2471
test_config.h
testing::InitGoogleTest
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
Definition: bloaty/third_party/googletest/googletest/src/gtest.cc:6106
grpc_channel_arg_integer_create
grpc_arg grpc_channel_arg_integer_create(char *name, int value)
Definition: channel_args.cc:484
config_s
Definition: bloaty/third_party/zlib/deflate.c:120
channel_args.h
EXPECT_TRUE
#define EXPECT_TRUE(condition)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:1967
endpoint_config.h
TEST
TEST(EndpointConfigTest, CanSRetrieveValuesFromChannelArgs)
Definition: endpoint_config_test.cc:28
port_platform.h


grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:19