Execute SqlClient tests also on .NET Fx 4.8.1 (#3412)
This commit is contained in:
parent
77256e3a96
commit
0a7c748a9b
|
|
@ -1,52 +0,0 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#if NETFRAMEWORK
|
||||
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace IntegrationTests.Helpers;
|
||||
|
||||
internal static class RuntimeHelper
|
||||
{
|
||||
// https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed
|
||||
public static string? GetRuntimeVersion()
|
||||
{
|
||||
const string subkey = @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\";
|
||||
|
||||
using (var ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(subkey))
|
||||
{
|
||||
if (ndpKey != null && ndpKey.GetValue("Release") != null)
|
||||
{
|
||||
return CheckFor45PlusVersion((int)ndpKey.GetValue("Release"));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// Checking the version using >= enables forward compatibility.
|
||||
static string CheckFor45PlusVersion(int releaseKey)
|
||||
{
|
||||
return releaseKey switch
|
||||
{
|
||||
>= 533320 => "4.8.1+",
|
||||
>= 528040 => "4.8",
|
||||
>= 461808 => "4.7.2",
|
||||
>= 461308 => "4.7.1",
|
||||
>= 460798 => "4.7",
|
||||
>= 394802 => "4.6.2",
|
||||
>= 394254 => "4.6.1",
|
||||
>= 393295 => "4.6",
|
||||
>= 379893 => "4.5.2",
|
||||
>= 378675 => "4.5.1",
|
||||
>= 378389 => "4.5",
|
||||
_ =>
|
||||
// This code should never execute. A non-null release key should mean
|
||||
// that 4.5 or later is installed.
|
||||
"No 4.5+"
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -15,7 +15,7 @@ public class SqlClientSystemDataTests : TestHelper
|
|||
{
|
||||
}
|
||||
|
||||
[IgnoreRunningOnNet481Fact]
|
||||
[Fact]
|
||||
[Trait("Category", "EndToEnd")]
|
||||
public void SubmitTraces()
|
||||
{
|
||||
|
|
@ -28,17 +28,4 @@ public class SqlClientSystemDataTests : TestHelper
|
|||
collector.AssertExpectations();
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class IgnoreRunningOnNet481Fact : FactAttribute
|
||||
{
|
||||
public IgnoreRunningOnNet481Fact()
|
||||
{
|
||||
var netVersion = RuntimeHelper.GetRuntimeVersion();
|
||||
if (netVersion == "4.8.1+")
|
||||
{
|
||||
// https://github.com/open-telemetry/opentelemetry-dotnet/issues/3901
|
||||
Skip = "NET Framework 4.8.1 is skipped due bug.";
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue