diff --git a/GitVersion.yml b/GitVersion.yml deleted file mode 100644 index 4aa8b9c2482..00000000000 --- a/GitVersion.yml +++ /dev/null @@ -1 +0,0 @@ -next-version: 2.22.0 diff --git a/build.cake b/build.cake deleted file mode 100644 index ceb35a16ca0..00000000000 --- a/build.cake +++ /dev/null @@ -1,223 +0,0 @@ -#addin nuget:?package=Cake.FileHelpers&version=5.0.0 -#addin nuget:?package=Cake.Git&version=2.0.0 -#addin nuget:?package=Cake.Incubator&version=7.0.0 -#tool dotnet:?package=GitVersion.Tool&version=5.10.3 -#tool nuget:?package=JunitXml.TestLogger&version=3.0.114 - -using System; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text.RegularExpressions; -using Cake.Common.Tools.DotNet.DotNetVerbosity; -using Architecture = System.Runtime.InteropServices.Architecture; -using Path = Cake.Core.IO.Path; - -const string defaultTarget = "Default"; -var target = Argument("target", defaultTarget); -var configuration = Argument("configuration", "Release"); - -var gitVersion = GitVersion(); - -var solutionDirectory = MakeAbsolute(Directory("./")); -var artifactsDirectory = solutionDirectory.Combine("artifacts"); -var artifactsBinDirectory = artifactsDirectory.Combine("bin"); -var artifactsPackagesDirectory = artifactsDirectory.Combine("packages"); -var srcDirectory = solutionDirectory.Combine("src"); -var testsDirectory = solutionDirectory.Combine("tests"); -var outputDirectory = solutionDirectory.Combine("build"); - -var solutionFile = solutionDirectory.CombineWithFilePath("CSharpDriver.sln"); -var solutionFullPath = solutionFile.FullPath; - -Task("Default") - .IsDependentOn("Test"); - -Task("Test") - .DoesForEach( - items: GetFiles("./**/*.Tests.csproj").Where(name => !name.ToString().Contains("Atlas")), - action: (BuildConfig buildConfig, Path testProject) => - { - var mongoX509ClientCertificatePath = Environment.GetEnvironmentVariable("MONGO_X509_CLIENT_CERTIFICATE_PATH"); - if (mongoX509ClientCertificatePath != null) - { - Console.WriteLine($"MONGO_X509_CLIENT_CERTIFICATE_PATH={mongoX509ClientCertificatePath}"); - } - var mongoX509ClientCertificatePassword = Environment.GetEnvironmentVariable("MONGO_X509_CLIENT_CERTIFICATE_PASSWORD"); - if (mongoX509ClientCertificatePassword != null) - { - Console.WriteLine($"MONGO_X509_CLIENT_CERTIFICATE_PASSWORD={mongoX509ClientCertificatePassword}"); - } - - RunTests(buildConfig, testProject, filter: "Category=\"Integration\""); - }) - .DeferOnError(); - -Task("TestAwsAuthentication") - .DoesForEach( - items: GetFiles("./**/MongoDB.Driver.Tests.csproj"), - action: (BuildConfig buildConfig, Path testProject) => - RunTests(buildConfig, testProject, filter: "Category=\"AwsMechanism\"")); - -Task("TestPlainAuthentication") - .DoesForEach( - items: GetFiles("./**/MongoDB.Driver.Tests.csproj"), - action: (BuildConfig buildConfig, Path testProject) => - RunTests(buildConfig, testProject, filter: "Category=\"PlainMechanism\"")); - -Task("TestAtlasConnectivity") - .DoesForEach( - items: GetFiles("./**/AtlasConnectivity.Tests.csproj"), - action: (BuildConfig buildConfig, Path testProject) => RunTests(buildConfig, testProject)); - -Task("TestAtlasSearch") - .DoesForEach( - items: GetFiles("./**/MongoDB.Driver.Tests.csproj"), - action: (BuildConfig buildConfig, Path testProject) => - RunTests(buildConfig, testProject, filter: "Category=\"AtlasSearch\"")); - -Task("TestAtlasSearchIndexHelpers") - .DoesForEach( - items: GetFiles("./**/MongoDB.Driver.Tests.csproj"), - action: (BuildConfig buildConfig, Path testProject) => - RunTests(buildConfig, testProject, filter: "Category=\"AtlasSearchIndexHelpers\"")); - -Task("TestOcsp") - .DoesForEach( - items: GetFiles("./**/MongoDB.Driver.Tests.csproj"), - action: (BuildConfig buildConfig, Path testProject) => - RunTests(buildConfig, testProject, filter: "Category=\"OCSP\"")); - -Task("TestGssapi") - .DoesForEach( - items: GetFiles("./**/MongoDB.Driver.Tests.csproj"), - action: (BuildConfig buildConfig, Path testProject) => - RunTests(buildConfig, testProject, filter: "Category=\"GssapiMechanism\"")); - -Task("TestMongoDbOidc") - .DoesForEach( - items: GetFiles("./**/MongoDB.Driver.Tests.csproj"), - action: (BuildConfig buildConfig, Path testProject) => - RunTests(buildConfig, testProject, filter: "Category=\"MongoDbOidc\"")); - -Task("TestLibMongoCrypt") - .DoesForEach( - items: GetFiles("./**/MongoDB.Driver.Encryption.Tests.csproj"), - action: (BuildConfig buildConfig, Path testProject) => RunTests(buildConfig, testProject)); - -Task("TestLoadBalanced") - .DoesForEach( - items: GetFiles("./**/*.Tests.csproj"), - action: (BuildConfig buildConfig, Path testProject) => - RunTests(buildConfig, testProject, filter: "Category=\"SupportLoadBalancing\"")); - -Task("TestCsfleWithMockedKms") - .IsDependentOn("TestLibMongoCrypt") - .DoesForEach( - items: GetFiles("./**/*.Tests.csproj"), - action: (BuildConfig buildConfig, Path testProject) => - RunTests(buildConfig, testProject, filter: "Category=\"CSFLE\"")); - -Task("TestCsfleWithMongocryptd") - .IsDependentOn("TestLibMongoCrypt") - .DoesForEach( - items: GetFiles("./**/*.Tests.csproj"), - action: (BuildConfig buildConfig, Path testProject) => - RunTests(buildConfig, testProject, filter: "Category=\"CSFLE\"")); - -Task("TestCsfleWithAzureKms") - .IsDependentOn("TestLibMongoCrypt") - .DoesForEach( - items: GetFiles("./**/*.Tests.csproj"), - action: (BuildConfig buildConfig, Path testProject) => - RunTests(buildConfig, testProject, filter: "Category=\"CsfleAZUREKMS\"")); - -Task("TestCsfleWithGcpKms") - .IsDependentOn("TestLibMongoCrypt") - .DoesForEach( - items: GetFiles("./**/*.Tests.csproj"), - action: (BuildConfig buildConfig, Path testProject) => - RunTests(buildConfig, testProject, filter: "Category=\"CsfleGCPKMS\"")); - -Task("TestX509") - .DoesForEach( - items: GetFiles("./**/MongoDB.Driver.Tests.csproj"), - action: (BuildConfig buildConfig, Path testProject) => - RunTests(buildConfig, testProject, filter: "Category=\"X509\"")); - -Task("TestSocks5Proxy") - .DoesForEach( - items: GetFiles("./**/*.Tests.csproj"), - action: (BuildConfig buildConfig, Path testProject) => - RunTests(buildConfig, testProject, filter: "Category=\"Socks5Proxy\"")); - -Setup( - setupContext => - { - var targetPlatform = RuntimeInformation.OSArchitecture switch - { - Architecture.Arm64 => "arm64", - Architecture.X64 => "x64", - var unknownArchitecture => throw new Exception($"Unknown CPU architecture: {unknownArchitecture}.") - }; - - var framework = Environment.GetEnvironmentVariable("FRAMEWORK"); - if (string.Equals(framework, "netstandard2.1", StringComparison.InvariantCultureIgnoreCase)) - { - framework = "netcoreapp3.1"; - } - - var packageVersion = target.ToLowerInvariant().StartsWith("smoketests") ? Environment.GetEnvironmentVariable("PACKAGE_VERSION") : gitVersion.LegacySemVer; - Console.WriteLine($"Framework: {framework ?? "null (not set)"}, TargetPlatform: {targetPlatform}, PackageVersion: {packageVersion}"); - - return new BuildConfig(framework, targetPlatform, packageVersion); - }); - -RunTarget(target); - -public class BuildConfig -{ - public string Framework { get; } - public string PackageVersion { get; } - public string TargetPlatform { get; } - - public BuildConfig(string framework, string targetPlatform, string packageVersion) - { - Framework = framework; - TargetPlatform = targetPlatform; - PackageVersion = packageVersion; - } -} - -string[] CreateLoggers(string projectName) -{ - var testResultsFile = outputDirectory.Combine("test-results").Combine($"TEST-{projectName}-{target.ToLowerInvariant()}-{DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()}.xml"); - - // Evergreen CI server requires JUnit output format to display test results - var junitLogger = $"junit;LogFilePath={testResultsFile};FailureBodyFormat=Verbose"; - var consoleLogger = "console;verbosity=detailed"; - return new[] { junitLogger, consoleLogger }; -} - -void RunTests(BuildConfig buildConfig, Path path, string filter = null) -{ - RunTests(buildConfig, path, settings => settings.Filter = filter); -} - -void RunTests(BuildConfig buildConfig, Path path, Action settingsAction) -{ - var projectName = System.IO.Path.GetFileNameWithoutExtension(path.FullPath); - - var settings = new DotNetTestSettings - { - NoBuild = true, - NoRestore = true, - Configuration = configuration, - Loggers = CreateLoggers(projectName), - ArgumentCustomization = args => args.Append($"-- RunConfiguration.TargetPlatform={buildConfig.TargetPlatform}"), - Framework = buildConfig.Framework - }; - - settingsAction?.Invoke(settings); - - DotNetTest(path.FullPath, settings); -} diff --git a/build.config b/build.config deleted file mode 100644 index ef704d5f9e8..00000000000 --- a/build.config +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -CAKE_VERSION=2.3.0 diff --git a/build.ps1 b/build.ps1 deleted file mode 100644 index 7bb2f38e769..00000000000 --- a/build.ps1 +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env pwsh -$DotNetInstallerUri = 'https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.ps1'; -$DotNetUnixInstallerUri = 'https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh' -$DotNetChannel = 'LTS' -$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent - -[string] $CakeVersion = '' -foreach($line in Get-Content (Join-Path $PSScriptRoot 'build.config')) -{ - if ($line -like 'CAKE_VERSION=*') { - $CakeVersion = $line.SubString(13) - } -} - - -if ([string]::IsNullOrEmpty($CakeVersion)) { - 'Failed to parse Cake Version' - exit 1 -} - -# Make sure tools folder exists -$ToolPath = Join-Path $PSScriptRoot "tools" -if (!(Test-Path $ToolPath)) { - Write-Verbose "Creating tools directory..." - New-Item -Path $ToolPath -Type Directory -Force | out-null -} - - -if ($PSVersionTable.PSEdition -ne 'Core') { - # Attempt to set highest encryption available for SecurityProtocol. - # PowerShell will not set this by default (until maybe .NET 4.6.x). This - # will typically produce a message for PowerShell v2 (just an info - # message though) - try { - # Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48) - # Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't - # exist in .NET 4.0, even though they are addressable if .NET 4.5+ is - # installed (.NET 4.5 is an in-place upgrade). - [System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48 - } catch { - Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to upgrade to .NET Framework 4.5+ and PowerShell v3' - } -} - -########################################################################### -# INSTALL CAKE -########################################################################### - -# Make sure Cake has been installed. -[string] $CakeExePath = '' -[string] $CakeInstalledVersion = Get-Command dotnet-cake -ErrorAction SilentlyContinue | % {&$_.Source --version} - -if ($CakeInstalledVersion -eq $CakeVersion) { - # Cake found locally - $CakeExePath = (Get-Command dotnet-cake).Source -} -else { - $CakePath = [System.IO.Path]::Combine($ToolPath,'.store', 'cake.tool', $CakeVersion) # Old PowerShell versions Join-Path only supports one child path - - $CakeExePath = (Get-ChildItem -Path $ToolPath -Filter "dotnet-cake*" -File| ForEach-Object FullName | Select-Object -First 1) - - - if ((!(Test-Path -Path $CakePath -PathType Container)) -or (!(Test-Path $CakeExePath -PathType Leaf))) { - - if ((![string]::IsNullOrEmpty($CakeExePath)) -and (Test-Path $CakeExePath -PathType Leaf)) - { - & dotnet tool uninstall --tool-path $ToolPath Cake.Tool - } - - & dotnet tool install --tool-path $ToolPath --version $CakeVersion Cake.Tool - if ($LASTEXITCODE -ne 0) - { - 'Failed to install cake' - exit 1 - } - $CakeExePath = (Get-ChildItem -Path $ToolPath -Filter "dotnet-cake*" -File| ForEach-Object FullName | Select-Object -First 1) - } -} - -########################################################################### -# RUN BUILD SCRIPT -########################################################################### -& "$CakeExePath" ./build.cake --bootstrap -if ($LASTEXITCODE -eq 0) -{ - & "$CakeExePath" ./build.cake $args -} -exit $LASTEXITCODE diff --git a/build.sh b/build.sh deleted file mode 100755 index aa09497c943..00000000000 --- a/build.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env bash -# Define varibles -SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) -source $SCRIPT_DIR/build.config -TOOLS_DIR=$SCRIPT_DIR/tools -CAKE_EXE=$TOOLS_DIR/dotnet-cake -CAKE_PATH=$TOOLS_DIR/.store/cake.tool/$CAKE_VERSION - -if [ "$CAKE_VERSION" = "" ]; then - echo "An error occured while parsing Cake version." - exit 1 -fi - -# Make sure the tools folder exist. -if [ ! -d "$TOOLS_DIR" ]; then - mkdir "$TOOLS_DIR" -fi - -########################################################################### -# INSTALL CAKE -########################################################################### - -CAKE_INSTALLED_VERSION=$(dotnet-cake --version 2>&1) || true -if [ "$CAKE_VERSION" != "$CAKE_INSTALLED_VERSION" ]; then - if [ ! -f "$CAKE_EXE" ] || [ ! -d "$CAKE_PATH" ]; then - if [ -f "$CAKE_EXE" ]; then - dotnet tool uninstall --tool-path $TOOLS_DIR Cake.Tool - fi - - echo "Installing Cake $CAKE_VERSION..." - dotnet tool install --tool-path $TOOLS_DIR --version $CAKE_VERSION Cake.Tool - if [ $? -ne 0 ]; then - echo "An error occured while installing Cake." - exit 1 - fi - fi - - # Make sure that Cake has been installed. - if [ ! -f "$CAKE_EXE" ]; then - echo "Could not find Cake.exe at '$CAKE_EXE'." - exit 1 - fi -else - CAKE_EXE="dotnet-cake" -fi - -########################################################################### -# RUN BUILD SCRIPT -########################################################################### - -# Start Cake -(exec "$CAKE_EXE" build.cake --bootstrap) && (exec "$CAKE_EXE" build.cake "$@") diff --git a/evergreen/evergreen.yml b/evergreen/evergreen.yml index 65ec2c7517c..d6a447dc41d 100644 --- a/evergreen/evergreen.yml +++ b/evergreen/evergreen.yml @@ -145,15 +145,6 @@ functions: permissions: public-read content_type: ${content_type|application/x-gzip} - exec-script: - - command: shell.exec - type: test - params: - working_dir: mongo-csharp-driver - script: | - ${PREPARE_SHELL} - ${PROJECT_DIRECTORY}/${file} - run-external-script: - command: shell.exec type: test @@ -352,7 +343,6 @@ functions: working_dir: mongo-csharp-driver shell: "bash" script: | - . ./evergreen/set-virtualenv.sh DRIVERS_TOOLS=${DRIVERS_TOOLS} . ./evergreen/set-temp-fle-aws-creds.sh ${PREPARE_SHELL} OS=${OS} \ @@ -367,6 +357,7 @@ functions: REQUIRE_API_VERSION=${REQUIRE_API_VERSION} \ FRAMEWORK=${FRAMEWORK} \ CRYPT_SHARED_LIB_PATH=${CRYPT_SHARED_LIB_PATH} \ + TEST_CATEGORY=${TEST_CATEGORY} \ evergreen/run-tests.sh echo "Skipping certificate removal..." @@ -390,7 +381,7 @@ functions: OS=${OS} \ CLIENT_PEM=${DRIVERS_TOOLS}/.evergreen/x509gen/client.pem \ FRAMEWORK=${FRAMEWORK} \ - TARGET="TestCsfleWithMockedKms" \ + TEST_CATEGORY="CSFLE" \ CRYPT_SHARED_LIB_PATH=${CRYPT_SHARED_LIB_PATH} \ evergreen/run-tests.sh @@ -401,7 +392,6 @@ functions: working_dir: mongo-csharp-driver shell: "bash" script: | - . ./evergreen/set-virtualenv.sh DRIVERS_TOOLS=${DRIVERS_TOOLS} . ./evergreen/set-temp-fle-aws-creds.sh ${PREPARE_SHELL} OS=${OS} \ @@ -414,7 +404,7 @@ functions: COMPRESSOR=${COMPRESSOR} \ CLIENT_PEM=${DRIVERS_TOOLS}/.evergreen/x509gen/client.pem \ REQUIRE_API_VERSION=${REQUIRE_API_VERSION} \ - TARGET="TestCsfleWithMongocryptd" \ + TEST_CATEGORY="CSFLE" \ FRAMEWORK=${FRAMEWORK} \ CRYPT_SHARED_LIB_PATH="" \ evergreen/run-tests.sh @@ -590,7 +580,6 @@ functions: # Workaround. EG_TOOLS scripts for ECS assume that a folder with EG scripts in the driver is named ".evergreen" mkdir $SRC_DIRECTORY/.evergreen cp -r $SRC_DIRECTORY/evergreen/run-mongodb-aws-ecs-test.sh $SRC_DIRECTORY/.evergreen/run-mongodb-aws-ecs-test.sh - cp -r $SRC_DIRECTORY/evergreen/install-dotnet.sh $SRC_DIRECTORY/.evergreen/install-dotnet.sh export PROJECT_DIRECTORY="$SRC_DIRECTORY" ${DRIVERS_TOOLS}/.evergreen/auth_aws/aws_setup.sh ecs @@ -1051,7 +1040,7 @@ functions: TOPOLOGY=${TOPOLOGY} \ OS=${OS} \ FRAMEWORK=${FRAMEWORK} \ - TARGET="TestX509" \ + TEST_CATEGORY="X509" \ evergreen/run-tests.sh setup-socks5-proxy: @@ -1089,7 +1078,7 @@ functions: TOPOLOGY=${TOPOLOGY} \ OS=${OS} \ FRAMEWORK=${FRAMEWORK} \ - TARGET="TestSocks5Proxy" \ + TEST_CATEGORY="Socks5Proxy" \ evergreen/run-tests.sh pre: @@ -1111,7 +1100,6 @@ tasks: - func: configure-framework vars: FRAMEWORK: net472 - DOTNET_SDK_VERSION: 10.0 - func: run-unit-tests - name: unit-tests-netstandard21 @@ -1119,7 +1107,6 @@ tasks: - func: configure-framework vars: FRAMEWORK: netstandard2.1 - DOTNET_SDK_VERSION: 10.0 - func: run-unit-tests - name: unit-tests-net60 @@ -1127,7 +1114,6 @@ tasks: - func: configure-framework vars: FRAMEWORK: net6.0 - DOTNET_SDK_VERSION: 10.0 - func: run-unit-tests - name: unit-tests-net100 @@ -1135,7 +1121,6 @@ tasks: - func: configure-framework vars: FRAMEWORK: net10.0 - DOTNET_SDK_VERSION: 10.0 - func: run-unit-tests - name: test-net472 @@ -1665,7 +1650,6 @@ tasks: - func: configure-framework vars: FRAMEWORK: net472 - DOTNET_SDK_VERSION: 10.0 - func: bootstrap-mongo-orchestration - func: run-smoke-tests @@ -1677,7 +1661,6 @@ tasks: - func: configure-framework vars: FRAMEWORK: netcoreapp3.1 - DOTNET_SDK_VERSION: 10.0 - func: bootstrap-mongo-orchestration - func: run-smoke-tests @@ -1689,7 +1672,6 @@ tasks: - func: configure-framework vars: FRAMEWORK: net5.0 - DOTNET_SDK_VERSION: 10.0 - func: bootstrap-mongo-orchestration - func: run-smoke-tests @@ -1701,7 +1683,6 @@ tasks: - func: configure-framework vars: FRAMEWORK: net6.0 - DOTNET_SDK_VERSION: 10.0 - func: bootstrap-mongo-orchestration - func: run-smoke-tests @@ -1713,7 +1694,6 @@ tasks: - func: configure-framework vars: FRAMEWORK: net8.0 - DOTNET_SDK_VERSION: 10.0 - func: bootstrap-mongo-orchestration - func: run-smoke-tests @@ -1725,7 +1705,6 @@ tasks: - func: configure-framework vars: FRAMEWORK: net10.0 - DOTNET_SDK_VERSION: 10.0 - func: bootstrap-mongo-orchestration - func: run-smoke-tests diff --git a/evergreen/execute-tests.sh b/evergreen/execute-tests.sh new file mode 100644 index 00000000000..b14bc513bca --- /dev/null +++ b/evergreen/execute-tests.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +set -o errexit # Exit the script with error if any of the commands fail + +# Environment variables used as input: +# FRAMEWORK Set to specify .NET framework to test against. Values: "Net472", "NetStandard21", +# TEST_CATEGORY Set to specify a test category to filter by. +# TEST_PROJECT_PATH Set glob filter to find test projects. + +FRAMEWORK=${FRAMEWORK:-} +TEST_CATEGORY=${TEST_CATEGORY:-Integration} +TEST_PROJECT_PATH=${TEST_PROJECT_PATH:-./tests/**/[!Atlas]*.Tests.csproj} + +if [ "$FRAMEWORK" = "netstandard2.1" ]; then + FRAMEWORK="netcoreapp3.1" +fi + +FILTER_PARAMETER="" +echo TEST_CATEGORY: ${TEST_CATEGORY} +if [[ -n "${TEST_CATEGORY}" ]]; then + if [[ "${TEST_CATEGORY}" == "!"* ]]; then + FILTER_PARAMETER="--filter \"Category!=${TEST_CATEGORY:1}\"" + else + FILTER_PARAMETER="--filter \"Category=${TEST_CATEGORY}\"" + fi +fi + +FRAMEWORK_PARAMETER="" +if [[ -n "${FRAMEWORK}" ]]; then + FRAMEWORK_PARAMETER="-f \"${FRAMEWORK}\"" +fi + +for file in $TEST_PROJECT_PATH; do + dotnet test "${file}" -c Release --no-build ${FILTER_PARAMETER} ${FRAMEWORK_PARAMETER} --results-directory ./build/test-results --logger "junit;verbosity=detailed;LogFileName=TEST-{assembly}.xml;FailureBodyFormat=Verbose" --logger "console;verbosity=detailed" +done diff --git a/evergreen/install-dotnet.sh b/evergreen/install-dotnet.sh index 661ba5e6bc6..e10e1110332 100644 --- a/evergreen/install-dotnet.sh +++ b/evergreen/install-dotnet.sh @@ -2,7 +2,7 @@ set -o errexit # Exit the script with error if any of the commands fail DOTNET_ROOT="${DOTNET_ROOT:-./.dotnet}" -DOTNET_SDK_VERSION="${DOTNET_SDK_VERSION:-8.0}" +DOTNET_SDK_VERSION="${DOTNET_SDK_VERSION:-10.0}" echo "runtime: $FRAMEWORK" diff --git a/evergreen/run-atlas-connectivity-tests.sh b/evergreen/run-atlas-connectivity-tests.sh index 5ec9d8c3d60..8e10e3dd0e8 100755 --- a/evergreen/run-atlas-connectivity-tests.sh +++ b/evergreen/run-atlas-connectivity-tests.sh @@ -7,6 +7,5 @@ set -o errexit # Exit the script with error if any of the commands fail ############################################ # Provision the correct connection string and set up SSL if needed -for var in TMP TEMP NUGET_PACKAGES NUGET_HTTP_CACHE_PATH APPDATA; do setx $var z:\\data\\tmp; export $var=z:\\data\\tmp; done ./evergreen/compile-sources.sh -powershell.exe .\\build.ps1 --target TestAtlasConnectivity +TEST_PROJECT_PATH=./**/AtlasConnectivity.Tests.csproj ./evergreen/execute-tests.sh diff --git a/evergreen/run-atlas-search-index-helpers-test.sh b/evergreen/run-atlas-search-index-helpers-test.sh index b93ef38e8f3..62b945cbf27 100644 --- a/evergreen/run-atlas-search-index-helpers-test.sh +++ b/evergreen/run-atlas-search-index-helpers-test.sh @@ -14,4 +14,4 @@ echo "Running Atlas Search Index Helpers driver tests" export ATLAS_SEARCH_INDEX_HELPERS_TESTS_ENABLED=true ./evergreen/compile-sources.sh -./build.sh --target=TestAtlasSearchIndexHelpers +TEST_CATEGORY=AtlasSearchIndexHelpers ./evergreen/execute-tests.sh diff --git a/evergreen/run-atlas-search-test.sh b/evergreen/run-atlas-search-test.sh index f9c2f1a09d6..3d15f7ec7e1 100644 --- a/evergreen/run-atlas-search-test.sh +++ b/evergreen/run-atlas-search-test.sh @@ -14,4 +14,4 @@ echo "Running Atlas Search driver tests" export ATLAS_SEARCH_TESTS_ENABLED=true ./evergreen/compile-sources.sh -powershell.exe .\\build.ps1 --target=TestAtlasSearch +TEST_CATEGORY=AtlasSearch ./evergreen/execute-tests.sh diff --git a/evergreen/run-csfle-azure-tests.sh b/evergreen/run-csfle-azure-tests.sh index 3faf76427f0..70871fcec63 100644 --- a/evergreen/run-csfle-azure-tests.sh +++ b/evergreen/run-csfle-azure-tests.sh @@ -25,4 +25,4 @@ export FRAMEWORK=net6.0 . ./evergreen/install-dotnet.sh ./evergreen/compile-sources.sh -. ./build.sh --target=TestCsfleWithAzureKms +TEST_CATEGORY=CsfleAZUREKMS ./evergreen/execute-tests.sh diff --git a/evergreen/run-csfle-gcp-tests.sh b/evergreen/run-csfle-gcp-tests.sh index d75e16db087..26bcb115c9f 100644 --- a/evergreen/run-csfle-gcp-tests.sh +++ b/evergreen/run-csfle-gcp-tests.sh @@ -18,4 +18,4 @@ export FRAMEWORK=net6.0 . ./evergreen/install-dotnet.sh ./evergreen/compile-sources.sh -. ./build.sh --target=TestCsfleWithGcpKms +TEST_CATEGORY=CsfleGCPKMS ./evergreen/execute-tests.sh diff --git a/evergreen/run-gssapi-auth-tests.sh b/evergreen/run-gssapi-auth-tests.sh index b4afa14d277..e17630e4aac 100755 --- a/evergreen/run-gssapi-auth-tests.sh +++ b/evergreen/run-gssapi-auth-tests.sh @@ -28,9 +28,6 @@ if [ "Windows_NT" = "$OS" ]; then setx $var z:\\data\\tmp export $var=z:\\data\\tmp done - - ./evergreen/compile-sources.sh - powershell.exe .\\build.ps1 --target TestGssapi else echo "Setting krb5 config file" touch ${PROJECT_DIRECTORY}/evergreen/krb5.conf.empty @@ -45,7 +42,7 @@ else for var in TMP TEMP NUGET_PACKAGES NUGET_HTTP_CACHE_PATH APPDATA; do export $var=/data/tmp; done - - . ./evergreen/compile-sources.sh - ./build.sh --target=TestGssapi fi; + +./evergreen/compile-sources.sh +TEST_CATEGORY=GssapiMechanism ./evergreen/execute-tests.sh diff --git a/evergreen/run-load-balancer-tests.sh b/evergreen/run-load-balancer-tests.sh index c2dd89ebdac..267e98a8c43 100644 --- a/evergreen/run-load-balancer-tests.sh +++ b/evergreen/run-load-balancer-tests.sh @@ -35,4 +35,4 @@ export MONGODB_URI_WITH_MULTIPLE_MONGOSES=${MULTI_MONGOS_LB_URI} set -x ./evergreen/compile-sources.sh -./build.sh --target TestLoadBalanced +TEST_CATEGORY=SupportLoadBalancing ./evergreen/execute-tests.sh diff --git a/evergreen/run-mongodb-aws-ecs-test.sh b/evergreen/run-mongodb-aws-ecs-test.sh index 9c6395e8978..7441b190021 100644 --- a/evergreen/run-mongodb-aws-ecs-test.sh +++ b/evergreen/run-mongodb-aws-ecs-test.sh @@ -15,14 +15,18 @@ set -o errexit # Exit the script with error if any of the commands fail # Main Program # ############################################ +# EG scripts for ECS assume that a root folder is "src" and all driver side scripts are placed in ".evergreen" folder. +# So that script is copied into "src/.evergreen" before running +cd src + if [[ -z "$1" ]]; then echo "usage: $0 " exit 1 fi -export MONGODB_URI="$1" +export MONGODB_URI="$1" export FRAMEWORK=net6.0 -. src/.evergreen/install-dotnet.sh # there is a script to rename our evergreen folder into .evergreen as it is expected by eg-tools script +. ./evergreen/install-dotnet.sh if echo "$MONGODB_URI" | grep -q "@"; then echo "MONGODB_URI unexpectedly contains user credentials in ECS test!"; @@ -31,8 +35,4 @@ fi export AWS_TESTS_ENABLED=true export AWS_ECS_ENABLED=true -# EG scripts for ECS assume that a root folder is "src" and all driver side scripts are placed in ".evergreen" folder. -# So that script is copied into "src/.evergreen" before running -cd src - -./build.sh --target=TestAwsAuthentication +TEST_CATEGORY=AwsMechanism ./evergreen/execute-tests.sh diff --git a/evergreen/run-mongodb-aws-test.sh b/evergreen/run-mongodb-aws-test.sh index 5ce6966ee10..edb082485d8 100755 --- a/evergreen/run-mongodb-aws-test.sh +++ b/evergreen/run-mongodb-aws-test.sh @@ -42,8 +42,4 @@ export AWS_TESTS_ENABLED=true set -x ./evergreen/compile-sources.sh -if [[ "$OS" =~ Windows|windows ]]; then - powershell.exe .\\build.ps1 --target=TestAwsAuthentication -else - ./build.sh --target=TestAwsAuthentication -fi +TEST_CATEGORY=AwsMechanism ./evergreen/execute-tests.sh diff --git a/evergreen/run-mongodb-oidc-tests.sh b/evergreen/run-mongodb-oidc-tests.sh index 482ea8e0db6..c5045357f9c 100644 --- a/evergreen/run-mongodb-oidc-tests.sh +++ b/evergreen/run-mongodb-oidc-tests.sh @@ -49,8 +49,4 @@ export OIDC_ENV=$OIDC_ENV export MONGODB_URI=$MONGODB_URI ./evergreen/compile-sources.sh -if [ "Windows_NT" = "$OS" ]; then - powershell.exe .\\build.ps1 --target "TestMongoDbOidc" -else - ./build.sh --target="TestMongoDbOidc" -fi +TEST_CATEGORY=MongoDbOidc ./evergreen/execute-tests.sh diff --git a/evergreen/run-plain-auth-tests.sh b/evergreen/run-plain-auth-tests.sh index 6b0e6ff6f73..fda8771bc67 100755 --- a/evergreen/run-plain-auth-tests.sh +++ b/evergreen/run-plain-auth-tests.sh @@ -20,9 +20,4 @@ export MONGODB_URI="${MONGODB_URI}" export PLAIN_AUTH_TESTS_ENABLED=true ./evergreen/compile-sources.sh -if [[ "$OS" =~ Windows|windows ]]; then - powershell.exe \ - '.\build.ps1 --target TestPlainAuthentication' -else - ./build.sh --target=TestPlainAuthentication -fi +TEST_CATEGORY=PlainMechanism ./evergreen/execute-tests.sh diff --git a/evergreen/run-smoke-tests.sh b/evergreen/run-smoke-tests.sh index 950d79a94e7..ba9e7284736 100644 --- a/evergreen/run-smoke-tests.sh +++ b/evergreen/run-smoke-tests.sh @@ -13,5 +13,4 @@ fi export ADD_NET10_TFM="1" # Remove after cake removal export DRIVER_PACKAGE_VERSION="${DRIVER_PACKAGE_VERSION}" ./evergreen/compile-sources.sh "$SMOKE_TESTS_PROJECT" - -dotnet test "$SMOKE_TESTS_PROJECT" -c Release --no-build -f "$FRAMEWORK" --results-directory ./build/test-results --logger "junit;verbosity=detailed;LogFileName=TEST-{assembly}.xml;FailureBodyFormat=Verbose" --logger "console;verbosity=detailed" +TEST_PROJECT_PATH="$SMOKE_TESTS_PROJECT" ./evergreen/execute-tests.sh diff --git a/evergreen/run-tests.sh b/evergreen/run-tests.sh index cb7ae1755cc..f16cfeb2186 100755 --- a/evergreen/run-tests.sh +++ b/evergreen/run-tests.sh @@ -14,7 +14,8 @@ set -o errexit # Exit the script with error if any of the commands fail # MONGODB_X509_CLIENT_P12_PATH Absolute path to client certificate in p12 format # MONGO_X509_CLIENT_CERTIFICATE_PASSWORD password for client certificate # FRAMEWORK Set to specify .NET framework to test against. Values: "Net472", "NetStandard21", -# TARGET Set to specify a custom test target. Default: "nil" +# TEST_CATEGORY Set to specify a test category to filter by. +# TEST_PROJECT_PATH Set glob filter to find test projects. # DRIVERS_TOOLS Set base path to evergreen-drivers-tools project # # Environment variables produced as output: @@ -29,9 +30,7 @@ TOPOLOGY=${TOPOLOGY:-server} COMPRESSOR=${COMPRESSOR:-none} OCSP_TLS_SHOULD_SUCCEED=${OCSP_TLS_SHOULD_SUCCEED:-nil} CLIENT_PEM=${CLIENT_PEM:-nil} -PLATFORM=${PLATFORM:-nil} -TARGET=${TARGET:-Test} -FRAMEWORK=${FRAMEWORK:-nil} +FRAMEWORK=${FRAMEWORK:-} ############################################ # Functions # @@ -103,16 +102,13 @@ if [ ! -z "$REQUIRE_API_VERSION" ]; then echo "Server API version is set to $MONGODB_API_VERSION" fi -export TARGET if [[ "$OS" =~ Windows|windows ]]; then if [ "$OCSP_TLS_SHOULD_SUCCEED" != "nil" ]; then - export TARGET="TestOcsp" + export TEST_CATEGORY="OCSP" certutil.exe -urlcache localhost delete # clear the OS-level cache of all entries with the URL "localhost" fi fi -echo "Test target: $TARGET" - echo "Final MongoDB_URI: $MONGODB_URI" if [ "$TOPOLOGY" == "sharded_cluster" ]; then echo "Final MongoDB URI with multiple mongoses: $MONGODB_URI_WITH_MULTIPLE_MONGOSES" @@ -142,8 +138,4 @@ if [ -f "$DRIVERS_TOOLS/.evergreen/csfle/secrets-export.sh" ]; then fi ./evergreen/compile-sources.sh -if [[ "$OS" =~ Windows|windows ]]; then - powershell.exe .\\build.ps1 --target=$TARGET -else - ./build.sh --target=$TARGET -fi +./evergreen/execute-tests.sh diff --git a/evergreen/run-unit-tests.sh b/evergreen/run-unit-tests.sh index 6b408dad623..ba8c25d232f 100644 --- a/evergreen/run-unit-tests.sh +++ b/evergreen/run-unit-tests.sh @@ -1,12 +1,7 @@ -#!/usr/bin/env bash +#!/usr/bin/env bash set -o errexit # Exit the script with error if any of the commands fail FRAMEWORK=${FRAMEWORK:-net6.0} -if [ "$FRAMEWORK" = "netstandard2.1" ]; then - FRAMEWORK="netcoreapp3.1" -fi - -export ADD_NET10_TFM="1" # Remove after cake removal ./evergreen/compile-sources.sh -dotnet test -c Release --no-build --filter "Category!=Integration" -f "$FRAMEWORK" --results-directory ./build/test-results --logger "junit;verbosity=detailed;LogFileName=TEST-{assembly}.xml;FailureBodyFormat=Verbose" --logger "console;verbosity=detailed" +TEST_CATEGORY="!Integration" ./evergreen/execute-tests.sh diff --git a/tests/BuildProps/Tests.Build.props b/tests/BuildProps/Tests.Build.props index 84d97359f43..899132f35aa 100644 --- a/tests/BuildProps/Tests.Build.props +++ b/tests/BuildProps/Tests.Build.props @@ -6,9 +6,8 @@ - netcoreapp3.1;net6.0 + netcoreapp3.1;net6.0;net10.0 $(TargetFrameworks);net472 - $(TargetFrameworks);net10.0 false true ..\..\MongoDB.Driver.snk diff --git a/tests/SmokeTests/MongoDB.Driver.SmokeTests.Sdk/MongoDB.Driver.SmokeTests.Sdk.csproj b/tests/SmokeTests/MongoDB.Driver.SmokeTests.Sdk/MongoDB.Driver.SmokeTests.Sdk.csproj index 3a29de4cd74..5e80e8979ec 100644 --- a/tests/SmokeTests/MongoDB.Driver.SmokeTests.Sdk/MongoDB.Driver.SmokeTests.Sdk.csproj +++ b/tests/SmokeTests/MongoDB.Driver.SmokeTests.Sdk/MongoDB.Driver.SmokeTests.Sdk.csproj @@ -4,8 +4,7 @@ - netcoreapp3.1;net472;net5.0;net6.0;net8.0 - $(TargetFrameworks);net10.0 + netcoreapp3.1;net472;net5.0;net6.0;net8.0;net10.0 9 ..\..\..\MongoDBTest.ruleset