Skip to content

Commit

Permalink
Added assertions for span counts to compression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasstadler committed Feb 21, 2022
1 parent 65809ef commit beac422
Showing 1 changed file with 68 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ void testCompositeSpanIsCreated() {
assertCompositeSpan(reportedSpans.get(0), 4);
assertThat(reportedSpans.get(0).getComposite().getSum()).isEqualTo(1234 + (3456 - 2345) + (4567 - 3456) + (4556 - 3467));
assertThat(reportedSpans.get(0).getDuration()).isEqualTo(4567);

SpanCount spanCount = reporter.getFirstTransaction().getSpanCount();
assertThat(spanCount.getReported().get()).isEqualTo(1);
assertThat(spanCount.getDropped().get()).isEqualTo(3);
}

@Test
Expand All @@ -121,6 +125,10 @@ void testUnknownOutcomeStopsRegularCompression() {
assertThat(reportedSpans).hasSize(2);
assertThat(reportedSpans.get(0).isComposite()).isFalse();
assertThat(reportedSpans.get(1).isComposite()).isFalse();

SpanCount spanCount = reporter.getFirstTransaction().getSpanCount();
assertThat(spanCount.getReported().get()).isEqualTo(2);
assertThat(spanCount.getDropped().get()).isEqualTo(0);
}

@Test
Expand All @@ -135,6 +143,10 @@ void testUnknownOutcomeStopsCompositeCompression() {
assertThat(reportedSpans).hasSize(2);
assertCompositeSpan(reportedSpans.get(0), 2);
assertThat(reportedSpans.get(1).isComposite()).isFalse();

SpanCount spanCount = reporter.getFirstTransaction().getSpanCount();
assertThat(spanCount.getReported().get()).isEqualTo(2);
assertThat(spanCount.getDropped().get()).isEqualTo(1);
}

@Test
Expand All @@ -148,6 +160,10 @@ void testFailedOutcomeStopsRegularCompression() {
assertThat(reportedSpans).hasSize(2);
assertThat(reportedSpans.get(0).isComposite()).isFalse();
assertThat(reportedSpans.get(1).isComposite()).isFalse();

SpanCount spanCount = reporter.getFirstTransaction().getSpanCount();
assertThat(spanCount.getReported().get()).isEqualTo(2);
assertThat(spanCount.getDropped().get()).isEqualTo(0);
}

@Test
Expand All @@ -162,6 +178,10 @@ void testFailedOutcomeStopsCompositeCompression() {
assertThat(reportedSpans).hasSize(2);
assertCompositeSpan(reportedSpans.get(0), 2);
assertThat(reportedSpans.get(1).isComposite()).isFalse();

SpanCount spanCount = reporter.getFirstTransaction().getSpanCount();
assertThat(spanCount.getReported().get()).isEqualTo(2);
assertThat(spanCount.getDropped().get()).isEqualTo(1);
}

@Test
Expand All @@ -179,6 +199,10 @@ void testContextPropagationStopsRegularCompression() {
assertThat(reportedSpans).hasSize(2);
assertThat(reportedSpans.get(0).isComposite()).isFalse();
assertThat(reportedSpans.get(1).isComposite()).isFalse();

SpanCount spanCount = reporter.getFirstTransaction().getSpanCount();
assertThat(spanCount.getReported().get()).isEqualTo(2);
assertThat(spanCount.getDropped().get()).isEqualTo(0);
}

@Test
Expand All @@ -197,6 +221,10 @@ void testContextPropagationStopsCompositeCompression() {
assertThat(reportedSpans).hasSize(2);
assertCompositeSpan(reportedSpans.get(0), 2);
assertThat(reportedSpans.get(1).isComposite()).isFalse();

SpanCount spanCount = reporter.getFirstTransaction().getSpanCount();
assertThat(spanCount.getReported().get()).isEqualTo(2);
assertThat(spanCount.getDropped().get()).isEqualTo(1);
}

@Test
Expand All @@ -210,6 +238,10 @@ void testNonExitSpanStopsRegularCompression() {
assertThat(reportedSpans).hasSize(2);
assertThat(reportedSpans.get(0).isComposite()).isFalse();
assertThat(reportedSpans.get(1).isComposite()).isFalse();

SpanCount spanCount = reporter.getFirstTransaction().getSpanCount();
assertThat(spanCount.getReported().get()).isEqualTo(2);
assertThat(spanCount.getDropped().get()).isEqualTo(0);
}

