Skip to content

Commit

Permalink
[Resources.AWS] Execute tests against .NET9 (#2328)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kielek authored Nov 18, 2024
1 parent 32bc2ca commit d5b47cb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 0 additions & 1 deletion build/Common.nonprod.props
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
<OpenTelemetryExporterInMemoryPkgVer>$(OpenTelemetryCoreLatestVersion)</OpenTelemetryExporterInMemoryPkgVer>
<!-- OmniSharp/VS Code requires TargetFrameworks to be in descending order for IntelliSense and analysis. -->
<SupportedNetTargets>net9.0;net8.0</SupportedNetTargets>
<SupportedNetTargetsWithoutNet9>net8.0</SupportedNetTargetsWithoutNet9>
<XUnitRunnerVisualStudioPkgVer>[2.8.2,3.0)</XUnitRunnerVisualStudioPkgVer>
<XUnitPkgVer>[2.9.0,3.0)</XUnitPkgVer>
<WiremockNetPkgVer>[1.6.3,2.0)</WiremockNetPkgVer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ public void TestValidCertificate()

Assert.NotNull(serverCertificateValidationProvider);

#if NET9_0_OR_GREATER
var certificate = X509CertificateLoader.LoadCertificateFromFile(certificateUploader.FilePath);
#else
var certificate = new X509Certificate2(certificateUploader.FilePath);
#endif
X509Chain chain = new X509Chain();
chain.Build(certificate);

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

Assert.NotNull(serverCertificateValidationProvider);
Assert.False(serverCertificateValidationProvider.ValidationCallback(this, new X509Certificate2(certificateUploader.FilePath), null, default));
#if NET9_0_OR_GREATER
var certificate = X509CertificateLoader.LoadCertificateFromFile(certificateUploader.FilePath);
#else
var certificate = new X509Certificate2(certificateUploader.FilePath);
#endif
Assert.False(serverCertificateValidationProvider.ValidationCallback(this, certificate, null, default));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

0 comments on commit d5b47cb

Please sign in to comment.