This repository was archived by the owner on Jul 31, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +22
-22
lines changed
Expand file tree Collapse file tree 2 files changed +22
-22
lines changed Original file line number Diff line number Diff line change @@ -58,21 +58,19 @@ cc_library(
5858
5959# TODO: grpc_plugin_end2end_test
6060
61- # TODO: Enable this test:
62- # cc_test(
63- # name = "stats_plugin_end2end_test",
64- # srcs = ["internal/stats_plugin_end2end_test.cc"],
65- # copts = TEST_COPTS,
66- # linkopts = [
67- # "-pthread",
68- # ],
69- # deps = [
70- # ":grpc_plugin",
71- # "//opencensus/plugins/internal/testing:echo_proto",
72- # "//opencensus/stats",
73- # "@com_github_grpc_grpc//:grpc++",
74- # "@com_github_grpc_grpc//test/core/util:grpc_test_util_base",
75- # "@com_google_absl//absl/strings",
76- # "@com_google_googletest//:gtest_main",
77- # ],
78- # )
61+ cc_test (
62+ name = "stats_plugin_end2end_test" ,
63+ srcs = ["internal/stats_plugin_end2end_test.cc" ],
64+ copts = TEST_COPTS ,
65+ linkopts = [
66+ "-pthread" ,
67+ ],
68+ deps = [
69+ ":grpc_plugin" ,
70+ "//opencensus/plugins/internal/testing:echo_proto" ,
71+ "//opencensus/stats" ,
72+ "@com_github_grpc_grpc//:grpc++" ,
73+ "@com_google_absl//absl/strings" ,
74+ "@com_google_googletest//:gtest_main" ,
75+ ],
76+ )
Original file line number Diff line number Diff line change 2424#include " opencensus/plugins/grpc_plugin.h"
2525#include " opencensus/plugins/internal/testing/echo.grpc.pb.h"
2626#include " opencensus/stats/stats.h"
27- #include " test/core/util/port.h"
2827
2928namespace opencensus {
3029namespace testing {
@@ -51,12 +50,15 @@ class StatsPluginEnd2EndTest : public ::testing::Test {
5150 void SetUp () {
5251 // Set up a synchronous server on a different thread to avoid the asynch
5352 // interface.
54- server_address_ = absl::StrCat (" [::]:" , grpc_pick_unused_port_or_die ());
5553 ::grpc::ServerBuilder builder;
56- builder.AddListeningPort (server_address_,
57- ::grpc::InsecureServerCredentials ());
54+ int port;
55+ builder.AddListeningPort (" [::]:0" , ::grpc::InsecureServerCredentials (),
56+ &port);
5857 builder.RegisterService (&service_);
5958 server_ = builder.BuildAndStart ();
59+ ASSERT_NE (nullptr , server_);
60+ ASSERT_NE (0 , port);
61+ server_address_ = absl::StrCat (" [::]:" , port);
6062 server_thread_ = std::thread (&StatsPluginEnd2EndTest::RunServerLoop, this );
6163
6264 stub_ = EchoService::NewStub (::grpc::CreateChannel (
You can’t perform that action at this time.
0 commit comments