Skip to content

Commit

Permalink
Tests | Update Test Lab for Azure Synapse compatible test suite (dotn…
Browse files Browse the repository at this point in the history
  • Loading branch information
cheenamalhotra authored and TrayanZapryanov committed Sep 18, 2020
1 parent 0a49e31 commit 01a58b8
Show file tree
Hide file tree
Showing 46 changed files with 312 additions and 194 deletions.
19 changes: 10 additions & 9 deletions BUILDGUIDE.md
Expand Up @@ -74,22 +74,22 @@ Once the environment is setup properly, execute the desired set of commands belo

## Run Functional Tests

Windows (`netfx x86`):
Windows (`netfx x86`):
```bash
> dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Platform="Win32" /p:Configuration="Release" /p:TestTargetOS="Windowsnetfx" --no-build -v n --filter "category!=nonnetfxtests&category!=failing&category!=nonwindowstests"
```

Windows (`netfx x64`):
Windows (`netfx x64`):
```bash
> dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Platform="x64" /p:Configuration="Release" /p:TestTargetOS="Windowsnetfx" --no-build -v n --filter "category!=nonnetfxtests&category!=failing&category!=nonwindowstests"
```

Windows (`netcoreapp`):
Windows (`netcoreapp`):
```bash
> dotnet test "src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" /p:Platform="AnyCPU" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests"
```

Unix (`netcoreapp`):
Unix (`netcoreapp`):
```bash
> dotnet test "src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj" /p:Platform="AnyCPU" /p:Configuration="Release" /p:TestTargetOS="Unixnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonlinuxtests&category!=nonuaptests"
```
Expand Down Expand Up @@ -118,25 +118,26 @@ Manual Tests require the below setup to run:
|SupportsIntegratedSecurity | (Optional) Whether or not the USER running tests has integrated security access to the target SQL Server.| `true` OR `false`|
|SupportsFileStream | (Optional) Whether or not FileStream is enabled on SQL Server| `true` OR `false`|
|UseManagedSNIOnWindows | (Optional) Enables testing with Managed SNI on Windows| `true` OR `false`|
|IsAzureSynpase | (Optional) When set to 'true', test suite runs compatible tests for Azure Synapse/Parallel Data Warehouse. | `true` OR `false`|

Commands to run tests:

Windows (`netfx x86`):
Windows (`netfx x86`):
```bash
> dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Platform="Win32" /p:Configuration="Release" /p:TestTargetOS="Windowsnetfx" --no-build -v n --filter "category!=nonnetfxtests&category!=failing&category!=nonwindowstests"
```

Windows (`netfx x64`):
Windows (`netfx x64`):
```bash
> dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Platform="x64" /p:Configuration="Release" /p:TestTargetOS="Windowsnetfx" --no-build -v n --filter "category!=nonnetfxtests&category!=failing&category!=nonwindowstests"
```

Windows (`netcoreapp`):
Windows (`netcoreapp`):
```bash
> dotnet test "src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Platform="AnyCPU" /p:Configuration="Release" /p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests"
```

Unix (`netcoreapp`):
Unix (`netcoreapp`):
```bash
> dotnet test "src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" /p:Platform="AnyCPU" /p:Configuration="Release" /p:TestTargetOS="Unixnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonlinuxtests&category!=nonuaptests"
```
Expand All @@ -156,7 +157,7 @@ Tests can be built and run with custom "Reference Type" property that enables di
- "NetStandardPackage" => Build and run tests with Microsoft.Data.SqlClient as Package Reference via .NET Standard Library

> ************** IMPORTANT NOTE BEFORE PROCEEDING WITH "PACKAGE" AND "NETSTANDARDPACKAGE" REFERENCE TYPES ***************
> CREATE A NUGET PACKAGE WITH BELOW COMMAND AND ADD TO LOCAL FOLDER + UPDATE NUGET CONFIG FILE TO READ FROM THAT LOCATION
> CREATE A NUGET PACKAGE WITH BELOW COMMAND AND ADD TO LOCAL FOLDER + UPDATE NUGET CONFIG FILE TO READ FROM THAT LOCATION
> ```
> > msbuild /p:configuration=Release
> ```
Expand Down
Expand Up @@ -11,7 +11,8 @@ namespace Microsoft.Data.SqlClient.ManualTesting.Tests.AlwaysEncrypted
{
public class CoreCryptoTests : IClassFixture<SQLSetupStrategyCertStoreProvider>
{
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
// Synapse: Always Encrypted not supported in Azure Synapse.
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))]
[PlatformSpecific(TestPlatforms.Windows)]
public void TestAeadCryptoWithNativeBaseline()
{
Expand Down Expand Up @@ -45,7 +46,8 @@ public void TestAeadCryptoWithNativeBaseline()
}
}

