From 8ee86a6749d9eb5276000135cec024fb7d21b815 Mon Sep 17 00:00:00 2001 From: Nirmit Shah Date: Mon, 30 Dec 2024 15:51:44 +0000 Subject: [PATCH] Upgrade dotnet to v8.0 and upgrade C# dependencies --- .../install-and-run-dotnet/action.yml | 4 ++-- test/dotnet/config.txt | 1 + test/dotnet/dotnet.csproj | 22 +++++++++---------- test/dotnet/src/BatchRun.cs | 2 +- test/dotnet/src/ExecuteTests.cs | 1 + test/dotnet/src/PrepareExecBinding.cs | 2 +- test/dotnet/utils/ConfigSetup.cs | 8 +++++-- test/dotnet/utils/TestUtils.cs | 4 ++-- 8 files changed, 25 insertions(+), 19 deletions(-) diff --git a/.github/composite-actions/install-and-run-dotnet/action.yml b/.github/composite-actions/install-and-run-dotnet/action.yml index bfd0aad508..63784689e4 100644 --- a/.github/composite-actions/install-and-run-dotnet/action.yml +++ b/.github/composite-actions/install-and-run-dotnet/action.yml @@ -24,9 +24,9 @@ runs: sudo dpkg -i packages-microsoft-prod.deb rm packages-microsoft-prod.deb sudo apt-get install -y apt-transport-https - sudo apt-get install -y dotnet-sdk-5.0 + sudo apt-get install -y dotnet-sdk-8.0 sudo apt-get install -y apt-transport-https - sudo apt-get install -y aspnetcore-runtime-5.0 + sudo apt-get install -y aspnetcore-runtime-8.0 shell: bash - name: Run Dotnet Tests diff --git a/test/dotnet/config.txt b/test/dotnet/config.txt index 54140048bc..7c1f5eddc8 100644 --- a/test/dotnet/config.txt +++ b/test/dotnet/config.txt @@ -11,6 +11,7 @@ bcpPath=/usr/local/bin/bcp runInParallel = false printToConsole = true +runInRegression = true driver = sql provider = SQL NATIVE CLIENT diff --git a/test/dotnet/dotnet.csproj b/test/dotnet/dotnet.csproj index a45cff35d1..6430c5c02c 100644 --- a/test/dotnet/dotnet.csproj +++ b/test/dotnet/dotnet.csproj @@ -2,26 +2,26 @@ Exe - net7.0 + net8.0 - - - - - - - - + + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + diff --git a/test/dotnet/src/BatchRun.cs b/test/dotnet/src/BatchRun.cs index 82e58b7869..767ff93f66 100644 --- a/test/dotnet/src/BatchRun.cs +++ b/test/dotnet/src/BatchRun.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Data; using System.Data.Common; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.IO; using Serilog; diff --git a/test/dotnet/src/ExecuteTests.cs b/test/dotnet/src/ExecuteTests.cs index 3c326d3642..25be92785c 100644 --- a/test/dotnet/src/ExecuteTests.cs +++ b/test/dotnet/src/ExecuteTests.cs @@ -28,6 +28,7 @@ IEnumerable GetFilesByExtensions(DirectoryInfo dir, String[] noExecTes [Fact] public void Test() { + AppContext.SetSwitch("Switch.Microsoft.Data.SqlClient.TruncateScaledDecimal", true); BatchRun batchRun = new BatchRun(); DirectoryInfo dir = new DirectoryInfo(ConfigSetup.QueryFolder); IEnumerable allFiles; diff --git a/test/dotnet/src/PrepareExecBinding.cs b/test/dotnet/src/PrepareExecBinding.cs index 642f206252..64fe228102 100644 --- a/test/dotnet/src/PrepareExecBinding.cs +++ b/test/dotnet/src/PrepareExecBinding.cs @@ -3,7 +3,7 @@ using System.Data; using System.Data.Common; using System.Data.OleDb; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Data.SqlTypes; using Microsoft.SqlServer.Types; using System.IO; diff --git a/test/dotnet/utils/ConfigSetup.cs b/test/dotnet/utils/ConfigSetup.cs index 0dcd749c84..17880917d8 100644 --- a/test/dotnet/utils/ConfigSetup.cs +++ b/test/dotnet/utils/ConfigSetup.cs @@ -13,6 +13,7 @@ public static class ConfigSetup public static readonly string TestName = Dictionary["testName"]; public static readonly bool RunInParallel = bool.Parse(Dictionary["runInParallel"]); public static readonly bool PrintToConsole = bool.Parse(Dictionary["printToConsole"]); + public static bool RunInRegression; public static string Database; public static string Provider = Dictionary["provider"]; @@ -42,6 +43,7 @@ public static Dictionary LoadConfig() } Database = dictionary["driver"]; Provider = dictionary["provider"]; + RunInRegression = bool.Parse(dictionary["runInRegression"]); /* Creating Server Connection String and Query. */ dictionary["bblConnectionString"] = BuildConnectionString(dictionary["babel_URL"], dictionary["babel_port"], @@ -58,8 +60,10 @@ static string BuildConnectionString(string url, string port, string db, string u return @"Provider = " + ConfigSetup.Provider + ";Data Source = " + url + "," + port + "; Initial Catalog = " + db + "; User ID = " + uid + "; Password = " + pwd + ";"; case "sql": - return @"Data Source = " + url + "," + port + "; Initial Catalog = " + db - + "; User ID = " + uid + "; Password = " + pwd + ";"; + string baseConnectionString = $"Data Source={url},{port};Initial Catalog={db};User ID={uid};Password={pwd};"; + return ConfigSetup.RunInRegression + ? $"{baseConnectionString};Encrypt=false" + : baseConnectionString; default: throw new Exception("Driver Not Supported"); } diff --git a/test/dotnet/utils/TestUtils.cs b/test/dotnet/utils/TestUtils.cs index 0c90e0ddeb..c5d9578e24 100644 --- a/test/dotnet/utils/TestUtils.cs +++ b/test/dotnet/utils/TestUtils.cs @@ -3,13 +3,13 @@ using System.Data; using System.Data.Common; using System.Data.OleDb; -using System.Data.SqlClient; +using Microsoft.Data.SqlClient; using System.Data.SqlTypes; using System.Diagnostics; using System.IO; using System.Net.NetworkInformation; using System.Runtime.InteropServices; -using Microsoft.SqlServer.Server; +using Microsoft.Data.SqlClient.Server; using Serilog; using Serilog.Core; using Xunit;