@Test
Expand All @@ -224,6 +256,10 @@ void testNonExitSpanStopsCompositeCompression() {
assertThat(reportedSpans).hasSize(2);
assertCompositeSpan(reportedSpans.get(0), 2);
assertThat(reportedSpans.get(1).isComposite()).isFalse();

SpanCount spanCount = reporter.getFirstTransaction().getSpanCount();
assertThat(spanCount.getReported().get()).isEqualTo(2);
assertThat(spanCount.getDropped().get()).isEqualTo(1);
}

@Test
Expand All @@ -237,6 +273,10 @@ void testDifferentTypeStopsRegularCompression() {
assertThat(reportedSpans).hasSize(2);
assertThat(reportedSpans.get(0).isComposite()).isFalse();
assertThat(reportedSpans.get(1).isComposite()).isFalse();

SpanCount spanCount = reporter.getFirstTransaction().getSpanCount();
assertThat(spanCount.getReported().get()).isEqualTo(2);
assertThat(spanCount.getDropped().get()).isEqualTo(0);
}

@Test
Expand All @@ -251,6 +291,10 @@ void testDifferentTypeStopsCompositeCompression() {
assertThat(reportedSpans).hasSize(2);
assertCompositeSpan(reportedSpans.get(0), 2);
assertThat(reportedSpans.get(1).isComposite()).isFalse();

SpanCount spanCount = reporter.getFirstTransaction().getSpanCount();
assertThat(spanCount.getReported().get()).isEqualTo(2);
assertThat(spanCount.getDropped().get()).isEqualTo(1);
}

@Test
Expand All @@ -264,6 +308,10 @@ void testDifferentSubtypeStopsRegularCompression() {
assertThat(reportedSpans).hasSize(2);
assertThat(reportedSpans.get(0).isComposite()).isFalse();
assertThat(reportedSpans.get(1).isComposite()).isFalse();

SpanCount spanCount = reporter.getFirstTransaction().getSpanCount();
assertThat(spanCount.getReported().get()).isEqualTo(2);
assertThat(spanCount.getDropped().get()).isEqualTo(0);
}

@Test
Expand All @@ -278,6 +326,10 @@ void testDifferentSubtypeStopsCompositeCompression() {
assertThat(reportedSpans).hasSize(2);
assertCompositeSpan(reportedSpans.get(0), 2);
assertThat(reportedSpans.get(1).isComposite()).isFalse();

SpanCount spanCount = reporter.getFirstTransaction().getSpanCount();
assertThat(spanCount.getReported().get()).isEqualTo(2);
assertThat(spanCount.getDropped().get()).isEqualTo(1);
}

@Test
Expand All @@ -297,6 +349,10 @@ void testSpanExceedingMaxDurationStopsRegularCompression() {
assertThat(reportedSpans).hasSize(2);
assertThat(reportedSpans.get(0).isComposite()).isFalse();
assertThat(reportedSpans.get(1).isComposite()).isFalse();

SpanCount spanCount = reporter.getFirstTransaction().getSpanCount();
assertThat(spanCount.getReported().get()).isEqualTo(2);
assertThat(spanCount.getDropped().get()).isEqualTo(0);
}

@Test
Expand All @@ -317,6 +373,10 @@ void testSpanExceedingMaxDurationStopsCompositeCompression() {
assertThat(reportedSpans).hasSize(2);
assertCompositeSpan(reportedSpans.get(0), 2);
assertThat(reportedSpans.get(1).isComposite()).isFalse();

SpanCount spanCount = reporter.getFirstTransaction().getSpanCount();
assertThat(spanCount.getReported().get()).isEqualTo(2);
assertThat(spanCount.getDropped().get()).isEqualTo(1);
}

@Test
Expand All @@ -332,6 +392,10 @@ void testDifferentDestinationServiceResourceStopsRegularCompression() {
assertThat(reportedSpans).hasSize(2);
assertThat(reportedSpans.get(0).isComposite()).isFalse();
assertThat(reportedSpans.get(1).isComposite()).isFalse();

SpanCount spanCount = reporter.getFirstTransaction().getSpanCount();
assertThat(spanCount.getReported().get()).isEqualTo(2);
assertThat(spanCount.getDropped().get()).isEqualTo(0);
}

@Test
Expand All @@ -348,6 +412,10 @@ void testDifferentDestinationServiceResourceStopsCompositeCompression() {
assertThat(reportedSpans).hasSize(2);
assertCompositeSpan(reportedSpans.get(0), 2);
assertThat(reportedSpans.get(1).isComposite()).isFalse();

SpanCount spanCount = reporter.getFirstTransaction().getSpanCount();
assertThat(spanCount.getReported().get()).isEqualTo(2);
assertThat(spanCount.getDropped().get()).isEqualTo(1);
}

protected static void runInTransactionScope(Consumer<AbstractSpan<?>> r) {
Expand Down

0 comments on commit beac422

Please sign in to comment.