aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2018-07-11 17:11:01 -0700
committerGravatar ncteisen <ncteisen@gmail.com>2018-07-18 15:03:31 -0700
commitb86a74475189e0ed97cdd3ddc48d96e94cec366a (patch)
tree8e1597cad0973f3cc99400238001349bfdf27d67 /test
parent2d5e0f1e72cda4e7466f28fdeaf20eceabef00f3 (diff)
Expose GetChannel and GetTopChannels Core API
Diffstat (limited to 'test')
-rw-r--r--test/core/channel/channelz_test.cc10
-rw-r--r--test/core/surface/public_headers_must_be_c89.c2
-rw-r--r--test/cpp/util/channel_trace_proto_helper.cc5
-rw-r--r--test/cpp/util/channel_trace_proto_helper.h1
4 files changed, 18 insertions, 0 deletions
diff --git a/test/core/channel/channelz_test.cc b/test/core/channel/channelz_test.cc
index d12f529726..ad5f86d934 100644
--- a/test/core/channel/channelz_test.cc
+++ b/test/core/channel/channelz_test.cc
@@ -95,6 +95,11 @@ void ValidateGetTopChannels(size_t expected_channels) {
EXPECT_EQ(end->type, GRPC_JSON_TRUE);
grpc_json_destroy(parsed_json);
gpr_free(json_str);
+ // also check that the core API formats this correctly
+ char* core_api_json_str = grpc_channelz_get_top_channels(0);
+ grpc::testing::ValidateGetTopChannelsResponseProtoJsonTranslation(
+ core_api_json_str);
+ gpr_free(core_api_json_str);
}
class ChannelFixture {
@@ -151,6 +156,11 @@ void ValidateChannel(ChannelNode* channel, validate_channel_data_args args) {
grpc::testing::ValidateChannelProtoJsonTranslation(json_str);
ValidateCounters(json_str, args);
gpr_free(json_str);
+ // also check that the core API formats this the correct way
+ char* core_api_json_str = grpc_channelz_get_channel(channel->channel_uuid());
+ grpc::testing::ValidateGetChannelResponseProtoJsonTranslation(
+ core_api_json_str);
+ gpr_free(core_api_json_str);
}
grpc_millis GetLastCallStartedMillis(ChannelNode* channel) {
diff --git a/test/core/surface/public_headers_must_be_c89.c b/test/core/surface/public_headers_must_be_c89.c
index 9a79b468dd..9f4ad2b4d7 100644
--- a/test/core/surface/public_headers_must_be_c89.c
+++ b/test/core/surface/public_headers_must_be_c89.c
@@ -131,6 +131,8 @@ int main(int argc, char **argv) {
printf("%lx", (unsigned long) grpc_resource_quota_unref);
printf("%lx", (unsigned long) grpc_resource_quota_resize);
printf("%lx", (unsigned long) grpc_resource_quota_arg_vtable);
+ printf("%lx", (unsigned long) grpc_channelz_get_top_channels);
+ printf("%lx", (unsigned long) grpc_channelz_get_channel);
printf("%lx", (unsigned long) grpc_auth_property_iterator_next);
printf("%lx", (unsigned long) grpc_auth_context_property_iterator);
printf("%lx", (unsigned long) grpc_auth_context_peer_identity);
diff --git a/test/cpp/util/channel_trace_proto_helper.cc b/test/cpp/util/channel_trace_proto_helper.cc
index 137f278640..b4704bfe6a 100644
--- a/test/cpp/util/channel_trace_proto_helper.cc
+++ b/test/cpp/util/channel_trace_proto_helper.cc
@@ -77,5 +77,10 @@ void ValidateGetTopChannelsResponseProtoJsonTranslation(char* json_c_str) {
json_c_str);
}
+void ValidateGetChannelResponseProtoJsonTranslation(char* json_c_str) {
+ VaidateProtoJsonTranslation<grpc::channelz::v1::GetChannelResponse>(
+ json_c_str);
+}
+
} // namespace testing
} // namespace grpc
diff --git a/test/cpp/util/channel_trace_proto_helper.h b/test/cpp/util/channel_trace_proto_helper.h
index 74c15f04f1..18e3d54b6b 100644
--- a/test/cpp/util/channel_trace_proto_helper.h
+++ b/test/cpp/util/channel_trace_proto_helper.h
@@ -25,6 +25,7 @@ namespace testing {
void ValidateChannelTraceProtoJsonTranslation(char* json_c_str);
void ValidateChannelProtoJsonTranslation(char* json_c_str);
void ValidateGetTopChannelsResponseProtoJsonTranslation(char* json_c_str);
+void ValidateGetChannelResponseProtoJsonTranslation(char* json_c_str);
} // namespace testing
} // namespace grpc