Skip to content

Commit bc1dd57

Browse files
Cleaning up integration tests further, removing isExternalSpan and reducing use of metadataSchemaVersions
1 parent 34f35ab commit bc1dd57

File tree

12 files changed

+46
-521
lines changed

12 files changed

+46
-521
lines changed

tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsDynamoDbTests.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,15 @@ public static IEnumerable<object[]> GetEnabledConfig()
3030
=> from packageVersionArray in PackageVersions.AwsDynamoDb
3131
select new[] { packageVersionArray[0] };
3232

33-
public override Result ValidateIntegrationSpan(MockSpan span, string metadataSchemaVersion) => span.IsAwsDynamoDb(metadataSchemaVersion);
33+
public override Result ValidateIntegrationSpan(MockSpan span, string metadataSchemaVersion) => span.IsAwsDynamoDb();
3434

3535
[SkippableTheory]
3636
[MemberData(nameof(GetEnabledConfig))]
3737
[Trait("Category", "EndToEnd")]
3838
public async Task SubmitsTraces(string packageVersion)
3939
{
4040
string metadataSchemaVersion = "v0";
41-
SetEnvironmentVariable("DD_TRACE_SPAN_ATTRIBUTE_SCHEMA", metadataSchemaVersion);
42-
var isExternalSpan = metadataSchemaVersion == "v0";
43-
var clientSpanServiceName = isExternalSpan ? $"{EnvironmentHelper.FullSampleName}-aws-dynamodb" : EnvironmentHelper.FullSampleName;
41+
var clientSpanServiceName = $"{EnvironmentHelper.FullSampleName}-aws-dynamodb";
4442

4543
using var telemetry = this.ConfigureTelemetry();
4644
using (var agent = EnvironmentHelper.GetMockAgent())
@@ -58,7 +56,7 @@ public async Task SubmitsTraces(string packageVersion)
5856
span => span.Tags.TryGetValue("component", out var component) && component == "aws-sdk");
5957

6058
dynamoDbSpans.Should().NotBeEmpty();
61-
ValidateIntegrationSpans(dynamoDbSpans, metadataSchemaVersion, expectedServiceName: clientSpanServiceName, isExternalSpan);
59+
ValidateIntegrationSpans(dynamoDbSpans, metadataSchemaVersion, expectedServiceName: clientSpanServiceName, true);
6260

6361
var host = Environment.GetEnvironmentVariable("AWS_SDK_HOST");
6462

tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsEventBridgeTests.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ public static IEnumerable<object[]> GetEnabledConfig()
3232

3333
public override Result ValidateIntegrationSpan(MockSpan span, string metadataSchemaVersion) => span.Tags["span.kind"] switch
3434
{
35-
SpanKinds.Consumer => span.IsAwsEventBridgeInbound(metadataSchemaVersion),
36-
SpanKinds.Producer => span.IsAwsEventBridgeOutbound(metadataSchemaVersion),
37-
SpanKinds.Client => span.IsAwsEventBridgeRequest(metadataSchemaVersion),
35+
SpanKinds.Consumer => span.IsAwsEventBridgeInbound(),
36+
SpanKinds.Producer => span.IsAwsEventBridgeOutbound(),
37+
SpanKinds.Client => span.IsAwsEventBridgeRequest(),
3838
_ => throw new ArgumentException($"span.Tags[\"span.kind\"] is not a supported value for the AWS EventBridge integration: {span.Tags["span.kind"]}", nameof(span)),
3939
};
4040

