aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2018-05-30 23:21:03 -0700
committerGravatar ncteisen <ncteisen@gmail.com>2018-06-05 16:59:25 -0700
commitc03c9685a2461b097c17e2298be506520e15a5b1 (patch)
treed6b84c2b087df82f89be7842815b185e45017596
parent9a1bb051812a53462b2deb7e472f20e3e1dd785f (diff)
Add sanity channelz test to simple_request
-rw-r--r--src/core/lib/channel/channelz.h2
-rw-r--r--test/core/end2end/tests/simple_request.cc23
2 files changed, 18 insertions, 7 deletions
diff --git a/src/core/lib/channel/channelz.h b/src/core/lib/channel/channelz.h
index 63b90e90a0..5cfafc9e14 100644
--- a/src/core/lib/channel/channelz.h
+++ b/src/core/lib/channel/channelz.h
@@ -23,7 +23,6 @@
#include <grpc/grpc.h>
-#include "src/core/ext/filters/client_channel/client_channel.h"
#include "src/core/lib/channel/channel_trace.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/gprpp/ref_counted.h"
@@ -34,7 +33,6 @@
namespace grpc_core {
namespace channelz {
-// owned by the client_channel that it points to and tracks
class Channel : public RefCounted<Channel> {
public:
Channel(grpc_channel* channel, size_t channel_tracer_max_nodes);
diff --git a/test/core/end2end/tests/simple_request.cc b/test/core/end2end/tests/simple_request.cc
index 6e36e54cd3..a9341edff9 100644
--- a/test/core/end2end/tests/simple_request.cc
+++ b/test/core/end2end/tests/simple_request.cc
@@ -21,7 +21,6 @@
#include <stdio.h>
#include <string.h>
-#include "src/core/ext/filters/client_channel/client_channel.h"
#include "src/core/lib/surface/channel.h"
#include <grpc/byte_buffer.h>
@@ -201,10 +200,6 @@ static void simple_request_body(grpc_end2end_test_config config,
CQ_EXPECT_COMPLETION(cqv, tag(1), 1);
cq_verify(cqv);
- char* json = grpc_channel_render_channelz(f.client);
- gpr_log(GPR_ERROR, "%s", json);
- gpr_free(json);
-
GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED);
GPR_ASSERT(0 == grpc_slice_str_cmp(details, "xyz"));
// the following sanity check makes sure that the requested error string is
@@ -259,6 +254,16 @@ static void test_invoke_simple_request(grpc_end2end_test_config config) {
f = begin_test(config, "test_invoke_simple_request", nullptr, nullptr);
simple_request_body(config, f);
+
+ // The following is a quick sanity check on channelz functionality. It
+ // ensures that core properly tracked the one call that occurred in this
+ // simple end2end test.
+ char* json = grpc_channel_render_channelz(f.client);
+ GPR_ASSERT(nullptr != strstr(json, "\"callsStarted\":\"1\""));
+ GPR_ASSERT(nullptr != strstr(json, "\"callsFailed\":\"1\""));
+ GPR_ASSERT(nullptr != strstr(json, "\"callsSucceeded\":\"-1\""));
+ gpr_free(json);
+
end_test(&f);
config.tear_down_data(&f);
}
@@ -271,6 +276,14 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) {
simple_request_body(config, f);
gpr_log(GPR_INFO, "Running test: Passed simple request %d", i);
}
+
+ // The following is a quick sanity check on channelz functionality. It
+ // ensures that core properly tracked the ten calls that occurred.
+ char* json = grpc_channel_render_channelz(f.client);
+ GPR_ASSERT(nullptr != strstr(json, "\"callsStarted\":\"10\""));
+ GPR_ASSERT(nullptr != strstr(json, "\"callsFailed\":\"10\""));
+ GPR_ASSERT(nullptr != strstr(json, "\"callsSucceeded\":\"-1\""));
+ gpr_free(json);
end_test(&f);
config.tear_down_data(&f);
}