[census] Add time scaling to test (#30851)

pull/30076/head
Craig Tiller 2 years ago committed by GitHub
parent e313ac8398
commit fed6c180e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      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();

Loading…
Cancel
Save