Skip to content

Commit

Permalink
test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
RassK committed Mar 12, 2024
1 parent 8de29fa commit 41a19b2
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions test/IntegrationTests/KafkaTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ public KafkaTests(ITestOutputHelper testOutputHelper)
[Theory]
[Trait("Category", "EndToEnd")]
[Trait("Containers", "Linux")]
[MemberData(nameof(LibraryVersion.Kafka), MemberType = typeof(LibraryVersion))]
// [MemberData(nameof(LibraryVersion.Kafka), MemberType = typeof(LibraryVersion))]
[InlineData(new object[] { "2.2.0" })]
public void SubmitsTraces(string packageVersion)
{
var topicName = $"test-topic-{packageVersion}";
Expand All @@ -56,17 +57,17 @@ public void SubmitsTraces(string packageVersion)
collector.Expect(KafkaInstrumentationScopeName, span => span.Kind == Span.Types.SpanKind.Producer && ValidateProduceExceptionSpan(span, topicName), "Failed Produce attempt without delivery handler set.");
collector.Expect(KafkaInstrumentationScopeName, span => span.Kind == Span.Types.SpanKind.Producer && ValidateResultProcessingProduceExceptionSpan(span, topicName), "Failed ProduceAsync attempt.");

if (packageVersion == string.Empty || Version.Parse(packageVersion) >= new Version(2, 3, 0))
{
// Failed consume attempt.
collector.Expect(KafkaInstrumentationScopeName, span => span.Kind == Span.Types.SpanKind.Consumer && ValidateConsumeExceptionSpan(span, topicName), "Failed Consume attempt.");
}
else
if (packageVersion != string.Empty && Version.Parse(packageVersion) == new Version(1, 4, 0))
{
// For 1.4.0 null is returned when attempting to read from non-existent topic,
// and no exception is thrown.
collector.Expect(KafkaInstrumentationScopeName, span => span.Kind == Span.Types.SpanKind.Consumer && ValidateEmptyReadConsumerSpan(span, topicName), "Successful Consume attempt that returned no message.");
}
else
{
// Failed consume attempt.
collector.Expect(KafkaInstrumentationScopeName, span => span.Kind == Span.Types.SpanKind.Consumer && ValidateConsumeExceptionSpan(span, topicName), "Failed Consume attempt.");
}

// Successful produce attempts after topic was created with admin client.
collector.Expect(KafkaInstrumentationScopeName, span => span.Kind == Span.Types.SpanKind.Producer && ValidateProducerSpan(span, topicName, 0), "Successful ProduceAsync attempt.");
Expand Down

0 comments on commit 41a19b2

Please sign in to comment.