File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 2828#include " opencensus/stats/stats.h"
2929#include " src/cpp/ext/filters/census/grpc_plugin.h"
3030#include " src/proto/grpc/testing/echo.grpc.pb.h"
31+ #include " test/core/util/test_config.h"
3132#include " test/cpp/microbenchmarks/helpers.h"
3233
3334using ::grpc::RegisterOpenCensusPlugin;
@@ -86,6 +87,8 @@ class EchoServerThread final {
8687};
8788
8889static void BM_E2eLatencyCensusDisabled (benchmark::State& state) {
90+ grpc::testing::TestEnvironment env (0 , {});
91+
8992 EchoServerThread server;
9093 std::unique_ptr<grpc::testing::EchoTestService::Stub> stub =
9194 grpc::testing::EchoTestService::NewStub (grpc::CreateChannel (
@@ -101,11 +104,7 @@ static void BM_E2eLatencyCensusDisabled(benchmark::State& state) {
101104BENCHMARK (BM_E2eLatencyCensusDisabled);
102105
103106static void BM_E2eLatencyCensusEnabled (benchmark::State& state) {
104- // Avoid a data race between registering plugin and shutdown of previous
105- // test (order-dependent) by doing an init/shutdown so that any previous
106- // shutdowns are fully complete first.
107- grpc_init ();
108- grpc_shutdown_blocking ();
107+ grpc::testing::TestEnvironment env (0 , {});
109108
110109 // Now start the test by registering the plugin (once in the execution)
111110 RegisterOnce ();
You can’t perform that action at this time.
0 commit comments