[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
// Synapse: Always Encrypted not supported in Azure Synapse.
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))]
[PlatformSpecific(TestPlatforms.Windows)]
public void TestRsaCryptoWithNativeBaseline()
{
Expand Down
Expand Up @@ -144,7 +144,7 @@ public void TestRoundTripWithCSPAndCertStoreProvider()
}
}

[ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
[ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringSetupForAE))]
[ClassData(typeof(AEConnectionStringProvider))]
public void TestEncryptDecryptWithCSP(string connectionString)
{
Expand Down
Expand Up @@ -15,7 +15,7 @@ public static class DDAsyncTest
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
public static void OpenConnection_WithAsyncTrue_ThrowsNotSupportedException()
{
//Fails on NetCore
//Passes on NetCore
var asyncConnectionString = DataTestUtility.TCPConnectionString + ";async=true";
Assert.Throws<NotSupportedException>(() => { new SqlConnection(asyncConnectionString); });
}
Expand All @@ -30,7 +30,8 @@ public static void OpenConnection_WithAsyncTrue()
}

#region <<ExecuteCommand_WithNewConnection>>
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
// TODO Synapse: Remove dependency on Northwind database by creating required table in setup.
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))]
public static void ExecuteCommand_WithNewConnection_ShouldPerformAsyncByDefault()
{
var executedProcessList = new List<string>();
Expand Down Expand Up @@ -75,7 +76,8 @@ private static async Task ExecuteCommandWithNewConnectionAsync(string processNam
#endregion

#region <<ExecuteCommand_WithSharedConnection>>
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
// Synapse: Parallel query execution on the same connection is not supported.
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))]
public static void ExecuteCommand_WithSharedConnection_ShouldPerformAsyncByDefault()
{
var executedProcessList = new List<string>();
Expand Down
Expand Up @@ -12,7 +12,8 @@ namespace Microsoft.Data.SqlClient.ManualTesting.Tests
{
public static class DDDataTypesTest
{
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
// Synapse: Cannot find data type 'XML'.
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))]
public static void XmlTest()
{
string tempTable = "xml_" + Guid.NewGuid().ToString().Replace('-', '_');
Expand Down Expand Up @@ -73,7 +74,8 @@ public static void XmlTest()
}
}

