Skip to content

Commit

Permalink
[OpenCensus Test] Don't depend on compression algorithm (grpc#32863)
Browse files Browse the repository at this point in the history
We shouldn't depend on how much the compression algorithm compresses the
bytes to. This is causing flakiness internally.

<!--

If you know who should review your pull request, please assign it to
that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the
appropriate
lang label.

-->
  • Loading branch information
yashykt authored Apr 14, 2023
1 parent 638dad0 commit 4a1bf87
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/cpp/ext/filters/census/stats_plugin_end2end_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ bool IsAnnotationPresent(
std::vector<opencensus::trace::exporter::SpanData>::const_iterator span,
absl::string_view annotation) {
for (const auto& event : span->annotations().events()) {
if (event.event().description() == annotation) {
if (absl::StrContains(event.event().description(), annotation)) {
return true;
}
}
Expand Down Expand Up @@ -787,10 +787,10 @@ TEST_F(StatsPluginEnd2EndTest, TestMessageSizeWithCompressionAnnotations) {
ASSERT_NE(attempt_span_data, recorded_spans.end());
EXPECT_TRUE(
IsAnnotationPresent(attempt_span_data, "Send message: 1026 bytes"));
EXPECT_TRUE(IsAnnotationPresent(attempt_span_data,
"Send compressed message: 31 bytes"));
// We don't know what the exact compressed message size would be
EXPECT_TRUE(
IsAnnotationPresent(attempt_span_data, "Received message: 31 bytes"));
IsAnnotationPresent(attempt_span_data, "Send compressed message:"));
EXPECT_TRUE(IsAnnotationPresent(attempt_span_data, "Received message:"));
EXPECT_TRUE(IsAnnotationPresent(attempt_span_data,
"Received decompressed message: 1026 bytes"));
// Check presence of message size annotations in server span
Expand All @@ -799,10 +799,10 @@ TEST_F(StatsPluginEnd2EndTest, TestMessageSizeWithCompressionAnnotations) {
ASSERT_NE(attempt_span_data, recorded_spans.end());
EXPECT_TRUE(
IsAnnotationPresent(server_span_data, "Send message: 1026 bytes"));
EXPECT_TRUE(IsAnnotationPresent(attempt_span_data,
"Send compressed message: 31 bytes"));
// We don't know what the exact compressed message size would be
EXPECT_TRUE(
IsAnnotationPresent(server_span_data, "Received message: 31 bytes"));
IsAnnotationPresent(attempt_span_data, "Send compressed message:"));
EXPECT_TRUE(IsAnnotationPresent(server_span_data, "Received message:"));
EXPECT_TRUE(IsAnnotationPresent(server_span_data,
"Received decompressed message: 1026 bytes"));
}
Expand Down

0 comments on commit 4a1bf87

Please sign in to comment.