From fed6c180e96f6beb58f79c37cb10b197021739c0 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 6 Sep 2022 08:40:39 -0700 Subject: [PATCH] [census] Add time scaling to test (#30851) --- .../census/stats_plugin_end2end_test.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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 39352b1dd2a..a677a8cacd9 100644 --- a/test/cpp/ext/filters/census/stats_plugin_end2end_test.cc +++ b/test/cpp/ext/filters/census/stats_plugin_end2end_test.cc @@ -241,7 +241,7 @@ TEST_F(StatsPluginEnd2EndTest, ErrorCount) { grpc::Status status = stub_->Echo(&context, request, &response); } } - absl::SleepFor(absl::Milliseconds(500)); + absl::SleepFor(absl::Milliseconds(500 * grpc_test_slowdown_factor())); TestUtils::Flush(); // Client side views can be tagged with custom tags. @@ -328,7 +328,7 @@ TEST_F(StatsPluginEnd2EndTest, RequestReceivedBytesPerRpc) { ASSERT_TRUE(status.ok()); EXPECT_EQ("foo", response.message()); } - absl::SleepFor(absl::Milliseconds(500)); + absl::SleepFor(absl::Milliseconds(500 * grpc_test_slowdown_factor())); TestUtils::Flush(); EXPECT_THAT(client_received_bytes_per_rpc_view.GetData().distribution_data(), @@ -376,7 +376,7 @@ TEST_F(StatsPluginEnd2EndTest, Latency) { // entire time spent making the RPC. const double max_time = absl::ToDoubleMilliseconds(absl::Now() - start_time); - absl::SleepFor(absl::Milliseconds(500)); + absl::SleepFor(absl::Milliseconds(500 * grpc_test_slowdown_factor())); TestUtils::Flush(); EXPECT_THAT( @@ -435,7 +435,7 @@ TEST_F(StatsPluginEnd2EndTest, CompletedRpcs) { ASSERT_TRUE(status.ok()); EXPECT_EQ("foo", response.message()); } - absl::SleepFor(absl::Milliseconds(500)); + absl::SleepFor(absl::Milliseconds(500 * grpc_test_slowdown_factor())); TestUtils::Flush(); EXPECT_THAT(client_completed_rpcs_view.GetData().int_data(), @@ -452,7 +452,7 @@ TEST_F(StatsPluginEnd2EndTest, CompletedRpcs) { auto stream = stub_->BidiStream(&ctx); ctx.TryCancel(); } - absl::SleepFor(absl::Milliseconds(500)); + absl::SleepFor(absl::Milliseconds(500 * grpc_test_slowdown_factor())); TestUtils::Flush(); EXPECT_THAT(client_completed_rpcs_view.GetData().int_data(), ::testing::Contains(::testing::Pair( @@ -483,7 +483,7 @@ TEST_F(StatsPluginEnd2EndTest, RequestReceivedMessagesPerRpc) { ASSERT_TRUE(status.ok()); EXPECT_EQ("foo", response.message()); } - absl::SleepFor(absl::Milliseconds(500)); + absl::SleepFor(absl::Milliseconds(500 * grpc_test_slowdown_factor())); TestUtils::Flush(); EXPECT_THAT( @@ -533,7 +533,7 @@ TEST_F(StatsPluginEnd2EndTest, TestRetryStatsWithoutAdditionalRetries) { ASSERT_TRUE(status.ok()); EXPECT_EQ("foo", response.message()); } - absl::SleepFor(absl::Milliseconds(500)); + absl::SleepFor(absl::Milliseconds(500 * grpc_test_slowdown_factor())); TestUtils::Flush(); EXPECT_THAT( client_retries_cumulative_view.GetData().int_data(), @@ -587,7 +587,7 @@ TEST_F(StatsPluginEnd2EndTest, TestRetryStatsWithAdditionalRetries) { grpc::Status status = stub_->Echo(&context, request, &response); EXPECT_EQ(status.error_code(), StatusCode::ABORTED); } - absl::SleepFor(absl::Milliseconds(500)); + absl::SleepFor(absl::Milliseconds(500 * grpc_test_slowdown_factor())); TestUtils::Flush(); EXPECT_THAT(client_retries_cumulative_view.GetData().int_data(), ::testing::UnorderedElementsAre( @@ -655,7 +655,7 @@ TEST_F(StatsPluginEnd2EndTest, TestAllSpansAreExported) { grpc::Status status = stub_->Echo(&context, request, &response); EXPECT_TRUE(status.ok()); } - absl::SleepFor(absl::Milliseconds(500)); + absl::SleepFor(absl::Milliseconds(500 * grpc_test_slowdown_factor())); ::opencensus::trace::exporter::SpanExporterTestPeer::ExportForTesting(); traces_recorder_->StopRecording(); auto recorded_spans = traces_recorder_->GetAndClearSpans();