[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
// Synapse: The statement failed. Column 'col1' has a data type that cannot participate in a columnstore index.
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))]
public static void MaxTypesTest()
{
string tempTable = "max_" + Guid.NewGuid().ToString().Replace('-', '_');
Expand Down
Expand Up @@ -8,7 +8,8 @@ namespace Microsoft.Data.SqlClient.ManualTesting.Tests
{
public static class DDMARSTest
{
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
// TODO Synapse: Remove dependency from Northwind database
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))]
public static void TestMain()
{
string connstr = (new SqlConnectionStringBuilder(DataTestUtility.TCPConnectionString) { MultipleActiveResultSets = true }).ConnectionString;
Expand Down
Expand Up @@ -41,7 +41,7 @@ public static class DataTestUtility
public static readonly bool SupportsLocalDb = false;
public static readonly bool SupportsFileStream = false;
public static readonly bool UseManagedSNIOnWindows = false;

public static readonly bool IsAzureSynapse = false;
public static readonly string DNSCachingConnString = null;
public static readonly string DNSCachingServerCR = null; // this is for the control ring
public static readonly string DNSCachingServerTR = null; // this is for the tenant ring
Expand Down Expand Up @@ -79,6 +79,7 @@ static DataTestUtility()
DNSCachingConnString = c.DNSCachingConnString;
DNSCachingServerCR = c.DNSCachingServerCR;
DNSCachingServerTR = c.DNSCachingServerTR;
IsAzureSynapse = c.IsAzureSynapse;
IsDNSCachingSupportedCR = c.IsDNSCachingSupportedCR;
IsDNSCachingSupportedTR = c.IsDNSCachingSupportedTR;
EnclaveAzureDatabaseConnString = c.EnclaveAzureDatabaseConnString;
Expand Down Expand Up @@ -243,21 +244,28 @@ public static bool IsSupportedDataClassification()

public static bool IsDNSCachingSetup() => !string.IsNullOrEmpty(DNSCachingConnString);

// 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 IsEnclaveAzureDatabaseSetup()
{
return EnclaveEnabled && !string.IsNullOrEmpty(EnclaveAzureDatabaseConnString);
return EnclaveEnabled && !string.IsNullOrEmpty(EnclaveAzureDatabaseConnString) && IsNotAzureSynapse();
}

public static bool IsUdtTestDatabasePresent() => IsDatabasePresent(UdtTestDbName);
public static bool IsNotAzureSynapse() => !IsAzureSynapse;

// Synapse: UDT Test Database not compatible with Azure Synapse.
public static bool IsUdtTestDatabasePresent() => IsDatabasePresent(UdtTestDbName) && IsNotAzureSynapse();

public static bool AreConnStringsSetup()
{
return !string.IsNullOrEmpty(NPConnectionString) && !string.IsNullOrEmpty(TCPConnectionString);
}

// 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 AreConnStringSetupForAE()
{
return AEConnStrings.Count > 0;
return AEConnStrings.Count > 0 && IsNotAzureSynapse();
}

public static bool IsAADPasswordConnStrSetup()
Expand All @@ -280,19 +288,23 @@ public static bool IsNotAzureServer()
return !AreConnStringsSetup() || !Utils.IsAzureSqlServer(new SqlConnectionStringBuilder((TCPConnectionString)).DataSource);
}

// 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()
{
return !string.IsNullOrEmpty(AKVUrl) && !string.IsNullOrEmpty(AKVClientId) && !string.IsNullOrEmpty(AKVClientSecret);
return !string.IsNullOrEmpty(AKVUrl) && !string.IsNullOrEmpty(AKVClientId) && !string.IsNullOrEmpty(AKVClientSecret) && IsNotAzureSynapse();
}

public static bool IsUsingManagedSNI() => UseManagedSNIOnWindows;

public static bool IsUsingNativeSNI() => !IsUsingManagedSNI();

// Synapse: UTF8 collations are not supported with Azure Synapse.
// Ref: https://feedback.azure.com/forums/307516-azure-synapse-analytics/suggestions/40103791-utf-8-collations-should-be-supported-in-azure-syna
public static bool IsUTF8Supported()
{
bool retval = false;
if (AreConnStringsSetup())
if (AreConnStringsSetup() && IsNotAzureSynapse())
{
using (SqlConnection connection = new SqlConnection(TCPConnectionString))
using (SqlCommand command = new SqlCommand())
Expand Down
Expand Up @@ -11,7 +11,8 @@ namespace Microsoft.Data.SqlClient.ManualTesting.Tests
{
public static class ReaderTest
{
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
// TODO Synapse: Remove dependency from Northwind database
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))]
public static void TestMain()
{
string connectionString = DataTestUtility.TCPConnectionString;
Expand Down

0 comments on commit 01a58b8

Please sign in to comment.