From f7864d1fc2ea22bfc263f0e5556ed431af35738e Mon Sep 17 00:00:00 2001 From: huangpf Date: Thu, 4 Jun 2015 15:02:10 -0700 Subject: [PATCH 01/12] Fix InstallExtension for Set/New-AzureDeployment cmdlets --- .../SetAzureServiceADDomainExtension.cs | 2 +- .../Common/BaseAzureServiceExtensionCmdlet.cs | 12 +++++++++++ .../Extensions/Common/ExtensionManager.cs | 10 +++++----- .../Common/SetAzureServiceExtension.cs | 2 +- .../RemoveAzureServiceAntimalwareExtension.cs | 2 +- .../SetAzureServiceAntimalwareExtension.cs | 2 +- .../SetAzureServiceRemoteDesktopExtension.cs | 2 +- .../HostedServices/NewAzureDeployment.cs | 20 ++++++++++++------- .../HostedServices/SetAzureDeployment.cs | 19 ++++++++++++------ 9 files changed, 48 insertions(+), 23 deletions(-) diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/ADDomain/SetAzureServiceADDomainExtension.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/ADDomain/SetAzureServiceADDomainExtension.cs index 84e31ad1140b..9ab48953b43a 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/ADDomain/SetAzureServiceADDomainExtension.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/ADDomain/SetAzureServiceADDomainExtension.cs @@ -238,7 +238,7 @@ public void ExecuteCommand() Roles = new ExtensionRoleList(Role != null && Role.Any() ? Role.Select(r => new ExtensionRole(r)) : Enumerable.Repeat(new ExtensionRole(), 1)) }; - var extConfig = ExtensionManager.InstallExtension(context, Slot, Deployment.ExtensionConfiguration); + var extConfig = ExtensionManager.InstallExtension(context, Slot, Deployment.ExtensionConfiguration, PeerDeployment.ExtensionConfiguration); ChangeDeployment(extConfig); } diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/Common/BaseAzureServiceExtensionCmdlet.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/Common/BaseAzureServiceExtensionCmdlet.cs index a24bfa9c41d6..8c5fa36ebeb3 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/Common/BaseAzureServiceExtensionCmdlet.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/Common/BaseAzureServiceExtensionCmdlet.cs @@ -50,6 +50,7 @@ public abstract class BaseAzureServiceExtensionCmdlet : ServiceManagementBaseCmd protected XDocument PublicConfigurationXml { get; set; } protected XDocument PrivateConfigurationXml { get; set; } protected DeploymentGetResponse Deployment { get; set; } + protected DeploymentGetResponse PeerDeployment { get; set; } public virtual string ServiceName { get; set; } public virtual string Slot { get; set; } @@ -109,6 +110,8 @@ protected void ValidateDeployment() } Deployment.ExtensionConfiguration = Deployment.ExtensionConfiguration ?? new Microsoft.WindowsAzure.Management.Compute.Models.ExtensionConfiguration(); } + + PeerDeployment = GetPeerDeployment(Slot); } protected void ValidateRoles() @@ -285,6 +288,15 @@ protected DeploymentGetResponse GetDeployment(string slot) return d; } + protected DeploymentGetResponse GetPeerDeployment(string currentSlot) + { + var currentSlotType = (DeploymentSlot)Enum.Parse(typeof(DeploymentSlot), currentSlot, true); + var peerSlot = currentSlotType == DeploymentSlot.Production ? DeploymentSlot.Staging : DeploymentSlot.Production; + var peerSlotStr = peerSlot.ToString(); + + return GetDeployment(peerSlotStr); + } + protected SecureString GetSecurePassword(string password) { SecureString securePassword = new SecureString(); diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/Common/ExtensionManager.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/Common/ExtensionManager.cs index 2a4d98eff417..350e13d9712d 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/Common/ExtensionManager.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/Common/ExtensionManager.cs @@ -147,7 +147,7 @@ private void GetThumbprintAndAlgorithm(IList new ExtensionRole(r)) : Enumerable.Repeat(new ExtensionRole(), 1)) }; - var extConfig = ExtensionManager.InstallExtension(context, Slot, Deployment.ExtensionConfiguration); + var extConfig = ExtensionManager.InstallExtension(context, Slot, Deployment.ExtensionConfiguration, PeerDeployment.ExtensionConfiguration); ChangeDeployment(extConfig); } diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/MicrosoftAntimalware/RemoveAzureServiceAntimalwareExtension.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/MicrosoftAntimalware/RemoveAzureServiceAntimalwareExtension.cs index bfbf480dfdf7..6a6e60182b97 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/MicrosoftAntimalware/RemoveAzureServiceAntimalwareExtension.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/MicrosoftAntimalware/RemoveAzureServiceAntimalwareExtension.cs @@ -81,7 +81,7 @@ public void ExecuteCommand() // process any pending deployment changes if (extConfigInputs != null) { - ExtensionConfiguration newExtConfig = ExtensionManager.Add(Deployment, extConfigInputs, Slot); + ExtensionConfiguration newExtConfig = ExtensionManager.Add(Deployment, PeerDeployment, extConfigInputs, Slot); ChangeDeployment(newExtConfig); } } diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/MicrosoftAntimalware/SetAzureServiceAntimalwareExtension.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/MicrosoftAntimalware/SetAzureServiceAntimalwareExtension.cs index 15c4c996695a..8f17331a15bd 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/MicrosoftAntimalware/SetAzureServiceAntimalwareExtension.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/MicrosoftAntimalware/SetAzureServiceAntimalwareExtension.cs @@ -444,7 +444,7 @@ public void ExecuteCommand() // process any pending deployment changes if (extConfigInputs != null) { - ExtensionConfiguration newExtConfig = ExtensionManager.Add(Deployment, extConfigInputs, Slot); + ExtensionConfiguration newExtConfig = ExtensionManager.Add(Deployment, PeerDeployment, extConfigInputs, Slot); ChangeDeployment(newExtConfig); } } diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/RDP/SetAzureServiceRemoteDesktopExtension.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/RDP/SetAzureServiceRemoteDesktopExtension.cs index 36ac0f8a9e85..6e01f6e32ffe 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/RDP/SetAzureServiceRemoteDesktopExtension.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/RDP/SetAzureServiceRemoteDesktopExtension.cs @@ -132,7 +132,7 @@ public void ExecuteCommand() Version = Version, Roles = new ExtensionRoleList(Role != null && Role.Any() ? Role.Select(r => new ExtensionRole(r)) : Enumerable.Repeat(new ExtensionRole(), 1)) }; - var extConfig = ExtensionManager.InstallExtension(context, Slot, Deployment.ExtensionConfiguration); + var extConfig = ExtensionManager.InstallExtension(context, Slot, Deployment.ExtensionConfiguration, PeerDeployment.ExtensionConfiguration); ChangeDeployment(extConfig); } diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/NewAzureDeployment.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/NewAzureDeployment.cs index 3d168eb176dd..e82b8f74fbaf 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/NewAzureDeployment.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/NewAzureDeployment.cs @@ -159,14 +159,12 @@ public virtual void NewPaaSDeploymentProcess() } } - - var slotType = (DeploymentSlot)Enum.Parse(typeof(DeploymentSlot), this.Slot, true); - DeploymentGetResponse d = null; - InvokeInOperationContext(() => + Action func = (t, d) => { + d = null; try { - d = this.ComputeClient.Deployments.GetBySlot(this.ServiceName, slotType); + d = this.ComputeClient.Deployments.GetBySlot(this.ServiceName, t); } catch (CloudException ex) { @@ -175,10 +173,18 @@ public virtual void NewPaaSDeploymentProcess() this.WriteExceptionDetails(ex); } } - }); + }; + + var slotType = (DeploymentSlot)Enum.Parse(typeof(DeploymentSlot), this.Slot, true); + DeploymentGetResponse currentDeployment = null; + InvokeInOperationContext(() => func(slotType, currentDeployment)); + + var peerSlottype = slotType == DeploymentSlot.Production ? DeploymentSlot.Staging : DeploymentSlot.Production; + DeploymentGetResponse peerDeployment = null; + InvokeInOperationContext(() => func(slotType, peerDeployment)); ExtensionManager extensionMgr = new ExtensionManager(this, ServiceName); - extConfig = extensionMgr.Set(d, ExtensionConfiguration, this.Slot); + extConfig = extensionMgr.Set(currentDeployment, peerDeployment, ExtensionConfiguration, this.Slot); } var deploymentInput = new DeploymentCreateParameters diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/SetAzureDeployment.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/SetAzureDeployment.cs index 7d34c6d4dee8..293341b9dbca 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/SetAzureDeployment.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/SetAzureDeployment.cs @@ -164,13 +164,12 @@ public void ExecuteCommand() } } - var slotType = (DeploymentSlot)Enum.Parse(typeof(DeploymentSlot), this.Slot, true); - DeploymentGetResponse d = null; - InvokeInOperationContext(() => + Action func = (t, d) => { + d = null; try { - d = this.ComputeClient.Deployments.GetBySlot(this.ServiceName, slotType); + d = this.ComputeClient.Deployments.GetBySlot(this.ServiceName, t); } catch (CloudException ex) { @@ -179,10 +178,18 @@ public void ExecuteCommand() this.WriteExceptionDetails(ex); } } - }); + }; + + var slotType = (DeploymentSlot)Enum.Parse(typeof(DeploymentSlot), this.Slot, true); + DeploymentGetResponse currentDeployment = null; + InvokeInOperationContext(() => func(slotType, currentDeployment)); + + var peerSlottype = slotType == DeploymentSlot.Production ? DeploymentSlot.Staging : DeploymentSlot.Production; + DeploymentGetResponse peerDeployment = null; + InvokeInOperationContext(() => func(slotType, peerDeployment)); ExtensionManager extensionMgr = new ExtensionManager(this, ServiceName); - extConfig = extensionMgr.Add(d, ExtensionConfiguration, this.Slot); + extConfig = extensionMgr.Add(currentDeployment, peerDeployment, ExtensionConfiguration, this.Slot); } // Upgrade Parameter Set From ed4a82f0c55ce15dc258052413e8efb6de37b43a Mon Sep 17 00:00:00 2001 From: huangpf Date: Thu, 4 Jun 2015 15:41:31 -0700 Subject: [PATCH 02/12] +Test --- .../FunctionalTests/FunctionalTest.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs index c70998bd8e6d..35f364cdbb8c 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs @@ -542,6 +542,9 @@ public void AzureDeploymentTest() string deploymentLabel = "label1"; DeploymentInfoContext result; + PSCredential cred = new PSCredential(username, Utilities.convertToSecureString(password)); + ExtensionConfigurationInput rdpExtCfg = vmPowershellCmdlets.NewAzureServiceRemoteDesktopExtensionConfig(cred); + try { vmPowershellCmdlets.NewAzureService(serviceName, serviceName, locationName); @@ -549,7 +552,7 @@ public void AzureDeploymentTest() Utilities.RetryActionUntilSuccess(() => { - vmPowershellCmdlets.NewAzureDeployment(serviceName, packagePath1.FullName, configPath1.FullName, DeploymentSlotType.Staging, deploymentLabel, deploymentName, false, false); + vmPowershellCmdlets.NewAzureDeployment(serviceName, packagePath1.FullName, configPath1.FullName, DeploymentSlotType.Staging, deploymentLabel, deploymentName, false, false, rdpExtCfg); }, "Windows Azure is currently performing an operation on this hosted service that requires exclusive access.", 10, 30); result = vmPowershellCmdlets.GetAzureDeployment(serviceName, DeploymentSlotType.Staging); @@ -566,6 +569,16 @@ public void AzureDeploymentTest() pass &= Utilities.PrintAndCompareDeployment(result, serviceName, deploymentName, deploymentLabel, DeploymentSlotType.Production, null, 1); Console.WriteLine("successfully moved"); + // Re-create the Staging depoyment with the extension + Utilities.RetryActionUntilSuccess(() => + { + vmPowershellCmdlets.NewAzureDeployment(serviceName, packagePath1.FullName, configPath1.FullName, DeploymentSlotType.Staging, deploymentLabel, deploymentName, false, false, rdpExtCfg); + }, "Windows Azure is currently performing an operation on this hosted service that requires exclusive access.", 10, 30); + + result = vmPowershellCmdlets.GetAzureDeployment(serviceName, DeploymentSlotType.Staging); + pass = Utilities.PrintAndCompareDeployment(result, serviceName, deploymentName, deploymentLabel, DeploymentSlotType.Staging, null, 1); + Console.WriteLine(string.Format("Successfully re-deployed the package to the {0} slot.", DeploymentSlotType.Staging)); + // Set the deployment status to 'Suspended' Utilities.RetryActionUntilSuccess(() => { From bd515adc137c3fdadc7cd9e029195cecdd33207c Mon Sep 17 00:00:00 2001 From: huangpf Date: Thu, 4 Jun 2015 16:21:56 -0700 Subject: [PATCH 03/12] fix --- .../Extensions/Common/ExtensionManager.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/Common/ExtensionManager.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/Common/ExtensionManager.cs index 350e13d9712d..5301543f405a 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/Common/ExtensionManager.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/Extensions/Common/ExtensionManager.cs @@ -262,13 +262,14 @@ public Microsoft.WindowsAzure.Management.Compute.Models.ExtensionConfiguration S } var oldExtConfig = currentDeployment != null ? currentDeployment.ExtensionConfiguration : new ExtensionConfiguration(); + var oldPeerExtConfig = peerDeployment != null ? peerDeployment.ExtensionConfiguration : new ExtensionConfiguration(); ExtensionConfigurationBuilder configBuilder = this.GetBuilder(); foreach (ExtensionConfigurationInput context in inputs) { if (context != null) { - Microsoft.WindowsAzure.Management.Compute.Models.ExtensionConfiguration currentConfig = this.InstallExtension(context, slot, oldExtConfig, peerDeployment.ExtensionConfiguration); + Microsoft.WindowsAzure.Management.Compute.Models.ExtensionConfiguration currentConfig = this.InstallExtension(context, slot, oldExtConfig, oldPeerExtConfig); foreach (var r in currentConfig.AllRoles) { if (currentDeployment == null || !this.GetBuilder(currentDeployment.ExtensionConfiguration).ExistAny(r.Id)) @@ -303,13 +304,14 @@ public Microsoft.WindowsAzure.Management.Compute.Models.ExtensionConfiguration A } var oldExtConfig = deployment.ExtensionConfiguration; + var oldPeerExtConfig = peerDeployment.ExtensionConfiguration; ExtensionConfigurationBuilder configBuilder = this.GetBuilder(); foreach (ExtensionConfigurationInput context in inputs) { if (context != null) { - Microsoft.WindowsAzure.Management.Compute.Models.ExtensionConfiguration currentConfig = this.InstallExtension(context, slot, oldExtConfig, peerDeployment.ExtensionConfiguration); + Microsoft.WindowsAzure.Management.Compute.Models.ExtensionConfiguration currentConfig = this.InstallExtension(context, slot, oldExtConfig, oldPeerExtConfig); foreach (var r in currentConfig.AllRoles) { if (!this.GetBuilder(oldExtConfig).ExistAny(r.Id)) From 06f3e6a0da57350e0e987bd40a357d657b51a761 Mon Sep 17 00:00:00 2001 From: huangpf Date: Thu, 4 Jun 2015 17:58:04 -0700 Subject: [PATCH 04/12] Fix Deployment Get Func --- .../HostedServices/NewAzureDeployment.cs | 10 ++++++---- .../HostedServices/SetAzureDeployment.cs | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/NewAzureDeployment.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/NewAzureDeployment.cs index e82b8f74fbaf..8a3990f92697 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/NewAzureDeployment.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/NewAzureDeployment.cs @@ -159,9 +159,9 @@ public virtual void NewPaaSDeploymentProcess() } } - Action func = (t, d) => + Func func = t => { - d = null; + DeploymentGetResponse d = null; try { d = this.ComputeClient.Deployments.GetBySlot(this.ServiceName, t); @@ -173,15 +173,17 @@ public virtual void NewPaaSDeploymentProcess() this.WriteExceptionDetails(ex); } } + + return d; }; var slotType = (DeploymentSlot)Enum.Parse(typeof(DeploymentSlot), this.Slot, true); DeploymentGetResponse currentDeployment = null; - InvokeInOperationContext(() => func(slotType, currentDeployment)); + InvokeInOperationContext(() => currentDeployment = func(slotType)); var peerSlottype = slotType == DeploymentSlot.Production ? DeploymentSlot.Staging : DeploymentSlot.Production; DeploymentGetResponse peerDeployment = null; - InvokeInOperationContext(() => func(slotType, peerDeployment)); + InvokeInOperationContext(() => peerDeployment = func(peerSlottype)); ExtensionManager extensionMgr = new ExtensionManager(this, ServiceName); extConfig = extensionMgr.Set(currentDeployment, peerDeployment, ExtensionConfiguration, this.Slot); diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/SetAzureDeployment.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/SetAzureDeployment.cs index 293341b9dbca..54655bc57ea4 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/SetAzureDeployment.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/HostedServices/SetAzureDeployment.cs @@ -164,9 +164,9 @@ public void ExecuteCommand() } } - Action func = (t, d) => + Func func = t => { - d = null; + DeploymentGetResponse d = null; try { d = this.ComputeClient.Deployments.GetBySlot(this.ServiceName, t); @@ -178,15 +178,17 @@ public void ExecuteCommand() this.WriteExceptionDetails(ex); } } + + return d; }; var slotType = (DeploymentSlot)Enum.Parse(typeof(DeploymentSlot), this.Slot, true); DeploymentGetResponse currentDeployment = null; - InvokeInOperationContext(() => func(slotType, currentDeployment)); + InvokeInOperationContext(() => currentDeployment = func(slotType)); var peerSlottype = slotType == DeploymentSlot.Production ? DeploymentSlot.Staging : DeploymentSlot.Production; DeploymentGetResponse peerDeployment = null; - InvokeInOperationContext(() => func(slotType, peerDeployment)); + InvokeInOperationContext(() => peerDeployment = func(peerSlottype)); ExtensionManager extensionMgr = new ExtensionManager(this, ServiceName); extConfig = extensionMgr.Add(currentDeployment, peerDeployment, ExtensionConfiguration, this.Slot); From 58fc58cf09e9f5b1583c14b706b446f7fa0d41b6 Mon Sep 17 00:00:00 2001 From: huangpf Date: Thu, 4 Jun 2015 18:52:30 -0700 Subject: [PATCH 05/12] Test SetAzureDeployment --- .../FunctionalTests/FunctionalTest.cs | 24 +++++++++++++++++++ .../SetAzureDeploymentCmdletInfo.cs | 4 +++- .../ServiceManagementCmdletTestHelper.cs | 4 ++-- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs index 35f364cdbb8c..34c9fd15a469 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs @@ -559,6 +559,8 @@ public void AzureDeploymentTest() pass = Utilities.PrintAndCompareDeployment(result, serviceName, deploymentName, deploymentLabel, DeploymentSlotType.Staging, null, 1); Console.WriteLine("successfully deployed the package"); + ExtensionContext extResult0 = vmPowershellCmdlets.GetAzureServiceExtension(serviceName, DeploymentSlotType.Staging)[0]; + Utilities.PrintContext(extResult0); // Move the deployment from 'Staging' to 'Production' Utilities.RetryActionUntilSuccess(() => @@ -569,6 +571,11 @@ public void AzureDeploymentTest() pass &= Utilities.PrintAndCompareDeployment(result, serviceName, deploymentName, deploymentLabel, DeploymentSlotType.Production, null, 1); Console.WriteLine("successfully moved"); + ExtensionContext extResult1 = vmPowershellCmdlets.GetAzureServiceExtension(serviceName, DeploymentSlotType.Production)[0]; + Utilities.PrintContext(extResult1); + + Assert.IsTrue(string.Equals(extResult0.Id, extResult1.Id)); + // Re-create the Staging depoyment with the extension Utilities.RetryActionUntilSuccess(() => { @@ -579,6 +586,23 @@ public void AzureDeploymentTest() pass = Utilities.PrintAndCompareDeployment(result, serviceName, deploymentName, deploymentLabel, DeploymentSlotType.Staging, null, 1); Console.WriteLine(string.Format("Successfully re-deployed the package to the {0} slot.", DeploymentSlotType.Staging)); + ExtensionContext extResult2 = vmPowershellCmdlets.GetAzureServiceExtension(serviceName, DeploymentSlotType.Staging)[0]; + Utilities.PrintContext(extResult2); + + // Update the deployment with the extension + Utilities.RetryActionUntilSuccess(() => + { + vmPowershellCmdlets.SetAzureDeploymentConfig(serviceName, DeploymentSlotType.Staging, configPath2.FullName, rdpExtCfg); + }, "The server encountered an internal error. Please retry the request.", 10, 30); + result = vmPowershellCmdlets.GetAzureDeployment(serviceName, DeploymentSlotType.Staging); + pass &= Utilities.PrintAndCompareDeployment(result, serviceName, deploymentName, deploymentLabel, DeploymentSlotType.Production, null, 2); + Console.WriteLine("successfully updated the deployment"); + + ExtensionContext extResult3 = vmPowershellCmdlets.GetAzureServiceExtension(serviceName, DeploymentSlotType.Staging)[0]; + Utilities.PrintContext(extResult3); + + Assert.IsTrue(!string.Equals(extResult2.Id, extResult3.Id)); + // Set the deployment status to 'Suspended' Utilities.RetryActionUntilSuccess(() => { diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/IaasCmdletInfo/SetAzureDeploymentCmdletInfo.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/IaasCmdletInfo/SetAzureDeploymentCmdletInfo.cs index 73e71a6fb535..b504f95c4f60 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/IaasCmdletInfo/SetAzureDeploymentCmdletInfo.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/IaasCmdletInfo/SetAzureDeploymentCmdletInfo.cs @@ -12,6 +12,7 @@ // limitations under the License. // ---------------------------------------------------------------------------------- +using Microsoft.WindowsAzure.Commands.ServiceManagement.Extensions; using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.PowershellCore; namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.IaasCmdletInfo @@ -38,12 +39,13 @@ public static SetAzureDeploymentCmdletInfo SetAzureDeploymentStatusCmdletInfo(st } - public static SetAzureDeploymentCmdletInfo SetAzureDeploymentConfigCmdletInfo(string serviceName, string slot, string configPath) + public static SetAzureDeploymentCmdletInfo SetAzureDeploymentConfigCmdletInfo(string serviceName, string slot, string configPath, ExtensionConfigurationInput extConfig = null) { SetAzureDeploymentCmdletInfo result = new SetAzureDeploymentCmdletInfo(serviceName, slot); result.cmdletParams.Add(new CmdletParam("Config")); result.cmdletParams.Add(new CmdletParam("Configuration", configPath)); + result.cmdletParams.Add(new CmdletParam("ExtensionConfiguration", extConfig)); return result; } diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs index 75537a22ab2d..67749028f22d 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs @@ -454,9 +454,9 @@ public ManagementOperationContext SetAzureDeploymentStatus(string serviceName, s return SetAzureDeployment(SetAzureDeploymentCmdletInfo.SetAzureDeploymentStatusCmdletInfo(serviceName, slot, newStatus)); } - public ManagementOperationContext SetAzureDeploymentConfig(string serviceName, string slot, string configPath) + public ManagementOperationContext SetAzureDeploymentConfig(string serviceName, string slot, string configPath, ExtensionConfigurationInput extConfig = null) { - return SetAzureDeployment(SetAzureDeploymentCmdletInfo.SetAzureDeploymentConfigCmdletInfo(serviceName, slot, configPath)); + return SetAzureDeployment(SetAzureDeploymentCmdletInfo.SetAzureDeploymentConfigCmdletInfo(serviceName, slot, configPath, extConfig)); } public ManagementOperationContext SetAzureDeploymentUpgrade(string serviceName, string slot, string mode, string packagePath, string configPath) From 9df5168d3b96df46eb20e4a339e1846a26b1f49a Mon Sep 17 00:00:00 2001 From: huangpf Date: Thu, 4 Jun 2015 21:10:55 -0700 Subject: [PATCH 06/12] [Test] Check the original deployment has been moved away. --- .../FunctionalTests/FunctionalTest.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs index 34c9fd15a469..e64898d592a3 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs @@ -569,13 +569,29 @@ public void AzureDeploymentTest() }, "The server encountered an internal error. Please retry the request.", 10, 30); result = vmPowershellCmdlets.GetAzureDeployment(serviceName, DeploymentSlotType.Production); pass &= Utilities.PrintAndCompareDeployment(result, serviceName, deploymentName, deploymentLabel, DeploymentSlotType.Production, null, 1); - Console.WriteLine("successfully moved"); + Console.WriteLine("successfully moved."); ExtensionContext extResult1 = vmPowershellCmdlets.GetAzureServiceExtension(serviceName, DeploymentSlotType.Production)[0]; Utilities.PrintContext(extResult1); Assert.IsTrue(string.Equals(extResult0.Id, extResult1.Id)); + // Check until the deployment moving is done, and the staging slot is empty. + Utilities.RetryActionUntilSuccess(() => + { + try + { + result = vmPowershellCmdlets.GetAzureDeployment(serviceName, DeploymentSlotType.Staging); + Assert.IsNull(result); + } + catch (Exception e) + { + const string errorMessage = "No deployments were found."; + Assert.IsTrue(e.ToString().Contains(errorMessage) || (e.InnerException != null && e.InnerException.ToString().Contains(errorMessage))); + } + }, "Assert", 10, 60); + Console.WriteLine("successfully checked original deployment has been moved away."); + // Re-create the Staging depoyment with the extension Utilities.RetryActionUntilSuccess(() => { From d51ddb6abdd511f7c9c3bc2a85f42951a2d50405 Mon Sep 17 00:00:00 2001 From: huangpf Date: Thu, 4 Jun 2015 21:36:43 -0700 Subject: [PATCH 07/12] Always copy the package csv files. --- .../Commands.ServiceManagement.Test.csproj | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/Commands.ServiceManagement.Test.csproj b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/Commands.ServiceManagement.Test.csproj index cfeb5f86de9f..64cbbcfd9f17 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/Commands.ServiceManagement.Test.csproj +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/Commands.ServiceManagement.Test.csproj @@ -441,11 +441,15 @@ - + + Always + - + + Always + From 376bdddd191d1de6953eb9da42be6cc5d2363016 Mon Sep 17 00:00:00 2001 From: huangpf Date: Thu, 4 Jun 2015 21:51:18 -0700 Subject: [PATCH 08/12] Fix Test --- .../FunctionalTests/FunctionalTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs index e64898d592a3..48e8c705d8ce 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs @@ -611,7 +611,7 @@ public void AzureDeploymentTest() vmPowershellCmdlets.SetAzureDeploymentConfig(serviceName, DeploymentSlotType.Staging, configPath2.FullName, rdpExtCfg); }, "The server encountered an internal error. Please retry the request.", 10, 30); result = vmPowershellCmdlets.GetAzureDeployment(serviceName, DeploymentSlotType.Staging); - pass &= Utilities.PrintAndCompareDeployment(result, serviceName, deploymentName, deploymentLabel, DeploymentSlotType.Production, null, 2); + pass &= Utilities.PrintAndCompareDeployment(result, serviceName, deploymentName, deploymentLabel, DeploymentSlotType.Staging, null, 2); Console.WriteLine("successfully updated the deployment"); ExtensionContext extResult3 = vmPowershellCmdlets.GetAzureServiceExtension(serviceName, DeploymentSlotType.Staging)[0]; From 1b3a72acb63ec27551d24479a20209fd8793c5c6 Mon Sep 17 00:00:00 2001 From: huangpf Date: Thu, 4 Jun 2015 23:39:48 -0700 Subject: [PATCH 09/12] Update Test --- .../Commands.ServiceManagement.Test.csproj | 138 +++++++++++++----- .../FunctionalTests/FunctionalTest.cs | 2 +- 2 files changed, 103 insertions(+), 37 deletions(-) diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/Commands.ServiceManagement.Test.csproj b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/Commands.ServiceManagement.Test.csproj index 64cbbcfd9f17..de9af6bad097 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/Commands.ServiceManagement.Test.csproj +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/Commands.ServiceManagement.Test.csproj @@ -423,68 +423,134 @@ - PreserveNewest + Always - PreserveNewest + Always - - + + Always + + + Always + Always Always - + + Always + - + + Always + Always - - - + + Always + + + Always + + + Always + Always - - - - - - - - - - - - - - - + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + - - - - - + + Always + + + Always + + + Always + + + Always + + + Always + - PreserveNewest + Always + + + Always - - - - - - + + Always + + + Always + + + Always + + + Always + + + Always + diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs index 48e8c705d8ce..b7928ed7d81e 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs @@ -596,7 +596,7 @@ public void AzureDeploymentTest() Utilities.RetryActionUntilSuccess(() => { vmPowershellCmdlets.NewAzureDeployment(serviceName, packagePath1.FullName, configPath1.FullName, DeploymentSlotType.Staging, deploymentLabel, deploymentName, false, false, rdpExtCfg); - }, "Windows Azure is currently performing an operation on this hosted service that requires exclusive access.", 10, 30); + }, "already exists under service", 10, 60); result = vmPowershellCmdlets.GetAzureDeployment(serviceName, DeploymentSlotType.Staging); pass = Utilities.PrintAndCompareDeployment(result, serviceName, deploymentName, deploymentLabel, DeploymentSlotType.Staging, null, 1); From 11a93efa6e3e4cbd839f555b8ca064443cf21d78 Mon Sep 17 00:00:00 2001 From: huangpf Date: Fri, 5 Jun 2015 00:27:19 -0700 Subject: [PATCH 10/12] fix test by using diff. dep. name --- .../FunctionalTests/FunctionalTest.cs | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs index b7928ed7d81e..b1955c2ee152 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs @@ -539,6 +539,7 @@ public void AzureDeploymentTest() Assert.IsTrue(File.Exists(configPath3.FullName), "file not exist={0}", configPath3); string deploymentName = "deployment1"; + string deploymentName2 = "deployment2"; string deploymentLabel = "label1"; DeploymentInfoContext result; @@ -595,12 +596,12 @@ public void AzureDeploymentTest() // Re-create the Staging depoyment with the extension Utilities.RetryActionUntilSuccess(() => { - vmPowershellCmdlets.NewAzureDeployment(serviceName, packagePath1.FullName, configPath1.FullName, DeploymentSlotType.Staging, deploymentLabel, deploymentName, false, false, rdpExtCfg); - }, "already exists under service", 10, 60); + vmPowershellCmdlets.NewAzureDeployment(serviceName, packagePath2.FullName, configPath2.FullName, DeploymentSlotType.Staging, deploymentLabel, deploymentName2, false, false, rdpExtCfg); + }, "Windows Azure is currently performing an operation on this hosted service that requires exclusive access.", 10, 60); result = vmPowershellCmdlets.GetAzureDeployment(serviceName, DeploymentSlotType.Staging); - pass = Utilities.PrintAndCompareDeployment(result, serviceName, deploymentName, deploymentLabel, DeploymentSlotType.Staging, null, 1); - Console.WriteLine(string.Format("Successfully re-deployed the package to the {0} slot.", DeploymentSlotType.Staging)); + pass = Utilities.PrintAndCompareDeployment(result, serviceName, deploymentName2, deploymentLabel, DeploymentSlotType.Staging, null, 2); + Console.WriteLine(string.Format("Successfully re-deployed the package #2 to the {0} slot.", DeploymentSlotType.Staging)); ExtensionContext extResult2 = vmPowershellCmdlets.GetAzureServiceExtension(serviceName, DeploymentSlotType.Staging)[0]; Utilities.PrintContext(extResult2); @@ -611,15 +612,18 @@ public void AzureDeploymentTest() vmPowershellCmdlets.SetAzureDeploymentConfig(serviceName, DeploymentSlotType.Staging, configPath2.FullName, rdpExtCfg); }, "The server encountered an internal error. Please retry the request.", 10, 30); result = vmPowershellCmdlets.GetAzureDeployment(serviceName, DeploymentSlotType.Staging); - pass &= Utilities.PrintAndCompareDeployment(result, serviceName, deploymentName, deploymentLabel, DeploymentSlotType.Staging, null, 2); - Console.WriteLine("successfully updated the deployment"); + pass &= Utilities.PrintAndCompareDeployment(result, serviceName, deploymentName2, deploymentLabel, DeploymentSlotType.Staging, null, 2); + Console.WriteLine("successfully updated the deployment #2"); ExtensionContext extResult3 = vmPowershellCmdlets.GetAzureServiceExtension(serviceName, DeploymentSlotType.Staging)[0]; Utilities.PrintContext(extResult3); Assert.IsTrue(!string.Equals(extResult2.Id, extResult3.Id)); - // Set the deployment status to 'Suspended' + // Remove the deployment #2 + vmPowershellCmdlets.RemoveAzureDeployment(serviceName, DeploymentSlotType.Staging, true); + + // Set the deployment #1 status to 'Suspended' Utilities.RetryActionUntilSuccess(() => { vmPowershellCmdlets.SetAzureDeploymentStatus(serviceName, DeploymentSlotType.Production, DeploymentStatus.Suspended); @@ -628,7 +632,7 @@ public void AzureDeploymentTest() pass &= Utilities.PrintAndCompareDeployment(result, serviceName, deploymentName, deploymentLabel, DeploymentSlotType.Production, DeploymentStatus.Suspended, 1); Console.WriteLine("successfully changed the status"); - // Update the deployment + // Update the deployment #1 Utilities.RetryActionUntilSuccess(() => { vmPowershellCmdlets.SetAzureDeploymentConfig(serviceName, DeploymentSlotType.Production, configPath2.FullName); @@ -637,7 +641,7 @@ public void AzureDeploymentTest() pass &= Utilities.PrintAndCompareDeployment(result, serviceName, deploymentName, deploymentLabel, DeploymentSlotType.Production, null, 2); Console.WriteLine("successfully updated the deployment"); - // Upgrade the deployment + // Upgrade the deployment #1 DateTime start = DateTime.Now; Utilities.RetryActionUntilSuccess(() => { From d503bab444b69862043257aa3d861ce5180a0f5e Mon Sep 17 00:00:00 2001 From: huangpf Date: Fri, 5 Jun 2015 16:52:56 -0700 Subject: [PATCH 11/12] Address CRs --- .../IaasCmdletInfo/SetAzureDeploymentCmdletInfo.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/IaasCmdletInfo/SetAzureDeploymentCmdletInfo.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/IaasCmdletInfo/SetAzureDeploymentCmdletInfo.cs index b504f95c4f60..b770db9b0af9 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/IaasCmdletInfo/SetAzureDeploymentCmdletInfo.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/IaasCmdletInfo/SetAzureDeploymentCmdletInfo.cs @@ -45,7 +45,11 @@ public static SetAzureDeploymentCmdletInfo SetAzureDeploymentConfigCmdletInfo(st result.cmdletParams.Add(new CmdletParam("Config")); result.cmdletParams.Add(new CmdletParam("Configuration", configPath)); - result.cmdletParams.Add(new CmdletParam("ExtensionConfiguration", extConfig)); + + if (extConfig != null) + { + result.cmdletParams.Add(new CmdletParam("ExtensionConfiguration", extConfig)); + } return result; } From 6c5490816dddfc912355a48ddf6f3eb6b673a99a Mon Sep 17 00:00:00 2001 From: huangpf Date: Sun, 7 Jun 2015 00:04:19 -0700 Subject: [PATCH 12/12] Update Tests --- .../ScenarioTests/AvailabilitySetTests.ps1 | 2 +- .../Generated/VirtualMachineDynamicTest1.ps1 | 2 +- .../Generated/VirtualMachineDynamicTest2.ps1 | 2 +- .../Generated/VirtualMachineDynamicTest3.ps1 | 2 +- .../ScenarioTests/VMDynamicTests.ps1 | 2 +- .../VirtualMachineExtensionTests.ps1 | 6 +++--- .../VirtualMachineNetworkInterfaceTests.ps1 | 6 +++--- .../ScenarioTests/VirtualMachineTests.ps1 | 20 +++++++++---------- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/AvailabilitySetTests.ps1 b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/AvailabilitySetTests.ps1 index 89a4fbfe6149..7ced50d94972 100644 --- a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/AvailabilitySetTests.ps1 +++ b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/AvailabilitySetTests.ps1 @@ -25,7 +25,7 @@ function Test-AvailabilitySet { # Common $loc = 'West US'; - New-AzureResourceGroup -Name $rgname -Location $loc; + New-AzureResourceGroup -Name $rgname -Location $loc -Force; $asetName = 'avs' + $rgname; $nonDefaultUD = 2; diff --git a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/Generated/VirtualMachineDynamicTest1.ps1 b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/Generated/VirtualMachineDynamicTest1.ps1 index a7d2d3a0e6d3..25cc694d4553 100644 --- a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/Generated/VirtualMachineDynamicTest1.ps1 +++ b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/Generated/VirtualMachineDynamicTest1.ps1 @@ -132,7 +132,7 @@ function ps_vm_dynamic_test_func_1_pstestrg1016 $st = Write-Verbose "Running Test ps_vm_dynamic_test_func_1_pstestrg1016 - Start ${rgname}, ${loc} & ${vmsize}"; $st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_1_pstestrg1016 - Creating Resource Group'; - $st = New-AzureResourceGroup -Location $loc -Name $rgname; + $st = New-AzureResourceGroup -Location $loc -Name $rgname -Force; $vmconfig = create_and_setup_vm_config_object $loc $rgname $vmsize; diff --git a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/Generated/VirtualMachineDynamicTest2.ps1 b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/Generated/VirtualMachineDynamicTest2.ps1 index 8e8b3487a2af..dbb800833343 100644 --- a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/Generated/VirtualMachineDynamicTest2.ps1 +++ b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/Generated/VirtualMachineDynamicTest2.ps1 @@ -132,7 +132,7 @@ function ps_vm_dynamic_test_func_2_pstestrg4940 $st = Write-Verbose "Running Test ps_vm_dynamic_test_func_2_pstestrg4940 - Start ${rgname}, ${loc} & ${vmsize}"; $st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_2_pstestrg4940 - Creating Resource Group'; - $st = New-AzureResourceGroup -Location $loc -Name $rgname; + $st = New-AzureResourceGroup -Location $loc -Name $rgname -Force; $vmconfig = create_and_setup_vm_config_object $loc $rgname $vmsize; diff --git a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/Generated/VirtualMachineDynamicTest3.ps1 b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/Generated/VirtualMachineDynamicTest3.ps1 index b922f4d09c0a..e21bda4249c6 100644 --- a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/Generated/VirtualMachineDynamicTest3.ps1 +++ b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/Generated/VirtualMachineDynamicTest3.ps1 @@ -132,7 +132,7 @@ function ps_vm_dynamic_test_func_3_pstestrg575 $st = Write-Verbose "Running Test ps_vm_dynamic_test_func_3_pstestrg575 - Start ${rgname}, ${loc} & ${vmsize}"; $st = Write-Verbose 'Running Test ps_vm_dynamic_test_func_3_pstestrg575 - Creating Resource Group'; - $st = New-AzureResourceGroup -Location $loc -Name $rgname; + $st = New-AzureResourceGroup -Location $loc -Name $rgname -Force; $vmconfig = create_and_setup_vm_config_object $loc $rgname $vmsize; diff --git a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VMDynamicTests.ps1 b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VMDynamicTests.ps1 index 44f771fb88b2..2d912f1c3b3f 100644 --- a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VMDynamicTests.ps1 +++ b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VMDynamicTests.ps1 @@ -335,7 +335,7 @@ function ${generated_func_name} `$st = Write-Verbose `"Running Test ${generated_func_name} - Start `${rgname}, `${loc} & `${vmsize}`"; `$st = Write-Verbose 'Running Test ${generated_func_name} - Creating Resource Group'; - `$st = New-AzureResourceGroup -Location `$loc -Name `$rgname; + `$st = New-AzureResourceGroup -Location `$loc -Name `$rgname -Force; `$vmconfig = create_and_setup_vm_config_object `$loc `$rgname `$vmsize; diff --git a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineExtensionTests.ps1 b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineExtensionTests.ps1 index 250a011ced19..a35215f7fe14 100644 --- a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineExtensionTests.ps1 +++ b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineExtensionTests.ps1 @@ -26,7 +26,7 @@ function Test-VirtualMachineExtension { # Common $loc = 'westus'; - New-AzureResourceGroup -Name $rgname -Location $loc; + New-AzureResourceGroup -Name $rgname -Location $loc -Force; # VM Profile & Hardware $vmsize = 'Standard_A2'; @@ -203,7 +203,7 @@ function Test-VirtualMachineCustomScriptExtension { # Common $loc = 'westus'; - New-AzureResourceGroup -Name $rgname -Location $loc; + New-AzureResourceGroup -Name $rgname -Location $loc -Force; # VM Profile & Hardware $vmsize = 'Standard_A4'; @@ -359,7 +359,7 @@ function Test-VirtualMachineAccessExtension { # Common $loc = 'westus'; - New-AzureResourceGroup -Name $rgname -Location $loc; + New-AzureResourceGroup -Name $rgname -Location $loc -Force; # VM Profile & Hardware $vmsize = 'Standard_A4'; diff --git a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineNetworkInterfaceTests.ps1 b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineNetworkInterfaceTests.ps1 index f7605a2f2524..38ce4ab0e91e 100644 --- a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineNetworkInterfaceTests.ps1 +++ b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineNetworkInterfaceTests.ps1 @@ -25,7 +25,7 @@ function Test-SingleNetworkInterface { # Common $loc = 'westus'; - New-AzureResourceGroup -Name $rgname -Location $loc; + New-AzureResourceGroup -Name $rgname -Location $loc -Force; # VM Profile & Hardware $vmsize = 'Standard_A2'; @@ -148,7 +148,7 @@ function Test-SingleNetworkInterfaceDnsSettings { # Common $loc = 'westus'; - New-AzureResourceGroup -Name $rgname -Location $loc; + New-AzureResourceGroup -Name $rgname -Location $loc -Force; # VM Profile & Hardware $vmsize = 'Standard_A2'; @@ -255,7 +255,7 @@ function Test-MultipleNetworkInterface { # Common $loc = 'westus'; - New-AzureResourceGroup -Name $rgname -Location $loc; + New-AzureResourceGroup -Name $rgname -Location $loc -Force; # VM Profile & Hardware $vmsize = 'Standard_A4'; diff --git a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineTests.ps1 b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineTests.ps1 index a0775a08d1f5..5e650cfa7c05 100644 --- a/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineTests.ps1 +++ b/src/ResourceManager/Compute/Commands.Compute.Test/ScenarioTests/VirtualMachineTests.ps1 @@ -25,7 +25,7 @@ function Test-VirtualMachine { # Common $loc = 'westus'; - New-AzureResourceGroup -Name $rgname -Location $loc; + New-AzureResourceGroup -Name $rgname -Location $loc -Force; # VM Profile & Hardware $vmsize = 'Standard_A4'; @@ -373,7 +373,7 @@ function Test-VirtualMachineSizeAndUsage { # Common $loc = 'westus'; - New-AzureResourceGroup -Name $rgname -Location $loc; + New-AzureResourceGroup -Name $rgname -Location $loc -Force; # Availability Set $asetName = 'aset' + $rgname; @@ -544,7 +544,7 @@ function Test-VirtualMachinePIRv2 { # Common $loc = 'westus'; - New-AzureResourceGroup -Name $rgname -Location $loc; + New-AzureResourceGroup -Name $rgname -Location $loc -Force; # VM Profile & Hardware $vmsize = 'Standard_A4'; @@ -654,7 +654,7 @@ function Test-VirtualMachineCapture { # Common $loc = 'westus'; - New-AzureResourceGroup -Name $rgname -Location $loc; + New-AzureResourceGroup -Name $rgname -Location $loc -Force; # VM Profile & Hardware $vmsize = 'Standard_A4'; @@ -770,7 +770,7 @@ function Test-VirtualMachineDataDisk { # Common $loc = 'westus'; - New-AzureResourceGroup -Name $rgname -Location $loc; + New-AzureResourceGroup -Name $rgname -Location $loc -Force; # VM Profile & Hardware $vmsize = 'Standard_A0'; @@ -851,7 +851,7 @@ function Test-VirtualMachinePlan { # Common $loc = 'westus'; - New-AzureResourceGroup -Name $rgname -Location $loc; + New-AzureResourceGroup -Name $rgname -Location $loc -Force; # VM Profile & Hardware $vmsize = 'Standard_A0'; @@ -935,7 +935,7 @@ function Test-VirtualMachinePlan2 { # Common $loc = 'westus'; - New-AzureResourceGroup -Name $rgname -Location $loc; + New-AzureResourceGroup -Name $rgname -Location $loc -Force; # VM Profile & Hardware $vmsize = 'Standard_A0'; @@ -1021,7 +1021,7 @@ function Test-VirtualMachineTags { # Common $loc = 'westus'; - New-AzureResourceGroup -Name $rgname -Location $loc; + New-AzureResourceGroup -Name $rgname -Location $loc -Force; # VM Profile & Hardware $vmsize = 'Standard_A0'; @@ -1096,7 +1096,7 @@ function Test-VirtualMachineWithVMAgentAutoUpdate { # Common $loc = 'westus'; - New-AzureResourceGroup -Name $rgname -Location $loc; + New-AzureResourceGroup -Name $rgname -Location $loc -Force; # VM Profile & Hardware $vmsize = 'Standard_A4'; @@ -1190,7 +1190,7 @@ function Test-LinuxVirtualMachine { # Common $loc = 'westus'; - New-AzureResourceGroup -Name $rgname -Location $loc; + New-AzureResourceGroup -Name $rgname -Location $loc -Force; # VM Profile & Hardware $vmsize = 'Standard_A4';