Skip to content

Commit 239ffc6

Browse files
committed
Fixing tests.
1 parent 390d7c6 commit 239ffc6

File tree

7 files changed

+2143
-1188
lines changed

7 files changed

+2143
-1188
lines changed

src/ServiceManagement/Sql/Commands.SqlDatabase.Test/Resources/MockSessions.xml

Lines changed: 2050 additions & 1121 deletions
Large diffs are not rendered by default.

src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/AzureSqlDatabaseCertAuthTests.cs

Lines changed: 70 additions & 55 deletions
Large diffs are not rendered by default.

src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/AzureSqlDatabaseCopyCertAuthTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ public void InitializeTest()
9292
testSession);
9393
}
9494

95-
9695
[TestCleanup]
9796
public void CleanupTest()
9897
{

src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/DatabaseTestHelper.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,22 @@ public static class DatabaseTestHelper
2525
/// The unique GUID for identifying the Shared SLO.
2626
/// </summary>
2727
public static readonly Guid SharedSloGuid = new Guid("910b4fcb-8a29-4c3e-958f-f7ba794388b2");
28-
28+
2929
/// <summary>
3030
/// The unique GUID for identifying the System SLO.
3131
/// </summary>
3232
public static readonly Guid SystemSloGuid = new Guid("26e021db-f1f9-4c98-84c6-92af8ef433d7");
3333

34+
/// <summary>
35+
/// The unique GUID for identifying the System2 SLO.
36+
/// </summary>
37+
public static readonly Guid System2SloGuid = new Guid("620323bf-2879-4807-b30d-c2e6d7b3b3aa");
38+
39+
/// <summary>
40+
/// The unique GUID for identifying the Business SLO.
41+
/// </summary>
42+
public static readonly Guid BusinessSloGuid = new Guid("4518ce8e-6026-4113-b4fd-3b5d777c6881");
43+
3444
/// <summary>
3545
/// The unique GUID for identifying the Basic SLO.
3646
/// </summary>

src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/Database/Cmdlet/NewAzureSqlDatabaseTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ public static void CreateTestDatabasesWithCertAuth(System.Management.Automation.
346346
@"-ServerName $serverName " +
347347
@"-DatabaseName testdb2 " +
348348
@"-Collation Japanese_CI_AS " +
349-
@"-Edition Web " +
349+
@"-Edition Standard " +
350350
@"-MaxSizeGB 5 " +
351351
@"-Force",
352352
@"$testdb2");
@@ -365,15 +365,15 @@ public static void CreateTestDatabasesWithCertAuth(System.Management.Automation.
365365

366366
Services.Server.Database database = database1.Single().BaseObject as Services.Server.Database;
367367
Assert.IsTrue(database != null, "Expecting a Database object");
368-
DatabaseTestHelper.ValidateDatabaseProperties(database, "testdb1", "Web", 1, 1073741824L, "SQL_Latin1_General_CP1_CI_AS", "Shared", false, DatabaseTestHelper.SharedSloGuid);
368+
DatabaseTestHelper.ValidateDatabaseProperties(database, "testdb1", "Standard", 250, 268435456000L, "SQL_Latin1_General_CP1_CI_AS", "S0", false, DatabaseTestHelper.StandardS0SloGuid);
369369

370370
database = database2.Single().BaseObject as Services.Server.Database;
371371
Assert.IsTrue(database != null, "Expecting a Database object");
372-
DatabaseTestHelper.ValidateDatabaseProperties(database, "testdb2", "Web", 5, 5368709120L, "Japanese_CI_AS", "Shared", false, DatabaseTestHelper.SharedSloGuid);
372+
DatabaseTestHelper.ValidateDatabaseProperties(database, "testdb2", "Standard", 250, 268435456000L, "Japanese_CI_AS", "S0", false, DatabaseTestHelper.StandardS0SloGuid);
373373

374374
database = database3.Single().BaseObject as Services.Server.Database;
375375
Assert.IsTrue(database != null, "Expecting a Database object");
376-
DatabaseTestHelper.ValidateDatabaseProperties(database, "testdb3", "Web", 0, 104857600L, "SQL_Latin1_General_CP1_CI_AS", "Shared", false, DatabaseTestHelper.SharedSloGuid);
376+
DatabaseTestHelper.ValidateDatabaseProperties(database, "testdb3", "Standard", 0, 104857600L, "SQL_Latin1_General_CP1_CI_AS", "S0", false, DatabaseTestHelper.StandardS0SloGuid);
377377
}
378378
}
379379

src/ServiceManagement/Sql/Commands.SqlDatabase.Test/UnitTests/UnitTestHelper.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,13 @@ public static AzureSubscription SetupUnitTestSubscription(System.Management.Auto
290290
{
291291
UnitTestHelper.ImportAzureModule(powershell);
292292

293+
X509Certificate2 certificate = UnitTestHelper.GetUnitTestClientCertificate();
294+
Guid subscriptionId = new Guid(UnitTestSubscriptionId);
295+
293296
// Set the client certificate used in the subscription
294297
powershell.Runspace.SessionStateProxy.SetVariable(
295298
"clientCertificate",
296-
UnitTestHelper.GetUnitTestClientCertificate());
299+
certificate);
297300

298301
ProfileClient client = new ProfileClient();
299302
client.Profile.Environments[UnitTestEnvironmentName] = new AzureEnvironment
@@ -308,13 +311,13 @@ public static AzureSubscription SetupUnitTestSubscription(System.Management.Auto
308311

309312
var account = new AzureAccount
310313
{
311-
Id = UnitTestHelper.GetUnitTestClientCertificate().Thumbprint,
314+
Id = certificate.Thumbprint,
312315
Type = AzureAccount.AccountType.Certificate
313316
};
314317

315318
var subscription = new AzureSubscription
316319
{
317-
Id = new Guid(UnitTestSubscriptionId),
320+
Id = subscriptionId,
318321
Name = UnitTestSubscriptionName,
319322
Environment = UnitTestEnvironmentName,
320323
Account = account.Id
@@ -324,7 +327,7 @@ public static AzureSubscription SetupUnitTestSubscription(System.Management.Auto
324327
client.AddOrSetSubscription(subscription);
325328
client.SetSubscriptionAsCurrent(UnitTestSubscriptionName, account.Id);
326329
client.Profile.Save();
327-
330+
328331
return subscription;
329332
}
330333

src/ServiceManagement/Sql/Commands.SqlDatabase/Services/Server/ServerDataServiceCertAuth.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,7 @@ private void PopulateSloCache()
351351
this.AddTracingHeaders(sqlManagementClient);
352352

353353
// Retrieve the specified database
354-
ServiceObjectiveListResponse response = sqlManagementClient.ServiceObjectives.List(
355-
this.serverName);
354+
ServiceObjectiveListResponse response = sqlManagementClient.ServiceObjectives.List(this.serverName);
356355

357356
// Populate the cache;
358357
objectivesCache = response.Select(serviceObjective => CreateServiceObjectiveFromResponse(serviceObjective)).ToArray();

0 commit comments

Comments
 (0)