diff --git a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs index 85d3a02fb1..15e2c07adc 100644 --- a/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/FunctionalTests/SqlExceptionTest.cs @@ -15,7 +15,6 @@ public class SqlExceptionTest private const string badServer = "92B96911A0BD43E8ADA4451031F7E7CF"; [Fact] - [ActiveIssue("12161", TestPlatforms.AnyUnix)] public void SerializationTest() { SqlException e = CreateException(); @@ -26,7 +25,6 @@ public void SerializationTest() TypeNameHandling = TypeNameHandling.All, }; - // TODO: Deserialization fails on Unix with "Member 'ClassName' was not found." var sqlEx = JsonConvert.DeserializeObject(json, settings); Assert.Equal(e.ClientConnectionId, sqlEx.ClientConnectionId); @@ -35,8 +33,7 @@ public void SerializationTest() #if NETFRAMEWORK [Fact] - [ActiveIssue("12161", TestPlatforms.AnyUnix)] - public static void SqlExcpetionSerializationTest() + public static void SqlExceptionSerializationTest() { var formatter = new BinaryFormatter(); SqlException e = CreateException(); diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/CspProviderExt.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/CspProviderExt.cs index f164dff220..53b906621e 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/CspProviderExt.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/CspProviderExt.cs @@ -25,7 +25,7 @@ namespace Microsoft.Data.SqlClient.ManualTesting.Tests.AlwaysEncrypted [PlatformSpecific(TestPlatforms.Windows)] public class CspProviderExt { - [ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringSetupForAE))] + [ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringSetupForAE), nameof(DataTestUtility.IsAdmin))] [ClassData(typeof(AEConnectionStringProvider))] public void TestKeysFromCertificatesCreatedWithMultipleCryptoProviders(string connectionString) { diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs index 54058a9218..4ce9496b18 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs @@ -94,7 +94,7 @@ public static class DataTestUtility //SQL Server EngineEdition private static string s_sqlServerEngineEdition; - // JSON Coloumn type + // JSON Column type public static readonly bool IsJsonSupported = false; // Azure Synapse EngineEditionId == 6 @@ -107,8 +107,8 @@ public static bool IsAzureSynapse { s_sqlServerEngineEdition ??= GetSqlServerProperty(TCPConnectionString, "EngineEdition"); } - _ = int.TryParse(s_sqlServerEngineEdition, out int engineEditon); - return engineEditon == 6; + _ = int.TryParse(s_sqlServerEngineEdition, out int engineEdition); + return engineEdition == 6; } } @@ -234,6 +234,16 @@ static DataTestUtility() } } + public static IEnumerable GetConnectionStringsWithEnclaveMemberData() + { + return GetConnectionStrings(true).Select(x => new object[] { x }); + } + + public static IEnumerable GetConnectionStringsWithoutEnclaveMemberData() + { + return GetConnectionStrings(false).Select(x => new object[] { x }); + } + public static IEnumerable ConnectionStrings => GetConnectionStrings(withEnclave: true); public static IEnumerable GetConnectionStrings(bool withEnclave) @@ -457,6 +467,11 @@ public static bool IsNotAzureServer() return !AreConnStringsSetup() || !Utils.IsAzureSqlServer(new SqlConnectionStringBuilder((TCPConnectionString)).DataSource); } + public static bool IsNotNamedInstance() + { + return !AreConnStringsSetup() || !new SqlConnectionStringBuilder(TCPConnectionString).DataSource.Contains(@"\"); + } + // Synapse: Always Encrypted is not supported with Azure Synapse. // Ref: https://feedback.azure.com/forums/307516-azure-synapse-analytics/suggestions/17858869-support-always-encrypted-in-sql-data-warehouse public static bool IsAKVSetupAvailable() diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj b/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj index a5b217f1cd..60e978c4b0 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj @@ -13,31 +13,12 @@ true - - - - - - - - PreserveNewest - TCECryptoNativeBaseline.txt - - - PreserveNewest - TCECryptoNativeBaselineRsa.txt - - - - - - - - - + + + @@ -57,6 +38,8 @@ + + @@ -70,6 +53,21 @@ + + PreserveNewest + TCECryptoNativeBaseline.txt + + + PreserveNewest + TCECryptoNativeBaselineRsa.txt + + + + + + + + @@ -79,7 +77,6 @@ - @@ -173,15 +170,21 @@ + + + + + + @@ -193,6 +196,7 @@ + @@ -293,12 +297,6 @@ - - - - - - diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/AsyncTest/AsyncTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/AsyncTest/AsyncTest.cs deleted file mode 100644 index 8208f7e496..0000000000 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/AsyncTest/AsyncTest.cs +++ /dev/null @@ -1,106 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; -using System.Threading.Tasks; -using Xunit; - -namespace Microsoft.Data.SqlClient.ManualTesting.Tests -{ - public static class AsyncTest - { - [ActiveIssue("5533")] // Async Operations slower than Sync operations - [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))] - public static void TestReadAsyncTimeConsumed() - { - const string sql = "SET NOCOUNT ON" - + " SELECT 'a'" - + " DECLARE @t DATETIME = SYSDATETIME()" - + " WHILE DATEDIFF(s, @t, SYSDATETIME()) < 20 BEGIN" - + " SELECT 2 x INTO #y" - + " DROP TABLE #y" - + " END" - + " SELECT 'b'"; - Task t = RunReadAsync(sql); - double elapsedSync = RunReadSync(sql); - t.Wait(); - double elapsedAsync = t.Result; - Assert.True(elapsedAsync < elapsedSync, "Asynchronous operation should be finished quicker than synchronous one"); - int limit = 100; - Assert.True(elapsedAsync < limit, $"Asynchronous operation should be finished within {limit}ms"); - } - - private static async Task RunReadAsync(string sql) - { - double maxElapsedTimeMillisecond = 0; - using (SqlConnection connection = new SqlConnection(DataTestUtility.TCPConnectionString)) - { - await connection.OpenAsync(); - using (SqlCommand command = connection.CreateCommand()) - { - command.CommandText = sql; - using (SqlDataReader reader = await command.ExecuteReaderAsync()) - { - Task t; - Stopwatch stopwatch = new Stopwatch(); - do - { - do - { - stopwatch.Start(); - t = reader.ReadAsync(); - stopwatch.Stop(); - double elased = stopwatch.Elapsed.TotalMilliseconds; - if (maxElapsedTimeMillisecond < elased) - { - maxElapsedTimeMillisecond = elased; - } - } - while (await t); - } - while (reader.NextResult()); - } - } - } - - return maxElapsedTimeMillisecond; - } - - private static double RunReadSync(string sql) - { - double maxElapsedTimeMillisecond = 0; - using (SqlConnection connection = new SqlConnection(DataTestUtility.TCPConnectionString)) - { - connection.Open(); - using (SqlCommand command = connection.CreateCommand()) - { - command.CommandText = sql; - using (SqlDataReader reader = command.ExecuteReader()) - { - bool result; - Stopwatch stopwatch = new Stopwatch(); - do - { - do - { - stopwatch.Start(); - result = reader.Read(); - stopwatch.Stop(); - double elased = stopwatch.Elapsed.TotalMilliseconds; - if (maxElapsedTimeMillisecond < elased) - { - maxElapsedTimeMillisecond = elased; - } - } - while (result); - } - while (reader.NextResult()); - } - } - } - - return maxElapsedTimeMillisecond; - } - } -} diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectionTestWithSSLCert/CertificateTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectionTestWithSSLCert/CertificateTest.cs index d500391227..f30cdfa4d4 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectionTestWithSSLCert/CertificateTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ConnectionTestWithSSLCert/CertificateTest.cs @@ -18,6 +18,7 @@ namespace Microsoft.Data.SqlClient.ManualTesting.Tests { + [PlatformSpecific(TestPlatforms.Windows)] public class CertificateTest : IDisposable { #region Private Fields @@ -75,10 +76,11 @@ public CertificateTest() SlashInstanceName = $"\\{InstanceName}"; } - Assert.True(DataTestUtility.IsAdmin, "CertificateTest class needs to be run in Admin mode."); - - CreateValidCertificate(s_fullPathToPowershellScript); - _thumbprint = Environment.GetEnvironmentVariable(ThumbPrintEnvName, EnvironmentVariableTarget.Machine); + if (IsAdmin()) + { + CreateValidCertificate(s_fullPathToPowershellScript); + _thumbprint = Environment.GetEnvironmentVariable(ThumbPrintEnvName, EnvironmentVariableTarget.Machine); + } } private static bool IsLocalHost() @@ -91,17 +93,16 @@ private static bool IsLocalHost() private static bool AreConnStringsSetup() => DataTestUtility.AreConnStringsSetup(); private static bool IsNotAzureServer() => DataTestUtility.IsNotAzureServer(); private static bool UseManagedSNIOnWindows() => DataTestUtility.UseManagedSNIOnWindows; + private static bool IsAdmin() => DataTestUtility.IsAdmin; - [ActiveIssue("31754")] - [ConditionalFact(nameof(AreConnStringsSetup), nameof(IsNotAzureServer), nameof(IsLocalHost))] - [PlatformSpecific(TestPlatforms.Windows)] - public void OpenningConnectionWithGoodCertificateTest() + [ConditionalFact(nameof(AreConnStringsSetup), nameof(IsNotAzureServer), nameof(IsLocalHost), nameof(IsAdmin))] + public void OpeningConnectionWithGoodCertificateTest() { SqlConnectionStringBuilder builder = new(DataTestUtility.TCPConnectionString); // confirm that ForceEncryption is enabled - using SqlConnection notEncryptedConnection = new(builder.ConnectionString); builder.Encrypt = SqlConnectionEncryptOption.Optional; + using SqlConnection notEncryptedConnection = new(builder.ConnectionString); notEncryptedConnection.Open(); Assert.Equal(ConnectionState.Open, notEncryptedConnection.State); @@ -122,9 +123,7 @@ public void OpenningConnectionWithGoodCertificateTest() // Provided hostname in certificate are: // localhost, FQDN, Loopback IPv4: 127.0.0.1, IPv6: ::1 - [ActiveIssue("31754")] - [ConditionalFact(nameof(AreConnStringsSetup), nameof(IsNotAzureServer), nameof(IsLocalHost))] - [PlatformSpecific(TestPlatforms.Windows)] + [ConditionalFact(nameof(AreConnStringsSetup), nameof(IsNotAzureServer), nameof(IsLocalHost), nameof(IsAdmin))] public void OpeningConnectionWitHNICTest() { // Mandatory @@ -142,11 +141,6 @@ public void OpeningConnectionWitHNICTest() connection.Open(); Assert.Equal(ConnectionState.Open, connection.State); - // Ipv6 however causes name mistmatch error - // In net6 Manged SNI does not check for SAN. Therefore Application using Net6 have to use FQDN as HNIC - // According to above no other hostname in certificate than FQDN will work in net6 which is same as SubjectName in case of RemoteCertificateNameMismatch - // Net7.0 the new API added by dotnet runtime will check SANS and then SubjectName - builder.DataSource = IPV6 + SlashInstanceName; builder.HostNameInCertificate = Dns.GetHostEntry(Environment.MachineName).HostName; builder.Encrypt = SqlConnectionEncryptOption.Mandatory; @@ -167,8 +161,7 @@ public void OpeningConnectionWitHNICTest() } [ActiveIssue("31754")] - [ConditionalFact(nameof(AreConnStringsSetup), nameof(UseManagedSNIOnWindows), nameof(IsNotAzureServer), nameof(IsLocalHost))] - [PlatformSpecific(TestPlatforms.Windows)] + [ConditionalFact(nameof(AreConnStringsSetup), nameof(UseManagedSNIOnWindows), nameof(IsNotAzureServer), nameof(IsLocalHost), nameof(IsAdmin))] public void RemoteCertificateNameMismatchErrorTest() { SqlConnectionStringBuilder builder = new(DataTestUtility.TCPConnectionString) diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataStreamTest/DataStreamTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataStreamTest/DataStreamTest.cs index 7fda024ed5..858cef0715 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataStreamTest/DataStreamTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/DataStreamTest/DataStreamTest.cs @@ -12,6 +12,7 @@ using System.Threading; using System.Threading.Tasks; using System.Xml; +using Microsoft.Data.SqlClient.TestUtilities; using Xunit; namespace Microsoft.Data.SqlClient.ManualTesting.Tests @@ -23,15 +24,14 @@ public static void RunAllTestsForSingleServer_NP() { if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { - DataTestUtility.AssertThrowsWrapper(() => RunAllTestsForSingleServer(DataTestUtility.NPConnectionString, true)); + DataTestUtility.AssertThrowsWrapper(() => RunAllTestsForSingleServer(DataTestUtility.NPConnectionString)); } else { - RunAllTestsForSingleServer(DataTestUtility.NPConnectionString, true); + RunAllTestsForSingleServer(DataTestUtility.NPConnectionString); } } - [ActiveIssue("5540")] [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))] public static void RunAllTestsForSingleServer_TCP() { @@ -119,7 +119,34 @@ static async Task LocalCopyTo(Stream source, Stream destination, int bufferSize, Assert.Fail($"input and output differ at index {index}, input={inputData[index]}, output={outputData[index]}"); } } + } + + [ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureServer))] + [MemberData(nameof(DataTestUtility.GetConnectionStringsWithEnclaveMemberData), MemberType = typeof(DataTestUtility))] + public static void XEventsStreamingTest(string connectionString) + { + TestXEventsStreaming(connectionString); + } + [ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsUsingNativeSNI), nameof(DataTestUtility.IsNotNamedInstance), nameof(DataTestUtility.IsNotAzureServer))] + [MemberData(nameof(DataTestUtility.GetConnectionStringsWithEnclaveMemberData), MemberType = typeof(DataTestUtility))] + public static void TestTimeoutDuringReadAsyncWithClosedReaderTest(string connectionString) + { + TimeoutDuringReadAsyncWithClosedReaderTest(connectionString); + } + + [ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotNamedInstance), nameof(DataTestUtility.IsNotAzureServer))] + [MemberData(nameof(DataTestUtility.GetConnectionStringsWithEnclaveMemberData), MemberType = typeof(DataTestUtility))] + public static void NonFatalTimeoutDuringReadTest(string connectionString) + { + NonFatalTimeoutDuringRead(connectionString); + } + + [ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))] + [MemberData(nameof(DataTestUtility.GetConnectionStringsWithEnclaveMemberData), MemberType = typeof(DataTestUtility))] + public static void XmlReaderTest(string connectionString) + { + ExecuteXmlReaderTest(connectionString); } private static byte[] CreateBinaryTable(SqlConnection connection, string tableName, int packetSize) @@ -152,7 +179,7 @@ IF OBJECT_ID('dbo.{tableName}', 'U') IS NOT NULL return data; } - private static void RunAllTestsForSingleServer(string connectionString, bool usingNamePipes = false) + private static void RunAllTestsForSingleServer(string connectionString) { RowBuffer(connectionString); InvalidRead(connectionString); @@ -165,7 +192,6 @@ private static void RunAllTestsForSingleServer(string connectionString, bool usi TimestampRead(connectionString); OrphanReader(connectionString); BufferSize(connectionString); - ExecuteXmlReaderTest(connectionString); SequentialAccess(connectionString); HasRowsTest(connectionString); CloseConnection(connectionString); @@ -178,17 +204,6 @@ private static void RunAllTestsForSingleServer(string connectionString, bool usi ReadTextReader(connectionString); StreamingBlobDataTypes(connectionString); OutOfOrderGetChars(connectionString); - TestXEventsStreaming(connectionString); - - // These tests fail with named pipes, since they try to do DNS lookups on named pipe paths. - if (!usingNamePipes) - { - if (DataTestUtility.IsUsingNativeSNI()) - { - TimeoutDuringReadAsyncWithClosedReaderTest(connectionString); - } - NonFatalTimeoutDuringRead(connectionString); - } } private static void MultipleResults(string connectionString) @@ -679,7 +694,7 @@ private static void ExecuteXmlReaderTest(string connectionString) using (SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); - using (SqlCommand cmd = new SqlCommand("select employeeId, lastname, firstname from employees for xml auto", conn)) + using (SqlCommand cmd = new SqlCommand("select employeeId, lastname, firstname from employees order by employeeId asc for xml auto", conn)) { XmlReader xr; using (xr = cmd.ExecuteXmlReader()) @@ -708,7 +723,7 @@ private static void ExecuteXmlReaderTest(string connectionString) } // use a big result to fill up the pipe and do a partial read - cmd.CommandText = "select * from orders for xml auto"; + cmd.CommandText = "select * from orders order by orderid asc for xml auto"; string errorMessage; using (xr = cmd.ExecuteXmlReader()) { @@ -752,9 +767,9 @@ private static void ExecuteXmlReaderTest(string connectionString) // multiple results cmd.CommandText = - "select orderid from orders where orderid < 10253 for xml auto;" + - "select customerid from customers where customerid < 'ANTON' for xml auto;" + - "select employeeId from employees where employeeid < 3 for xml auto;"; + "select orderid from orders where orderid < 10253 order by orderid asc for xml auto;" + + "select customerid from customers where customerid < 'ANTON' order by customerid asc for xml auto;" + + "select employeeId from employees where employeeid < 3 order by employeeid asc for xml auto;"; using (xr = cmd.ExecuteXmlReader()) { string[] expectedResults = @@ -893,7 +908,7 @@ private static void SequentialAccess(string connectionString) } } - using (SqlCommand cmd = new SqlCommand("select * from employees", conn)) + using (SqlCommand cmd = new SqlCommand("select * from employees order by EmployeeID", conn)) { // test sequential access with partial reads using (reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess)) @@ -2074,7 +2089,7 @@ private static void NonFatalTimeoutDuringRead(string connectionString) // Close will now observe the stored timeout error string errorMessage = SystemDataResourceManager.Instance.SQL_Timeout_Execution; - DataTestUtility.AssertThrowsWrapper(reader.Dispose, errorMessage); + DataTestUtility.AssertThrowsWrapper(reader.Close, errorMessage); } } } diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ExceptionTest/ConnectionExceptionTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ExceptionTest/ConnectionExceptionTest.cs index b1ba557562..1f7003e28c 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ExceptionTest/ConnectionExceptionTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ExceptionTest/ConnectionExceptionTest.cs @@ -34,21 +34,16 @@ public void TestConnectionStateWithErrorClass20() Assert.Equal(System.Data.ConnectionState.Open, conn.State); server.Dispose(); - try - { - int result2 = cmd.ExecuteNonQuery(); - } - catch (SqlException ex) - { - Assert.Equal(11, ex.Class); - Assert.NotNull(ex.InnerException); - SqlException innerEx = Assert.IsType(ex.InnerException); - Assert.Equal(20, innerEx.Class); - Assert.StartsWith("A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible.", innerEx.Message); - // Since the server is not accessible driver can close the close the connection - // It is user responsibilty to maintain the connection. - Assert.Equal(System.Data.ConnectionState.Closed, conn.State); - } + + var exception = Assert.Throws(() => cmd.ExecuteNonQuery()); + Assert.Equal(11, exception.Class); + Assert.NotNull(exception.InnerException); + SqlException innerEx = Assert.IsType(exception.InnerException); + Assert.Equal(20, innerEx.Class); + Assert.StartsWith("A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible.", innerEx.Message); + // Since the server is not accessible, the driver can close the connection. + // It is the user's responsibility to maintain the connection. + Assert.Equal(System.Data.ConnectionState.Closed, conn.State); } [Fact] diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/IntegratedAuthenticationTest/IntegratedAuthenticationTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/IntegratedAuthenticationTest/IntegratedAuthenticationTest.cs index e043b2253c..c6ef21bc5a 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/IntegratedAuthenticationTest/IntegratedAuthenticationTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/IntegratedAuthenticationTest/IntegratedAuthenticationTest.cs @@ -30,7 +30,6 @@ public static void IntegratedAuthenticationTestWithOutConnectionPooling() TryOpenConnectionWithIntegratedAuthentication(builder.ConnectionString); } - [ActiveIssue("21707")] [ConditionalFact(nameof(IsIntegratedSecurityEnvironmentSet), nameof(AreConnectionStringsSetup))] public static void IntegratedAuthenticationTest_InvalidServerSPN() { diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/LocalDBTest/LocalDBTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/LocalDBTest/LocalDBTest.cs index 29ff71270c..4896a20e20 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/LocalDBTest/LocalDBTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/LocalDBTest/LocalDBTest.cs @@ -92,15 +92,13 @@ public static void SqlLocalDbSharedInstanceConnectionTest() #region NamedPipeTests - [Fact] - [ActiveIssue("20245")] //pending pipeline configuration + [ConditionalFact(nameof(IsLocalDBEnvironmentSet))] public static void SqlLocalDbNamedPipeConnectionTest() { ConnectionTest(s_localDbNamedPipeConnectionString); } - [Fact] - [ActiveIssue("20245")] //pending pipeline configuration + [ConditionalFact(nameof(IsLocalDBEnvironmentSet))] public static void LocalDBNamedPipeEncryptionNotSupportedTest() { // Encryption is not supported by SQL Local DB. @@ -108,8 +106,7 @@ public static void LocalDBNamedPipeEncryptionNotSupportedTest() ConnectionWithEncryptionTest(s_localDbNamedPipeConnectionString); } - [Fact] - [ActiveIssue("20245")] //pending pipeline configuration + [ConditionalFact(nameof(IsLocalDBEnvironmentSet))] public static void LocalDBNamepipeMarsTest() { ConnectionWithMarsTest(s_localDbNamedPipeConnectionString); diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpTest.cs index d1fe3bf6ac..b04af8f015 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/ParameterTest/TvpTest.cs @@ -53,7 +53,6 @@ public void TestMain() } [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureServer))] - [ActiveIssue("5531")] public void TestPacketNumberWraparound() { // this test uses a specifically crafted sql record enumerator and data to put the TdsParserStateObject.WritePacket(byte,bool) diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/SqlCommandReliabilityTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/SqlCommandReliabilityTest.cs index 7c590ebe05..0f4234dae9 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/SqlCommandReliabilityTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/SqlCommandReliabilityTest.cs @@ -135,7 +135,6 @@ public void RetryExecuteCancel(string cnnString, SqlRetryLogicBaseProvider provi } } - [ActiveIssue("14588")] [ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.IsNotAzureSynapse), nameof(DataTestUtility.AreConnStringsSetup))] [MemberData(nameof(RetryLogicTestHelper.GetConnectionAndRetryStrategyInvalidCommand), parameters: new object[] { 5 }, MemberType = typeof(RetryLogicTestHelper), DisableDiscoveryEnumeration = true)] public void RetryExecuteWithTransScope(string cnnString, SqlRetryLogicBaseProvider provider) @@ -261,7 +260,6 @@ public void RetryExecuteUnauthorizedSqlStatementDML(string cnnString, SqlRetryLo } } - [ActiveIssue("14325")] // avoid creating a new database in Azure [ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.IsNotAzureServer), nameof(DataTestUtility.IsNotAzureSynapse), nameof(DataTestUtility.AreConnStringsSetup))] [MemberData(nameof(RetryLogicTestHelper.GetConnectionAndRetryStrategyDropDB), parameters: new object[] { 5 }, MemberType = typeof(RetryLogicTestHelper), DisableDiscoveryEnumeration = true)] @@ -283,7 +281,7 @@ public void DropDatabaseWithActiveConnection(string cnnString, SqlRetryLogicBase cnn1.Open(); cmd.Connection = cnn1; // Create the database and wait until it is finalized. - cmd.CommandText = $"CREATE DATABASE [{database}]; \nWHILE(NOT EXISTS(SELECT 1 FROM sys.databases WHERE name = '{database}')) \nWAITFOR DELAY '00:00:10' "; + cmd.CommandText = $"CREATE DATABASE [{database}]; \nWHILE(NOT EXISTS(SELECT 1 FROM sys.databases WHERE name = '{database}')) \nWAITFOR DELAY '00:00:01' "; cmd.ExecuteNonQuery(); try @@ -292,7 +290,7 @@ public void DropDatabaseWithActiveConnection(string cnnString, SqlRetryLogicBase cnn2.Open(); cnn3.Open(); - // kill the active connection to the database after the first faliure. + // kill the active connection to the database after the first failure. provider.Retrying += (s, e) => { currentRetries = e.RetryCount; diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/SqlConnectionReliabilityTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/SqlConnectionReliabilityTest.cs index cfe01d38ca..43588e7ec2 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/SqlConnectionReliabilityTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/RetryLogic/SqlConnectionReliabilityTest.cs @@ -51,7 +51,6 @@ public void ConnectionCancelRetryOpenInvalidCatalog(string cnnString, SqlRetryLo } } - [ActiveIssue("14590", TestPlatforms.Windows)] // avoid creating a new database in Azure [ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.IsNotAzureServer), nameof(DataTestUtility.IsNotAzureSynapse), nameof(DataTestUtility.AreConnStringsSetup))] [MemberData(nameof(RetryLogicTestHelper.GetConnectionAndRetryStrategyLongRunner), parameters: new object[] { 10 }, MemberType = typeof(RetryLogicTestHelper), DisableDiscoveryEnumeration = true)] @@ -76,7 +75,7 @@ public void CreateDatabaseWhileTryingToConnect(string cnnString, SqlRetryLogicBa provider.Retrying += (s, e) => { currentRetries = e.RetryCount; - // Try to create database just after first faliure. + // Try to create database just after first failure. if (createDBTask == null || createDBTask.Status == TaskStatus.Faulted) { cmd.CommandText = $"IF (NOT EXISTS(SELECT 1 FROM sys.databases WHERE name = '{database}')) CREATE DATABASE [{database}];"; @@ -100,7 +99,6 @@ public void CreateDatabaseWhileTryingToConnect(string cnnString, SqlRetryLogicBa Assert.True(currentRetries > 0); } - [ActiveIssue("25147")] [ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))] [MemberData(nameof(RetryLogicTestHelper.GetConnectionAndRetryStrategyInvalidCatalog), parameters: new object[] { 2 }, MemberType = typeof(RetryLogicTestHelper), DisableDiscoveryEnumeration = true)] public void ConcurrentExecution(string cnnString, SqlRetryLogicBaseProvider provider) diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlCommand/SqlCommandCancelTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlCommand/SqlCommandCancelTest.cs index 0928a71569..0ffb275b2c 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlCommand/SqlCommandCancelTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlCommand/SqlCommandCancelTest.cs @@ -157,7 +157,7 @@ public static void TimeoutCancel() TimeoutCancel(tcp_connStr); } - [ActiveIssue("12167")] + [ActiveIssue("12167", typeof(DataTestUtility), nameof(DataTestUtility.UseManagedSNIOnWindows))] // Managed SNI does not seem to work here [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureServer))] [PlatformSpecific(TestPlatforms.Windows)] public static void TimeoutCancelNP() @@ -178,15 +178,13 @@ public static void CancelAndDisposePreparedCommandNP() CancelAndDisposePreparedCommand(np_connStr); } - [ActiveIssue("5541")] - [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))] + [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureServer), nameof(DataTestUtility.IsNotNamedInstance))] public static void TimeOutDuringRead() { TimeOutDuringRead(tcp_connStr); } - [ActiveIssue("5541")] - [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureServer))] + [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureServer), nameof(DataTestUtility.IsNotNamedInstance))] [PlatformSpecific(TestPlatforms.Windows)] public static void TimeOutDuringReadNP() { @@ -357,7 +355,8 @@ private static void TimeoutCancel(string constr) cmd.CommandText = "WAITFOR DELAY '00:00:20';select * from Customers"; string errorMessage = SystemDataResourceManager.Instance.SQL_Timeout_Execution; - DataTestUtility.ExpectFailure(() => ExecuteReaderOnCmd(cmd), new string[] { errorMessage }); + var ex = Assert.Throws(() => ExecuteReaderOnCmd(cmd)); + Assert.Equal(errorMessage, ex.Message); VerifyConnection(cmd); } diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlCredentialTest/SqlCredentialTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlCredentialTest/SqlCredentialTest.cs index ae656f11a4..5c345922c7 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlCredentialTest/SqlCredentialTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/SqlCredentialTest/SqlCredentialTest.cs @@ -44,7 +44,6 @@ public static void CreateSqlConnectionWithCredential() } } - [ActiveIssue("9196")] [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureServer))] public static void SqlConnectionChangePasswordPlaintext() { @@ -78,7 +77,6 @@ public static void SqlConnectionChangePasswordPlaintext() } } - [ActiveIssue("9196")] [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureServer))] public static void SqlConnectionChangePasswordSecureString() { diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/SqlServerTypesTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/SqlServerTypesTest.cs index bdbd805e73..f939b42cc7 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/SqlServerTypesTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/SqlServerTypesTest.cs @@ -252,7 +252,6 @@ private static void TestUdtSqlDataReaderGetStream(CommandBehavior behavior) } // Synapse: Parse error at line: 1, column: 41: Incorrect syntax near 'hierarchyid'. - [ActiveIssue("25421", TargetFrameworkMonikers.NetFramework)] [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))] public static void TestUdtSchemaMetadata() { diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtBulkCopyTest.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtBulkCopyTest.cs index 8adf6c7bb5..49e83ede43 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtBulkCopyTest.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtBulkCopyTest.cs @@ -11,7 +11,6 @@ public class UdtBulkCopyTest { private string _connStr; - [ActiveIssue("5535")] [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.IsUdtTestDatabasePresent), nameof(DataTestUtility.AreConnStringsSetup))] public void RunCopyTest() { diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtTest2.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtTest2.cs index 16d48d7c37..16d8195bd8 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtTest2.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/UdtTest/UdtTest2.cs @@ -11,7 +11,6 @@ namespace Microsoft.Data.SqlClient.ManualTesting.Tests { - [ActiveIssue("5536")] // TODO Synapse: Remove dependency from UDTTest Database public class UdtTest2 { diff --git a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/WeakRefTestYukonSpecific/WeakRefTestYukonSpecific.cs b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/WeakRefTestYukonSpecific/WeakRefTestYukonSpecific.cs index 493f7e0035..9683e474a1 100644 --- a/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/WeakRefTestYukonSpecific/WeakRefTestYukonSpecific.cs +++ b/src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/WeakRefTestYukonSpecific/WeakRefTestYukonSpecific.cs @@ -17,7 +17,6 @@ public static class WeakRefTestYukonSpecific private const int CONCURRENT_COMMANDS = 5; // TODO Synapse: Remove dependency on Northwind database - [ActiveIssue("6643", TestPlatforms.AnyUnix)] [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))] public static void TestReaderMars() {