From a066a6161d6fc6c47a9fe18d147ab0784f4bb81f Mon Sep 17 00:00:00 2001 From: Edward Neal <55035479+edwardneal@users.noreply.github.com> Date: Wed, 22 Jan 2025 20:25:28 +0000 Subject: [PATCH 1/2] Reverted changes to connection test matrix Tests were failing in main branch - CI environment only supports TLS 1.2 --- .../ConnectionTestParametersData.cs | 29 +++++-------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/ConnectionTestParametersData.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/ConnectionTestParametersData.cs index e35818e0e2..5a2e01a77c 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/ConnectionTestParametersData.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/ConnectionTestParametersData.cs @@ -4,13 +4,13 @@ using System.Collections.Generic; using System.IO; -using System.Security.Authentication; using Microsoft.SqlServer.TDS.PreLogin; namespace Microsoft.Data.SqlClient.ManualTesting.Tests.DataCommon { public class ConnectionTestParametersData { + private const int CASES = 30; private string _empty = string.Empty; // It was advised to store the client certificate in its own folder. private static readonly string s_fullPathToCer = Path.Combine(Directory.GetCurrentDirectory(), "clientcert", "localhostcert.cer"); @@ -22,7 +22,7 @@ public class ConnectionTestParametersData public static IEnumerable GetConnectionTestParameters() { - for (int i = 0; i < Data.ConnectionTestParametersList.Count; i++) + for (int i = 0; i < CASES; i++) { yield return new object[] { Data.ConnectionTestParametersList[i] }; } @@ -33,11 +33,11 @@ public ConnectionTestParametersData() // Test cases possible field values for connection parameters: // These combinations are based on the possible values of Encrypt, TrustServerCertificate, Certificate, HostNameInCertificate /* - * TDSEncryption | Encrypt | TrustServerCertificate | Certificate | HNIC | SSL Protocols | TestResults - * --------------------------------------------------------------------------------------------------------------- - * Off | Optional | true | valid | valid name | TLS 1.2 | true - * On | Mandatory | false | mismatched | empty | TLS 1.0, TLS 1.1 | false - * Required | | x | ChainError? | wrong name? | | + * TDSEncryption | Encrypt | TrustServerCertificate | Certificate | HNIC | TestResults + * ---------------------------------------------------------------------------------------------- + * Off | Optional | true | valid | valid name | true + * On | Mandatory | false | mismatched | empty | false + * Required | | x | ChainError? | wrong name? | */ ConnectionTestParametersList = new List { @@ -79,21 +79,6 @@ public ConnectionTestParametersData() new(TDSPreLoginTokenEncryptionType.On, SqlConnectionEncryptOption.Mandatory, true, s_mismatchedcert, _empty, true), new(TDSPreLoginTokenEncryptionType.Required, SqlConnectionEncryptOption.Mandatory, false, s_mismatchedcert, _empty, false), new(TDSPreLoginTokenEncryptionType.Required, SqlConnectionEncryptOption.Mandatory, true, s_mismatchedcert, _empty, true), - - // Multiple SSL protocols test -#pragma warning disable CA5397 // Do not use deprecated SslProtocols values -#pragma warning disable CA5398 // Avoid hardcoded SslProtocols values -#if NET -#pragma warning disable SYSLIB0039 // Type or member is obsolete: TLS 1.0 & 1.1 are deprecated -#endif - new(TDSPreLoginTokenEncryptionType.Off, SqlConnectionEncryptOption.Mandatory, false, s_fullPathToCer, _empty, SslProtocols.Tls | SslProtocols.Tls11, true), - new(TDSPreLoginTokenEncryptionType.On, SqlConnectionEncryptOption.Mandatory, false, s_fullPathToCer, _empty, SslProtocols.Tls | SslProtocols.Tls11, true), - new(TDSPreLoginTokenEncryptionType.Required, SqlConnectionEncryptOption.Mandatory, false, s_fullPathToCer, _empty, SslProtocols.Tls | SslProtocols.Tls11, true), -#if NET -#pragma warning restore SYSLIB0039 // Type or member is obsolete: TLS 1.0 & 1.1 are deprecated -#endif -#pragma warning restore CA5397 // Do not use deprecated SslProtocols values -#pragma warning restore CA5398 // Avoid hardcoded SslProtocols values }; } } From 9d80bbc1f383d2da9f706807919bc99c1011162d Mon Sep 17 00:00:00 2001 From: Edward Neal <55035479+edwardneal@users.noreply.github.com> Date: Thu, 23 Jan 2025 19:47:09 +0000 Subject: [PATCH 2/2] Remove const from ConnectionTestParametersData --- .../ManualTests/DataCommon/ConnectionTestParametersData.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/ConnectionTestParametersData.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/ConnectionTestParametersData.cs index 5a2e01a77c..1bd53ad2a7 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/ConnectionTestParametersData.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/ConnectionTestParametersData.cs @@ -10,7 +10,6 @@ namespace Microsoft.Data.SqlClient.ManualTesting.Tests.DataCommon { public class ConnectionTestParametersData { - private const int CASES = 30; private string _empty = string.Empty; // It was advised to store the client certificate in its own folder. private static readonly string s_fullPathToCer = Path.Combine(Directory.GetCurrentDirectory(), "clientcert", "localhostcert.cer"); @@ -22,7 +21,7 @@ public class ConnectionTestParametersData public static IEnumerable GetConnectionTestParameters() { - for (int i = 0; i < CASES; i++) + for (int i = 0; i < Data.ConnectionTestParametersList.Count; i++) { yield return new object[] { Data.ConnectionTestParametersList[i] }; }