From 2ffff621a46d04d5b29bb056ba7837789c0b52ba Mon Sep 17 00:00:00 2001 From: Yash Tibrewal Date: Thu, 13 Oct 2022 16:06:51 -0700 Subject: [PATCH] OpenCensusTest: Fix flakiness (#31349) --- test/cpp/ext/filters/census/stats_plugin_end2end_test.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/cpp/ext/filters/census/stats_plugin_end2end_test.cc b/test/cpp/ext/filters/census/stats_plugin_end2end_test.cc index aa736e16ce7..7d022be30e6 100644 --- a/test/cpp/ext/filters/census/stats_plugin_end2end_test.cc +++ b/test/cpp/ext/filters/census/stats_plugin_end2end_test.cc @@ -169,6 +169,9 @@ class StatsPluginEnd2EndTest : public ::testing::Test { stub_ = EchoTestService::NewStub(grpc::CreateChannel( server_address_, grpc::InsecureChannelCredentials())); + + // Clear out any previous spans + ::opencensus::trace::exporter::SpanExporterTestPeer::ExportForTesting(); } void ResetStub(std::shared_ptr channel) { @@ -659,7 +662,9 @@ TEST_F(StatsPluginEnd2EndTest, TestRetryStatsWithAdditionalRetries) { ::testing::ElementsAre(client_method_name_), ::testing::Property( &Distribution::mean, - ::testing::AllOf(::testing::Ge(50), ::testing::Le(300)))))); + ::testing::AllOf( + ::testing::Ge(50), + ::testing::Le(500 * grpc_test_slowdown_factor())))))); } }