Skip to content

Commit 1713173

Browse files
authored
CSHARP-5591: Configure MongoDB.Driver.Encryption.Tests to run on net472 target (#1692)
1 parent 79d97ed commit 1713173

File tree

13 files changed

+14
-51
lines changed

13 files changed

+14
-51
lines changed

build.cake

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,6 @@ Task("Test")
117117
items: GetFiles("./**/*.Tests.csproj").Where(name => !name.ToString().Contains("Atlas")),
118118
action: (BuildConfig buildConfig, Path testProject) =>
119119
{
120-
if (Environment.GetEnvironmentVariable("MONGODB_API_VERSION") != null &&
121-
testProject.ToString().Contains("Legacy"))
122-
{
123-
return; // Legacy tests are exempt from Version API testing
124-
}
125-
126120
var mongoX509ClientCertificatePath = Environment.GetEnvironmentVariable("MONGO_X509_CLIENT_CERTIFICATE_PATH");
127121
if (mongoX509ClientCertificatePath != null)
128122
{

build.ps1

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,16 @@ if($FoundDotNetCliVersion -ne $DotNetVersion) {
8989
New-Item -Path $InstallPath -ItemType Directory -Force | Out-Null;
9090
}
9191

92-
# N.B. We explicitly install .NET Core 2.1 and 3.1 because .NET 5.0 SDK can build those TFMs
92+
# N.B. We explicitly install .NET Core 3.1 because .NET 5.0 SDK can build those TFMs
9393
# but will silently upgrade to a more recent runtime to execute tests if the desired runtime
9494
# isn't available. For example, `dotnet run --framework netcoreapp3.0` will silently run
9595
# on .NET 5.0 if .NET Core 3.0 and 3.1 aren't installed.
96-
# This solution is admittedly hacky as .NET Core 2.1 and 3.1 won't be installed if
96+
# This solution is admittedly hacky as .NET Core 3.1 won't be installed if
9797
# $DOTNET_VERSION matches $DOTNET_INSTALLED_VERSION, but it minimizes the changes required
9898
# to install required dependencies on Evergreen.
9999
if ($IsMacOS -or $IsLinux) {
100100
$ScriptPath = Join-Path $InstallPath 'dotnet-install.sh'
101101
(New-Object System.Net.WebClient).DownloadFile($DotNetUnixInstallerUri, $ScriptPath);
102-
& bash $ScriptPath --install-dir "$InstallPath" --channel 2.1 --no-path
103102
& bash $ScriptPath --install-dir "$InstallPath" --channel 3.1 --no-path
104103
& bash $ScriptPath --install-dir "$InstallPath" --channel 5.0 --no-path
105104
& bash $ScriptPath --install-dir "$InstallPath" --channel 6.0 --no-path
@@ -111,7 +110,6 @@ if($FoundDotNetCliVersion -ne $DotNetVersion) {
111110
else {
112111
$ScriptPath = Join-Path $InstallPath 'dotnet-install.ps1'
113112
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, $ScriptPath);
114-
& $ScriptPath -Channel 2.1 -InstallDir $InstallPath;
115113
& $ScriptPath -Channel 3.1 -InstallDir $InstallPath;
116114
& $ScriptPath -Channel 5.0 -InstallDir $InstallPath;
117115
& $ScriptPath -Channel 6.0 -InstallDir $InstallPath;

build.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,17 @@ if [ "$DOTNET_VERSION" != "$DOTNET_INSTALLED_VERSION" ]; then
3333
mkdir "$SCRIPT_DIR/.dotnet"
3434
fi
3535
curl -Lfo "$SCRIPT_DIR/.dotnet/dotnet-install.sh" https://builds.dotnet.microsoft.com/dotnet/scripts/v1/dotnet-install.sh
36-
# N.B. We explicitly install .NET Core 2.1 and 3.1 because .NET 6.0 SDK can build those TFMs
36+
# N.B. We explicitly install .NET Core 3.1 because .NET 6.0 SDK can build those TFMs
3737
# but will silently upgrade to a more recent runtime to execute tests if the desired runtime
3838
# isn't available. For example, `dotnet run --framework netcoreapp3.0` will silently run
3939
# on .NET 6.0 if .NET Core 3.0 and 3.1 aren't installed.
40-
# This solution is admittedly hacky as .NET Core 2.1 and 3.1 won't be installed if
40+
# This solution is admittedly hacky as .NET Core 3.1 won't be installed if
4141
# $DOTNET_VERSION matches $DOTNET_INSTALLED_VERSION, but it minimizes the changes required
4242
# to install required dependencies on Evergreen.
4343
# Since ARM64 support was first added in .NET 6.0, the following commands will install:
4444
# | CPU | 2.1 | 3.1 | Latest |
4545
# | x64 | x64 | x64 | x64 |
4646
# | arm64 | x64 | x64 | arm64 |
47-
bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --channel 2.1 --architecture x64 --install-dir .dotnet --no-path
4847
bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --channel 3.1 --architecture x64 --install-dir .dotnet --no-path
4948
bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --channel 5.0 --architecture x64 --install-dir .dotnet --no-path
5049
bash "$SCRIPT_DIR/.dotnet/dotnet-install.sh" --channel 6.0 --install-dir .dotnet --no-path

tests/AstrolabeWorkloadExecutor/AstrolabeWorkloadExecutor.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
<Description>Astrolabe workload executor.</Description>
1818
</PropertyGroup>
1919

20-
<ItemGroup>
21-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0" />
22-
</ItemGroup>
23-
2420
<ItemGroup>
2521
<ProjectReference Include="../MongoDB.Driver.Tests/MongoDB.Driver.Tests.csproj" />
2622
</ItemGroup>

tests/AtlasConnectivity.Tests/AtlasConnectivity.Tests.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
<Description>Atlas connectivity tests.</Description>
1212
</PropertyGroup>
1313

14-
<ItemGroup>
15-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0" />
16-
</ItemGroup>
17-
1814
<PropertyGroup>
1915
<NoWarn>
2016
1701;1702; <!--https://github.com/dotnet/roslyn/issues/19640-->

tests/BuildProps/Tests.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
<ItemGroup>
4444
<PackageReference Include="FluentAssertions" Version="4.12.0" />
4545
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.2" />
46+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0" />
4647
<PackageReference Include="Moq" Version="4.9.0" />
4748
<PackageReference Include="xunit" Version="2.4.2" />
4849
<PackageReference Include="JunitXml.TestLogger" Version="2.1.81" />

tests/MongoDB.Bson.TestHelpers/MongoDB.Bson.TestHelpers.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
<Description>Helper classes applicable to test projects that reference MongoDB.Bson.</Description>
1212
</PropertyGroup>
1313

14-
<ItemGroup>
15-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0" />
16-
</ItemGroup>
17-
1814
<ItemGroup>
1915
<ProjectReference Include="..\..\src\MongoDB.Bson\MongoDB.Bson.csproj" />
2016
<ProjectReference Include="..\MongoDB.TestHelpers\MongoDB.TestHelpers.csproj" />

tests/MongoDB.Bson.Tests/MongoDB.Bson.Tests.csproj

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
<Description>MongoDB.Bson tests.</Description>
1212
</PropertyGroup>
1313

14-
<ItemGroup>
15-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0" />
16-
</ItemGroup>
17-
1814
<PropertyGroup>
1915
<NoWarn>
2016
1701;1702; <!--https://github.com/dotnet/roslyn/issues/19640-->
@@ -31,10 +27,10 @@
3127
</NoWarn>
3228
</PropertyGroup>
3329

34-
<ItemGroup>
30+
<ItemGroup Condition="'$(TargetFramework)' == 'net472'">
3531
<Reference Include="Microsoft.CSharp" />
3632
</ItemGroup>
37-
33+
3834
<ItemGroup>
3935
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
4036
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />

tests/MongoDB.Driver.Encryption.Tests/MongoDB.Driver.Encryption.Tests.csproj

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
<Import Project="..\BuildProps\Tests.Build.props" />
2+
<Import Project="..\BuildProps\Tests.Build.props" />
33

44
<PropertyGroup>
5-
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
6-
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netcoreapp3.1;net6.0</TargetFrameworks>
7-
8-
<Platforms>AnyCPU</Platforms>
95
<IsPackable>false</IsPackable>
106
<SignAssembly>true</SignAssembly>
117
<AssemblyOriginatorKeyFile>..\..\MongoDB.Driver.snk</AssemblyOriginatorKeyFile>
@@ -21,8 +17,8 @@
2117
</PropertyGroup>
2218

2319
<ItemGroup>
24-
<None Include="$(CMakeCurrentSourceDir)/xunit.runner.json">
25-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
20+
<None Update="xunit.runner.json">
21+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
2622
</None>
2723
</ItemGroup>
2824

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"$schema": "https://xunit.github.io/schema/current/xunit.runner.schema.json",
3-
4-
"appDomain": "denied",
5-
"shadowCopy": false
2+
"longRunningTestSeconds": 10,
3+
"parallelizeAssembly": false,
4+
"parallelizeTestCollections": false,
5+
"shadowCopy": false
66
}

tests/MongoDB.Driver.Examples/MongoDB.Driver.Examples.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
<Description>MongoDB.Driver examples.</Description>
1212
</PropertyGroup>
1313

14-
<ItemGroup>
15-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0" />
16-
</ItemGroup>
17-
1814
<ItemGroup>
1915
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
2016
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />

tests/MongoDB.Driver.TestHelpers/MongoDB.Driver.TestHelpers.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
<ItemGroup>
1515
<PackageReference Include="Microsoft.Diagnostics.Runtime" Version="2.0.226801" />
16-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0" />
1716
</ItemGroup>
1817

1918
<ItemGroup>

tests/MongoDB.Driver.Tests/MongoDB.Driver.Tests.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@
2828
</NoWarn>
2929
</PropertyGroup>
3030

31-
<ItemGroup>
32-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0" />
33-
</ItemGroup>
34-
3531
<ItemGroup>
3632
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
3733
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />

0 commit comments

Comments
 (0)