Skip to content

Commit 5f638d5

Browse files
author
Johnny Pham
authored
[2.1] Changes to run tests on 1es pipelines (#1582)
1 parent a3e82a5 commit 5f638d5

File tree

8 files changed

+138
-77
lines changed

8 files changed

+138
-77
lines changed

BUILDGUIDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ Manual Tests require the below setup to run:
119119
|SupportsFileStream | (Optional) Whether or not FileStream is enabled on SQL Server| `true` OR `false`|
120120
|UseManagedSNIOnWindows | (Optional) Enables testing with Managed SNI on Windows| `true` OR `false`|
121121
|IsAzureSynpase | (Optional) When set to 'true', test suite runs compatible tests for Azure Synapse/Parallel Data Warehouse. | `true` OR `false`|
122+
|MakecertPath | The full path to makecert.exe. This is not required if the path is present in the PATH environment variable. | `D:\\escaped\\absolute\\path\\to\\makecert.exe` |
122123

123124
Commands to run tests:
124125

src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/CspProviderExt.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace Microsoft.Data.SqlClient.ManualTesting.Tests.AlwaysEncrypted
1717
[PlatformSpecific(TestPlatforms.Windows)]
1818
public class CspProviderExt
1919
{
20-
[ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
20+
[ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringSetupForAE))]
2121
[ClassData(typeof(AEConnectionStringProvider))]
2222
public void TestKeysFromCertificatesCreatedWithMultipleCryptoProviders(string connectionString)
2323
{

src/Microsoft.Data.SqlClient/tests/ManualTests/AlwaysEncrypted/TestFixtures/Setup/CertificateUtilityWin.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ internal static void CreateCertificate(string certificateName, string certificat
2525
Assert.False(string.IsNullOrWhiteSpace(certificateName), "FAILED: certificateName should not be null or empty.");
2626
Assert.False(string.IsNullOrWhiteSpace(certificateLocation), "FAILED: certificateLocation should not be null or empty.");
2727

28-
ProcessStartInfo processStartInfo = new ProcessStartInfo(@"makecert");
28+
string makecertPath = string.IsNullOrEmpty(DataTestUtility.MakecertPath) ? "makecert" : DataTestUtility.MakecertPath;
29+
ProcessStartInfo processStartInfo = new ProcessStartInfo(makecertPath);
2930
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",
3031
certificateName,
3132
certificateLocation,

src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public static class DataTestUtility
4848
public static readonly bool IsDNSCachingSupportedCR = false; // this is for the control ring
4949
public static readonly bool IsDNSCachingSupportedTR = false; // this is for the tenant ring
5050
public static readonly string UserManagedIdentityObjectId = null;
51+
public static readonly string MakecertPath = null;
5152

5253
public static readonly string EnclaveAzureDatabaseConnString = null;
5354
public static bool ManagedIdentitySupported = true;
@@ -88,6 +89,7 @@ static DataTestUtility()
8889
IsDNSCachingSupportedTR = c.IsDNSCachingSupportedTR;
8990
EnclaveAzureDatabaseConnString = c.EnclaveAzureDatabaseConnString;
9091
UserManagedIdentityObjectId = c.UserManagedIdentityObjectId;
92+
MakecertPath = c.MakecertPath;
9193

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

@@ -336,12 +338,17 @@ public static bool IsTCPConnectionStringPasswordIncluded()
336338
return RetrieveValueFromConnStr(TCPConnectionString, new string[] { "Password", "PWD" }) != string.Empty;
337339
}
338340

339-
// the name length will be no more then (16 + prefix.Length + escapeLeft.Length + escapeRight.Length)
340-
// some providers does not support names (Oracle supports up to 30)
341-
public static string GetUniqueName(string prefix)
341+
/// <summary>
342+
/// Generate a unique name to use in Sql Server;
343+
/// some providers does not support names (Oracle supports up to 30).
344+
/// </summary>
345+
/// <param name="prefix">The name length will be no more then (16 + prefix.Length + escapeLeft.Length + escapeRight.Length).</param>
346+
/// <param name="withBracket">Name without brackets.</param>
347+
/// <returns>Unique name by considering the Sql Server naming rules.</returns>
348+
public static string GetUniqueName(string prefix, bool withBracket = true)
342349
{
343-
string escapeLeft = "[";
344-
string escapeRight = "]";
350+
string escapeLeft = withBracket ? "[" : string.Empty;
351+
string escapeRight = withBracket ? "]" : string.Empty;
345352
string uniqueName = string.Format("{0}{1}_{2}_{3}{4}",
346353
escapeLeft,
347354
prefix,

0 commit comments

Comments
 (0)