|
26 | 26 | #include "opencensus/plugins/grpc/grpc_plugin.h" |
27 | 27 | #include "opencensus/plugins/grpc/internal/testing/echo.grpc.pb.h" |
28 | 28 | #include "opencensus/stats/stats.h" |
| 29 | +#include "opencensus/stats/testing/test_utils.h" |
29 | 30 |
|
30 | 31 | namespace opencensus { |
31 | 32 | namespace testing { |
@@ -129,6 +130,7 @@ TEST_F(StatsPluginEnd2EndTest, ErrorCount) { |
129 | 130 | ::grpc::Status status = stub_->Echo(&context, request, &response); |
130 | 131 | } |
131 | 132 | absl::SleepFor(absl::Milliseconds(500)); |
| 133 | + stats::testing::TestUtils::Flush(); |
132 | 134 |
|
133 | 135 | EXPECT_THAT(client_method_view.GetData().double_data(), |
134 | 136 | ::testing::UnorderedElementsAre(::testing::Pair( |
@@ -179,6 +181,7 @@ TEST_F(StatsPluginEnd2EndTest, RequestResponseBytes) { |
179 | 181 | EXPECT_EQ("foo", response.message()); |
180 | 182 | } |
181 | 183 | absl::SleepFor(absl::Milliseconds(500)); |
| 184 | + stats::testing::TestUtils::Flush(); |
182 | 185 |
|
183 | 186 | EXPECT_THAT( |
184 | 187 | client_request_bytes_view.GetData().distribution_data(), |
@@ -232,6 +235,7 @@ TEST_F(StatsPluginEnd2EndTest, Latency) { |
232 | 235 | const double max_time = absl::ToDoubleMilliseconds(absl::Now() - start_time); |
233 | 236 |
|
234 | 237 | absl::SleepFor(absl::Milliseconds(500)); |
| 238 | + stats::testing::TestUtils::Flush(); |
235 | 239 |
|
236 | 240 | EXPECT_THAT( |
237 | 241 | client_latency_view.GetData().distribution_data(), |
@@ -292,6 +296,7 @@ TEST_F(StatsPluginEnd2EndTest, StartFinishCount) { |
292 | 296 | EXPECT_EQ("foo", response.message()); |
293 | 297 | } |
294 | 298 | absl::SleepFor(absl::Milliseconds(500)); |
| 299 | + stats::testing::TestUtils::Flush(); |
295 | 300 |
|
296 | 301 | EXPECT_THAT(client_started_count_view.GetData().double_data(), |
297 | 302 | ::testing::UnorderedElementsAre(::testing::Pair( |
@@ -327,6 +332,7 @@ TEST_F(StatsPluginEnd2EndTest, RequestResponseCount) { |
327 | 332 | EXPECT_EQ("foo", response.message()); |
328 | 333 | } |
329 | 334 | absl::SleepFor(absl::Milliseconds(500)); |
| 335 | + stats::testing::TestUtils::Flush(); |
330 | 336 |
|
331 | 337 | EXPECT_THAT(client_request_count_view.GetData().distribution_data(), |
332 | 338 | ::testing::UnorderedElementsAre(::testing::Pair( |
|
0 commit comments