Skip to content
1 change: 1 addition & 0 deletions BUILDGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ Manual Tests require the below setup to run:
|FileStreamDirectory | (Optional) If File Stream is enabled on SQL Server, pass local directory path to be used for setting up File Stream enabled database. | `D:\\escaped\\absolute\\path\\to\\directory\\` |
|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`|
|MakecertPath | The location of makercert.exe. This is not required if the path is present in the PATH environment variable. | Location of makecert.exe on machine |

### Commands to run Manual Tests:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ internal static void CreateCertificate(string certificateName, string certificat
Assert.False(string.IsNullOrWhiteSpace(certificateName), "FAILED: certificateName should not be null or empty.");
Assert.False(string.IsNullOrWhiteSpace(certificateLocation), "FAILED: certificateLocation should not be null or empty.");

ProcessStartInfo processStartInfo = new ProcessStartInfo(@"makecert");
string makecertPath = string.IsNullOrEmpty(DataTestUtility.MakecertPath) ? "makecert" : DataTestUtility.MakecertPath;
ProcessStartInfo processStartInfo = new ProcessStartInfo(makecertPath);
processStartInfo.Arguments = string.Format(@"-n ""CN={0}"" -pe -sr {1} -r -eku 1.3.6.1.5.5.8.2.2,1.3.6.1.4.1.311.10.3.11 -ss my -sky exchange -sp ""{2}"" -sy {3} -len 2048 -a sha256",
certificateName,
certificateLocation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public static class DataTestUtility
public static readonly bool UseManagedSNIOnWindows = false;
public static readonly bool IsAzureSynapse = false;
public static Uri AKVBaseUri = null;
public static readonly string MakecertPath = null;
public static string FileStreamDirectory = null;

public static readonly string DNSCachingConnString = null;
Expand Down Expand Up @@ -99,6 +100,7 @@ static DataTestUtility()
IsDNSCachingSupportedTR = c.IsDNSCachingSupportedTR;
EnclaveAzureDatabaseConnString = c.EnclaveAzureDatabaseConnString;
UserManagedIdentityClientId = c.UserManagedIdentityClientId;
MakecertPath = c.MakecertPath;

System.Net.ServicePointManager.SecurityProtocol |= System.Net.SecurityProtocolType.Tls12;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ public class AdapterTest
public AdapterTest()
{
// create random name for temp tables
_randomGuid = Guid.NewGuid().ToString();
_tempTable = Environment.MachineName + "_" + _randomGuid;
_tempTable = DataTestUtility.GetUniqueName("AdapterTest");
_tempTable = _tempTable.Replace('-', '_');

_randomGuid = Guid.NewGuid().ToString();
_tempKey = "employee_id_key_" + Environment.TickCount.ToString() + _randomGuid;
_tempKey = _tempKey.Replace('-', '_');

Expand Down Expand Up @@ -768,33 +768,35 @@ public void BulkUpdateTest()
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))]
public void UpdateRefreshTest()
{
string identTableName = DataTestUtility.GetUniqueName("ID_");
string createIdentTable =
"CREATE TABLE ID_" + _tempTable + "(id int IDENTITY," +
$"CREATE TABLE {identTableName} (id int IDENTITY," +
"LastName nvarchar(50) NULL," +
"Firstname nvarchar(50) NULL)";

string spName = DataTestUtility.GetUniqueName("sp_insert",withBracket:false);
string spCreateInsert =
"CREATE PROCEDURE sp_insert" + _tempTable +
$"CREATE PROCEDURE {spName}" +
"(@FirstName nvarchar(50), @LastName nvarchar(50), @id int OUTPUT) " +
"AS INSERT INTO " + _tempTable + " (FirstName, LastName) " +
"VALUES (@FirstName, @LastName); " +
"SELECT @id=@@IDENTITY";

string spDropInsert = "DROP PROCEDURE sp_insert" + _tempTable;
string spDropInsert = $"DROP PROCEDURE {spName}";
bool dropSP = false;

using (SqlDataAdapter adapter = new SqlDataAdapter())
using (SqlConnection conn = new SqlConnection(DataTestUtility.TCPConnectionString))
using (SqlCommand cmd = new SqlCommand(null, conn))
using (SqlCommand temp = new SqlCommand("SELECT id, LastName, FirstName into " + _tempTable + " from ID_" + _tempTable, conn))
using (SqlCommand temp = new SqlCommand("SELECT id, LastName, FirstName into " + _tempTable + $" from {identTableName}", conn))
using (SqlCommand tableClean = new SqlCommand("", conn))
{
ExecuteNonQueryCommand(createIdentTable);
try
{
adapter.InsertCommand = new SqlCommand()
{
CommandText = "sp_insert" + _tempTable,
CommandText = spName,
CommandType = CommandType.StoredProcedure
};
adapter.InsertCommand.Parameters.Add(new SqlParameter("@FirstName", SqlDbType.NVarChar, 50, "FirstName"));
Expand Down Expand Up @@ -853,7 +855,7 @@ public void UpdateRefreshTest()
{
ExecuteNonQueryCommand(spDropInsert);
ExecuteNonQueryCommand("DROP TABLE " + _tempTable);
ExecuteNonQueryCommand("DROP TABLE ID_" + _tempTable);
ExecuteNonQueryCommand("DROP TABLE " + identTableName);
}
}
}
Expand Down Expand Up @@ -1078,15 +1080,16 @@ public void AutoGenUpdateTest()
[ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureSynapse))]
public void AutoGenErrorTest()
{
string identTableName = DataTestUtility.GetUniqueName("ID_");
string createIdentTable =
"CREATE TABLE ID_" + _tempTable + "(id int IDENTITY," +
$"CREATE TABLE {identTableName} (id int IDENTITY," +
"LastName nvarchar(50) NULL," +
"Firstname nvarchar(50) NULL)";

try
{
using (SqlConnection conn = new SqlConnection(DataTestUtility.TCPConnectionString))
using (SqlCommand cmd = new SqlCommand("SELECT * into " + _tempTable + " from ID_" + _tempTable, conn))
using (SqlCommand cmd = new SqlCommand($"SELECT * into {_tempTable} from {identTableName}", conn))
using (SqlDataAdapter adapter = new SqlDataAdapter())
{
ExecuteNonQueryCommand(createIdentTable);
Expand Down Expand Up @@ -1114,7 +1117,7 @@ public void AutoGenErrorTest()
finally
{
ExecuteNonQueryCommand("DROP TABLE " + _tempTable);
ExecuteNonQueryCommand("DROP TABLE ID_" + _tempTable);
ExecuteNonQueryCommand("DROP TABLE " + identTableName);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class Config
public bool IsDNSCachingSupportedTR = false; // this is for the tenant ring
public string EnclaveAzureDatabaseConnString = null;
public string UserManagedIdentityClientId = null;
public string MakecertPath = null;

public static Config Load(string configPath = @"config.json")
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@
"IsDNSCachingSupportedTR": false,
"IsAzureSynapse": false,
"EnclaveAzureDatabaseConnString": "",
"UserManagedIdentityClientId": ""
"UserManagedIdentityClientId": "",
"MakecertPath": ""
}