Skip to content

Commit 58fc58c

Browse files
committed
Test SetAzureDeployment
1 parent 06f3e6a commit 58fc58c

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,8 @@ public void AzureDeploymentTest()
559559
pass = Utilities.PrintAndCompareDeployment(result, serviceName, deploymentName, deploymentLabel, DeploymentSlotType.Staging, null, 1);
560560
Console.WriteLine("successfully deployed the package");
561561

562+
ExtensionContext extResult0 = vmPowershellCmdlets.GetAzureServiceExtension(serviceName, DeploymentSlotType.Staging)[0];
563+
Utilities.PrintContext(extResult0);
562564

563565
// Move the deployment from 'Staging' to 'Production'
564566
Utilities.RetryActionUntilSuccess(() =>
@@ -569,6 +571,11 @@ public void AzureDeploymentTest()
569571
pass &= Utilities.PrintAndCompareDeployment(result, serviceName, deploymentName, deploymentLabel, DeploymentSlotType.Production, null, 1);
570572
Console.WriteLine("successfully moved");
571573

574+
ExtensionContext extResult1 = vmPowershellCmdlets.GetAzureServiceExtension(serviceName, DeploymentSlotType.Production)[0];
575+
Utilities.PrintContext(extResult1);
576+
577+
Assert.IsTrue(string.Equals(extResult0.Id, extResult1.Id));
578+
572579
// Re-create the Staging depoyment with the extension
573580
Utilities.RetryActionUntilSuccess(() =>
574581
{
@@ -579,6 +586,23 @@ public void AzureDeploymentTest()
579586
pass = Utilities.PrintAndCompareDeployment(result, serviceName, deploymentName, deploymentLabel, DeploymentSlotType.Staging, null, 1);
580587
Console.WriteLine(string.Format("Successfully re-deployed the package to the {0} slot.", DeploymentSlotType.Staging));
581588

589+
ExtensionContext extResult2 = vmPowershellCmdlets.GetAzureServiceExtension(serviceName, DeploymentSlotType.Staging)[0];
590+
Utilities.PrintContext(extResult2);
591+
592+
// Update the deployment with the extension
593+
Utilities.RetryActionUntilSuccess(() =>
594+
{
595+
vmPowershellCmdlets.SetAzureDeploymentConfig(serviceName, DeploymentSlotType.Staging, configPath2.FullName, rdpExtCfg);
596+
}, "The server encountered an internal error. Please retry the request.", 10, 30);
597+
result = vmPowershellCmdlets.GetAzureDeployment(serviceName, DeploymentSlotType.Staging);
598+
pass &= Utilities.PrintAndCompareDeployment(result, serviceName, deploymentName, deploymentLabel, DeploymentSlotType.Production, null, 2);
599+
Console.WriteLine("successfully updated the deployment");
600+
601+
ExtensionContext extResult3 = vmPowershellCmdlets.GetAzureServiceExtension(serviceName, DeploymentSlotType.Staging)[0];
602+
Utilities.PrintContext(extResult3);
603+
604+
Assert.IsTrue(!string.Equals(extResult2.Id, extResult3.Id));
605+
582606
// Set the deployment status to 'Suspended'
583607
Utilities.RetryActionUntilSuccess(() =>
584608
{

src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/IaasCmdletInfo/SetAzureDeploymentCmdletInfo.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions;
1516
using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.PowershellCore;
1617

1718
namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.IaasCmdletInfo
@@ -38,12 +39,13 @@ public static SetAzureDeploymentCmdletInfo SetAzureDeploymentStatusCmdletInfo(st
3839
}
3940

4041

41-
public static SetAzureDeploymentCmdletInfo SetAzureDeploymentConfigCmdletInfo(string serviceName, string slot, string configPath)
42+
public static SetAzureDeploymentCmdletInfo SetAzureDeploymentConfigCmdletInfo(string serviceName, string slot, string configPath, ExtensionConfigurationInput extConfig = null)
4243
{
4344
SetAzureDeploymentCmdletInfo result = new SetAzureDeploymentCmdletInfo(serviceName, slot);
4445

4546
result.cmdletParams.Add(new CmdletParam("Config"));
4647
result.cmdletParams.Add(new CmdletParam("Configuration", configPath));
48+
result.cmdletParams.Add(new CmdletParam("ExtensionConfiguration", extConfig));
4749

4850
return result;
4951
}

src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,9 +454,9 @@ public ManagementOperationContext SetAzureDeploymentStatus(string serviceName, s
454454
return SetAzureDeployment(SetAzureDeploymentCmdletInfo.SetAzureDeploymentStatusCmdletInfo(serviceName, slot, newStatus));
455455
}
456456

457-
public ManagementOperationContext SetAzureDeploymentConfig(string serviceName, string slot, string configPath)
457+
public ManagementOperationContext SetAzureDeploymentConfig(string serviceName, string slot, string configPath, ExtensionConfigurationInput extConfig = null)
458458
{
459-
return SetAzureDeployment(SetAzureDeploymentCmdletInfo.SetAzureDeploymentConfigCmdletInfo(serviceName, slot, configPath));
459+
return SetAzureDeployment(SetAzureDeploymentCmdletInfo.SetAzureDeploymentConfigCmdletInfo(serviceName, slot, configPath, extConfig));
460460
}
461461

462462
public ManagementOperationContext SetAzureDeploymentUpgrade(string serviceName, string slot, string mode, string packagePath, string configPath)

0 commit comments

Comments
 (0)