Skip to content

Commit d5b47cb

Browse files
authored
[Resources.AWS] Execute tests against .NET9 (#2328)
1 parent 32bc2ca commit d5b47cb

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

build/Common.nonprod.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
<OpenTelemetryExporterInMemoryPkgVer>$(OpenTelemetryCoreLatestVersion)</OpenTelemetryExporterInMemoryPkgVer>
3232
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
3333
<SupportedNetTargets>net9.0;net8.0</SupportedNetTargets>
34-
<SupportedNetTargetsWithoutNet9>net8.0</SupportedNetTargetsWithoutNet9>
3534
<XUnitRunnerVisualStudioPkgVer>[2.8.2,3.0)</XUnitRunnerVisualStudioPkgVer>
3635
<XUnitPkgVer>[2.9.0,3.0)</XUnitPkgVer>
3736
<WiremockNetPkgVer>[1.6.3,2.0)</WiremockNetPkgVer>

test/OpenTelemetry.Resources.AWS.Tests/Http/ServerCertificateValidationProviderTests.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ public void TestValidCertificate()
2323

2424
Assert.NotNull(serverCertificateValidationProvider);
2525

26+
#if NET9_0_OR_GREATER
27+
var certificate = X509CertificateLoader.LoadCertificateFromFile(certificateUploader.FilePath);
28+
#else
2629
var certificate = new X509Certificate2(certificateUploader.FilePath);
30+
#endif
2731
X509Chain chain = new X509Chain();
2832
chain.Build(certificate);
2933

@@ -65,7 +69,12 @@ public void TestCallbackWithNullChain()
6569
ServerCertificateValidationProvider.FromCertificateFile(certificateUploader.FilePath, NoopServerCertificateValidationEventSource.Instance);
6670

6771
Assert.NotNull(serverCertificateValidationProvider);
68-
Assert.False(serverCertificateValidationProvider.ValidationCallback(this, new X509Certificate2(certificateUploader.FilePath), null, default));
72+
#if NET9_0_OR_GREATER
73+
var certificate = X509CertificateLoader.LoadCertificateFromFile(certificateUploader.FilePath);
74+
#else
75+
var certificate = new X509Certificate2(certificateUploader.FilePath);
76+
#endif
77+
Assert.False(serverCertificateValidationProvider.ValidationCallback(this, certificate, null, default));
6978
}
7079
}
7180

test/OpenTelemetry.Resources.AWS.Tests/OpenTelemetry.Resources.AWS.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
5-
<TargetFrameworks>$(SupportedNetTargetsWithoutNet9)</TargetFrameworks>
5+
<TargetFrameworks>$(SupportedNetTargets)</TargetFrameworks>
66
<TargetFrameworks Condition="$(OS) == 'Windows_NT'">$(TargetFrameworks);$(NetFrameworkMinimumSupportedVersion)</TargetFrameworks>
77
<Description>Unit test project for AWS Detector for OpenTelemetry.</Description>
88
</PropertyGroup>

0 commit comments

Comments
 (0)