@@ -44,9 +44,7 @@ public static IEnumerable<object[]> GetEnabledConfig()
4444
public async Task SubmitsTraces(string packageVersion)
4545
{
4646
string metadataSchemaVersion = "v0";
47-
SetEnvironmentVariable("DD_TRACE_SPAN_ATTRIBUTE_SCHEMA", metadataSchemaVersion);
48-
var isExternalSpan = metadataSchemaVersion == "v0";
49-
var clientSpanServiceName = isExternalSpan ? $"{EnvironmentHelper.FullSampleName}-aws-eventbridge" : EnvironmentHelper.FullSampleName;
47+
var clientSpanServiceName = $"{EnvironmentHelper.FullSampleName}-aws-eventbridge";
5048

5149
using var telemetry = this.ConfigureTelemetry();
5250
using (var agent = EnvironmentHelper.GetMockAgent())
@@ -63,7 +61,7 @@ public async Task SubmitsTraces(string packageVersion)
6361
var eventBridgeSpans = spans.Where(span => span.Tags.TryGetValue("component", out var component) && component == "aws-sdk");
6462

6563
eventBridgeSpans.Should().NotBeEmpty();
66-
ValidateIntegrationSpans(eventBridgeSpans, metadataSchemaVersion, expectedServiceName: clientSpanServiceName, isExternalSpan);
64+
ValidateIntegrationSpans(eventBridgeSpans, metadataSchemaVersion, expectedServiceName: clientSpanServiceName, true);
6765

6866
var host = Environment.GetEnvironmentVariable("AWS_SDK_HOST");
6967

tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsKinesisTests.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static IEnumerable<object[]> GetEnabledConfig()
3232

3333
public override Result ValidateIntegrationSpan(MockSpan span, string metadataSchemaVersion) => span.Tags["span.kind"] switch
3434
{
35-
SpanKinds.Producer => span.IsAwsKinesisOutbound(metadataSchemaVersion),
35+
SpanKinds.Producer => span.IsAwsKinesisOutbound(),
3636
_ => throw new ArgumentException($"span.Tags[\"span.kind\"] is not a supported value for the AWS Kinesis integration: {span.Tags["span.kind"]}", nameof(span)),
3737
};
3838

@@ -42,9 +42,7 @@ public static IEnumerable<object[]> GetEnabledConfig()
4242
public async Task SubmitsTraces(string packageVersion)
4343
{
4444
string metadataSchemaVersion = "v0";
45-
SetEnvironmentVariable("DD_TRACE_SPAN_ATTRIBUTE_SCHEMA", metadataSchemaVersion);
46-
var isExternalSpan = metadataSchemaVersion == "v0";
47-
var clientSpanServiceName = isExternalSpan ? $"{EnvironmentHelper.FullSampleName}-aws-kinesis" : EnvironmentHelper.FullSampleName;
45+
var clientSpanServiceName = $"{EnvironmentHelper.FullSampleName}-aws-kinesis";
4846

4947
using var telemetry = this.ConfigureTelemetry();
5048
using (var agent = EnvironmentHelper.GetMockAgent())
@@ -62,7 +60,7 @@ public async Task SubmitsTraces(string packageVersion)
6260
span => span.Tags.TryGetValue("component", out var component) && component == "aws-sdk");
6361

6462
kinesisSpans.Should().NotBeEmpty();
65-
ValidateIntegrationSpans(kinesisSpans, metadataSchemaVersion, expectedServiceName: clientSpanServiceName, isExternalSpan);
63+
ValidateIntegrationSpans(kinesisSpans, metadataSchemaVersion, expectedServiceName: clientSpanServiceName, true);
6664

6765
var host = Environment.GetEnvironmentVariable("AWS_SDK_HOST");
6866

tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsS3Tests.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static IEnumerable<object[]> GetEnabledConfig()
3333

3434
public override Result ValidateIntegrationSpan(MockSpan span, string metadataSchemaVersion) => span.Tags["span.kind"] switch
3535
{
36-
SpanKinds.Client => span.IsAwsS3Request(metadataSchemaVersion),
36+
SpanKinds.Client => span.IsAwsS3Request(),
3737
_ => throw new ArgumentException($"span.Tags[\"span.kind\"] is not a supported value for the AWS S3 integration: {span.Tags["span.kind"]}", nameof(span)),
3838
};
3939

@@ -43,9 +43,7 @@ public static IEnumerable<object[]> GetEnabledConfig()
4343
public async Task SubmitsTraces(string packageVersion)
4444
{
4545
string metadataSchemaVersion = "v0";
46-
SetEnvironmentVariable("DD_TRACE_SPAN_ATTRIBUTE_SCHEMA", metadataSchemaVersion);
47-
var isExternalSpan = metadataSchemaVersion == "v0";
48-
var clientSpanServiceName = isExternalSpan ? $"{EnvironmentHelper.FullSampleName}-aws-s3" : EnvironmentHelper.FullSampleName;
46+
var clientSpanServiceName = $"{EnvironmentHelper.FullSampleName}-aws-s3";
4947

5048
using var telemetry = this.ConfigureTelemetry();
5149
using (var agent = EnvironmentHelper.GetMockAgent())
@@ -63,7 +61,7 @@ public async Task SubmitsTraces(string packageVersion)
6361
var s3Spans = spans.Where(span => span.Tags.TryGetValue("component", out var component) && component == "aws-sdk");
6462

6563
s3Spans.Should().NotBeEmpty();
66-
ValidateIntegrationSpans(s3Spans, metadataSchemaVersion, expectedServiceName: clientSpanServiceName, isExternalSpan);
64+
ValidateIntegrationSpans(s3Spans, metadataSchemaVersion, expectedServiceName: clientSpanServiceName, true);
6765

6866
var host = Environment.GetEnvironmentVariable("AWS_SDK_HOST");
6967

tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsSnsTests.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ public static IEnumerable<object[]> GetEnabledConfig()
3333

3434
public override Result ValidateIntegrationSpan(MockSpan span, string metadataSchemaVersion) => span.Tags["span.kind"] switch
3535
{
36-
SpanKinds.Consumer => span.IsAwsSnsInbound(metadataSchemaVersion),
37-
SpanKinds.Producer => span.IsAwsSnsOutbound(metadataSchemaVersion),
38-
SpanKinds.Client => span.IsAwsSnsRequest(metadataSchemaVersion),
36+
SpanKinds.Consumer => span.IsAwsSnsInbound(),
37+
SpanKinds.Producer => span.IsAwsSnsOutbound(),
38+
SpanKinds.Client => span.IsAwsSnsRequest(),
3939
_ => throw new ArgumentException($"span.Tags[\"span.kind\"] is not a supported value for the AWS SNS integration: {span.Tags["span.kind"]}", nameof(span)),
4040
};
4141

@@ -45,9 +45,7 @@ public static IEnumerable<object[]> GetEnabledConfig()
4545
public async Task SubmitsTraces(string packageVersion)
4646
{
4747
string metadataSchemaVersion = "v0";
48-
SetEnvironmentVariable("DD_TRACE_SPAN_ATTRIBUTE_SCHEMA", metadataSchemaVersion);
49-
var isExternalSpan = metadataSchemaVersion == "v0";
50-
var clientSpanServiceName = isExternalSpan ? $"{EnvironmentHelper.FullSampleName}-aws-sns" : EnvironmentHelper.FullSampleName;
48+
var clientSpanServiceName = $"{EnvironmentHelper.FullSampleName}-aws-sns";
5149

5250
using var telemetry = this.ConfigureTelemetry();
5351
using (var agent = EnvironmentHelper.GetMockAgent())
@@ -64,7 +62,7 @@ public async Task SubmitsTraces(string packageVersion)
6462
var snsSpans = spans.Where(span => span.Tags.TryGetValue("component", out var component) && component == "aws-sdk");
6563

6664
snsSpans.Should().NotBeEmpty();
67-
ValidateIntegrationSpans(snsSpans, metadataSchemaVersion, expectedServiceName: clientSpanServiceName, isExternalSpan);
65+
ValidateIntegrationSpans(snsSpans, metadataSchemaVersion, expectedServiceName: clientSpanServiceName, true);
6866

6967
var host = Environment.GetEnvironmentVariable("AWS_SDK_HOST");
7068

tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsSqsTests.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ public static IEnumerable<object[]> GetEnabledConfig()
3434

3535
public override Result ValidateIntegrationSpan(MockSpan span, string metadataSchemaVersion) => span.Tags["span.kind"] switch
3636
{
37-
SpanKinds.Consumer => span.IsAwsSqsInbound(metadataSchemaVersion),
38-
SpanKinds.Producer => span.IsAwsSqsOutbound(metadataSchemaVersion),
39-
SpanKinds.Client => span.IsAwsSqsRequest(metadataSchemaVersion),
37+
SpanKinds.Consumer => span.IsAwsSqsInbound(),
38+
SpanKinds.Producer => span.IsAwsSqsOutbound(),
39+
SpanKinds.Client => span.IsAwsSqsRequest(),
4040
_ => throw new ArgumentException($"span.Tags[\"span.kind\"] is not a supported value for the AWS SQS integration: {span.Tags["span.kind"]}", nameof(span)),
4141
};
4242

@@ -46,9 +46,7 @@ public static IEnumerable<object[]> GetEnabledConfig()
4646
public async Task SubmitsTraces(string packageVersion)
4747
{
4848
string metadataSchemaVersion = "v0";
49-
SetEnvironmentVariable("DD_TRACE_SPAN_ATTRIBUTE_SCHEMA", metadataSchemaVersion);
50-
var isExternalSpan = metadataSchemaVersion == "v0";
51-
var clientSpanServiceName = isExternalSpan ? $"{EnvironmentHelper.FullSampleName}-aws-sqs" : EnvironmentHelper.FullSampleName;
49+
var clientSpanServiceName = $"{EnvironmentHelper.FullSampleName}-aws-sqs";
5250

5351
using var telemetry = this.ConfigureTelemetry();
5452
using (var agent = EnvironmentHelper.GetMockAgent())
@@ -66,7 +64,7 @@ public async Task SubmitsTraces(string packageVersion)
6664
span => span.Tags.TryGetValue("component", out var component) && component == "aws-sdk");
6765

6866
sqsSpans.Should().NotBeEmpty();
69-
ValidateIntegrationSpans(sqsSpans, metadataSchemaVersion, expectedServiceName: clientSpanServiceName, isExternalSpan);
67+
ValidateIntegrationSpans(sqsSpans, metadataSchemaVersion, expectedServiceName: clientSpanServiceName, true);
7068

7169
var host = Environment.GetEnvironmentVariable("AWS_SDK_HOST");
7270

tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsStepFunctionsTests.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ public static IEnumerable<object[]> GetEnabledConfig()
3232

3333
public override Result ValidateIntegrationSpan(MockSpan span, string metadataSchemaVersion) => span.Tags["span.kind"] switch
3434
{
35-
SpanKinds.Consumer => span.IsAwsStepFunctionsInbound(metadataSchemaVersion),
36-
SpanKinds.Producer => span.IsAwsStepFunctionsOutbound(metadataSchemaVersion),
37-
SpanKinds.Client => span.IsAwsStepFunctionsRequest(metadataSchemaVersion),
35+
SpanKinds.Consumer => span.IsAwsStepFunctionsInbound(),
36+
SpanKinds.Producer => span.IsAwsStepFunctionsOutbound(),
37+
SpanKinds.Client => span.IsAwsStepFunctionsRequest(),
3838
_ => throw new ArgumentException($"span.Tags[\"span.kind\"] is not a supported value for the AWS Step Functions integration: {span.Tags["span.kind"]}", nameof(span)),
3939
};
4040

@@ -44,9 +44,7 @@ public static IEnumerable<object[]> GetEnabledConfig()
4444
public async Task SubmitsTraces(string packageVersion)
4545
{
4646
string metadataSchemaVersion = "v0";
47-
SetEnvironmentVariable("DD_TRACE_SPAN_ATTRIBUTE_SCHEMA", metadataSchemaVersion);
48-
var isExternalSpan = metadataSchemaVersion == "v0";
49-
var clientSpanServiceName = isExternalSpan ? $"{EnvironmentHelper.FullSampleName}-aws-stepfunctions" : EnvironmentHelper.FullSampleName;
47+
var clientSpanServiceName = $"{EnvironmentHelper.FullSampleName}-aws-stepfunctions";
5048

5149
using var telemetry = this.ConfigureTelemetry();
5250
using (var agent = EnvironmentHelper.GetMockAgent())
@@ -63,7 +61,7 @@ public async Task SubmitsTraces(string packageVersion)
6361
var stepFunctionsSpans = spans.Where(span => span.Tags.TryGetValue("component", out var component) && component == "aws-sdk");
6462

6563
stepFunctionsSpans.Should().NotBeEmpty();
66-
ValidateIntegrationSpans(stepFunctionsSpans, metadataSchemaVersion, expectedServiceName: clientSpanServiceName, isExternalSpan);
64+
ValidateIntegrationSpans(stepFunctionsSpans, metadataSchemaVersion, expectedServiceName: clientSpanServiceName, true);
6765

6866
var host = Environment.GetEnvironmentVariable("AWS_SDK_HOST");
6967

tracer/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/DataStreamsMonitoringAwsKinesisTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public static IEnumerable<object[]> GetEnabledConfig()
3434

3535
public override Result ValidateIntegrationSpan(MockSpan span, string metadataSchemaVersion) => span.Tags["span.kind"] switch
3636
{
37-
SpanKinds.Producer => span.IsAwsKinesisOutbound(metadataSchemaVersion),
37+
SpanKinds.Producer => span.IsAwsKinesisOutbound(),
3838
_ => throw new ArgumentException($"span.Tags[\"span.kind\"] is not a supported value for the AWS Kinesis integration: {span.Tags["span.kind"]}", nameof(span)),
3939
};
4040

0 commit comments

Comments
 (0)