From abfbe083e15aaa00fa882ae7ce1a0c05dd8171b2 Mon Sep 17 00:00:00 2001 From: huangpf Date: Fri, 5 Dec 2014 15:45:45 -0800 Subject: [PATCH 01/13] To fix AzureVMImageListRemoveTest --- .../FunctionalTests/VMTemplateTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/VMTemplateTests.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/VMTemplateTests.cs index d51ceb2ff266..e6b62ea8a49b 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/VMTemplateTests.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/VMTemplateTests.cs @@ -352,6 +352,7 @@ public void AzureVMImageListRemoveTest() Console.WriteLine("------------------------------Try to save the OS image with an existing os image name: Completed---------------------------------"); //e. Save the OS image with a new image name. Console.WriteLine("------------------------------Save the OS image with a new image name.---------------------------------"); + vmPowershellCmdlets.StopAzureVM(vm, serviceName, true); vmPowershellCmdlets.SaveAzureVMImage(serviceName, vmName, newLabel); Console.WriteLine("------------------------------Save the OS image with a new image name: Completed---------------------------------"); //f. Deploy a new IaaS VM From 31f4391d26b1a2b7d736edcb1541d664ddc3d41a Mon Sep 17 00:00:00 2001 From: huangpf Date: Sat, 6 Dec 2014 07:13:56 -0800 Subject: [PATCH 02/13] Fix Test Comments --- .../FunctionalTests/VMTemplateTests.cs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/VMTemplateTests.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/VMTemplateTests.cs index e6b62ea8a49b..c723fedae154 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/VMTemplateTests.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/VMTemplateTests.cs @@ -468,30 +468,30 @@ public void SaveAzureVMImageNegativeTest() vmPowershellCmdlets.NewAzureVM(serviceName, new[] { vm }); Console.WriteLine("------------------------------Deploy another new IaaS VM: completed---------------------------------"); //e. Stop the VM - Console.WriteLine("------------------------------Deleted the VM image---------------------------------"); + Console.WriteLine("------------------------------Stop the VM (for 2nd VM)---------------------------------"); vmPowershellCmdlets.StopAzureVM(vm, serviceName,force:true); string testImageName = Utilities.GetUniqueShortName(vmNamePrefix); - Console.WriteLine("------------------------------Deleted the VM image---------------------------------"); + Console.WriteLine("------------------------------Stop the VM (for 2nd VM): completed---------------------------------"); //f. Try to save the VM image with the existing name (must fail) - Console.WriteLine("------------------------------Deleted the VM image---------------------------------"); + Console.WriteLine("------------------------------Save the VM image (must fail)---------------------------------"); Utilities.VerifyFailure(() => vmPowershellCmdlets.SaveAzureVMImage(serviceName, vmName1, vmImageName, CONSTANT_SPECIALIZED, vmImageName),ConflictErrorException); - Console.WriteLine("------------------------------Deleted the VM image---------------------------------"); + Console.WriteLine("------------------------------Save the VM image: completed---------------------------------"); //g. Try to save the VM image with the wrong vm name (must fail) - Console.WriteLine("------------------------------Deleted the VM image---------------------------------"); + Console.WriteLine("------------------------------Save the VM image (must fail)---------------------------------"); Utilities.VerifyFailure(() => vmPowershellCmdlets.SaveAzureVMImage(serviceName, Utilities.GetUniqueShortName(vmNamePrefix), testImageName, CONSTANT_SPECIALIZED, testImageName), ResourceNotFoundException); - Console.WriteLine("------------------------------Deleted the VM image---------------------------------"); + Console.WriteLine("------------------------------Save the VM image (must fail): completed---------------------------------"); //h. Try to save the VM image with the wrong service name (must fail) - Console.WriteLine("------------------------------Deleted the VM image---------------------------------"); + Console.WriteLine("------------------------------Save the VM image with wrong name (must fail)---------------------------------"); string testVMIMage = Utilities.GetUniqueShortName("VMImage"); vmPowershellCmdlets.SaveAzureVMImage(Utilities.GetUniqueShortName(vmNamePrefix), vmName1, testVMIMage, CONSTANT_SPECIALIZED, testVMIMage); Utilities.VerifyFailure(() => vmPowershellCmdlets.GetAzureVMImage(testVMIMage),ResourceNotFoundException); - Console.WriteLine("------------------------------Deleted the VM image---------------------------------"); + Console.WriteLine("------------------------------Save the VM image with wrong name (must fail): completed---------------------------------"); //i. Try to save the VM image with the label longer than maximum length of string (must fail) - Console.WriteLine("------------------------------Deleted the VM image---------------------------------"); + Console.WriteLine("------------------------------Save the VM image with long name (must fail)---------------------------------"); string LongImageName = Utilities.GetUniqueShortName(length:30) + Utilities.GetUniqueShortName(length:30)+ Guid.NewGuid().ToString() + Guid.NewGuid().ToString() ; Console.WriteLine("Attempting to save a VMImage with name {0} of {1} characters and expecting it to fail.", LongImageName,LongImageName.Length); Utilities.VerifyFailure(() => vmPowershellCmdlets.SaveAzureVMImage(serviceName, vmName1, testImageName, CONSTANT_SPECIALIZED, LongImageName), BadRequestException); - Console.WriteLine("------------------------------Deleted the VM image---------------------------------"); + Console.WriteLine("------------------------------Save the VM image with long name (must fail): completed---------------------------------"); pass = true; } catch (Exception ex) @@ -501,9 +501,9 @@ public void SaveAzureVMImageNegativeTest() } finally { - Console.WriteLine("------------------------------Delete the VM image---------------------------------"); + Console.WriteLine("------------------------------Delete the VM image (cleanup)---------------------------------"); DeleteVMImageIfExists(vmImageName); - Console.WriteLine("------------------------------Deleted the VM image---------------------------------"); + Console.WriteLine("------------------------------Deleted the VM image (cleanup): completed---------------------------------"); } } From 971abcc801a32bf799917ad48a3dbcbaaea9bef8 Mon Sep 17 00:00:00 2001 From: huangpf Date: Sat, 6 Dec 2014 07:50:26 -0800 Subject: [PATCH 03/13] fix vm image negative test --- .../FunctionalTests/ServiceManagementCmdletTestHelper.cs | 4 ++-- .../FunctionalTests/VMTemplateTests.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs index 5bcd4edd33c1..6dd11e731da1 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs @@ -1397,9 +1397,9 @@ public ManagementOperationContext RemoveAzureVMImage(string imageName, bool dele return result; } - public void SaveAzureVMImage(string serviceName, string vmName, string newImageName, string osState = null,string newImageLabel = null) + public void SaveAzureVMImage(string serviceName, string vmName, string newImageName, string osState = null, string newImageLabel = null, bool debug = false, bool retryOnConflict = false) { - RunPSCmdletAndReturnFirst(new SaveAzureVMImageCmdletInfo(serviceName, vmName, newImageName, newImageLabel, osState)); + RunPSCmdletAndReturnFirst(new SaveAzureVMImageCmdletInfo(serviceName, vmName, newImageName, newImageLabel, osState), debug, retryOnConflict); } public Collection GetAzureVMImage(string imageName = null) diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/VMTemplateTests.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/VMTemplateTests.cs index c723fedae154..e920a66bcf31 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/VMTemplateTests.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/VMTemplateTests.cs @@ -473,9 +473,9 @@ public void SaveAzureVMImageNegativeTest() string testImageName = Utilities.GetUniqueShortName(vmNamePrefix); Console.WriteLine("------------------------------Stop the VM (for 2nd VM): completed---------------------------------"); //f. Try to save the VM image with the existing name (must fail) - Console.WriteLine("------------------------------Save the VM image (must fail)---------------------------------"); - Utilities.VerifyFailure(() => vmPowershellCmdlets.SaveAzureVMImage(serviceName, vmName1, vmImageName, CONSTANT_SPECIALIZED, vmImageName),ConflictErrorException); - Console.WriteLine("------------------------------Save the VM image: completed---------------------------------"); + Console.WriteLine("------------------------------Save the VM image with the existing name (must fail)---------------------------------"); + Utilities.VerifyFailure(() => vmPowershellCmdlets.SaveAzureVMImage(serviceName, vmName1, vmImageName, CONSTANT_SPECIALIZED, vmImageName, false, false), ConflictErrorException); + Console.WriteLine("------------------------------Save the VM image with the existing name (must fail): completed---------------------------------"); //g. Try to save the VM image with the wrong vm name (must fail) Console.WriteLine("------------------------------Save the VM image (must fail)---------------------------------"); Utilities.VerifyFailure(() => vmPowershellCmdlets.SaveAzureVMImage(serviceName, Utilities.GetUniqueShortName(vmNamePrefix), testImageName, CONSTANT_SPECIALIZED, testImageName), ResourceNotFoundException); From 3e5b157386a9c84c7aac654210d290f950fa7af3 Mon Sep 17 00:00:00 2001 From: huangpf Date: Sat, 6 Dec 2014 16:40:48 -0800 Subject: [PATCH 04/13] add repeat 10 tests target --- AzurePowershell.Test.targets | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/AzurePowershell.Test.targets b/AzurePowershell.Test.targets index f31479edbba2..a9db0c1cab97 100644 --- a/AzurePowershell.Test.targets +++ b/AzurePowershell.Test.targets @@ -172,6 +172,41 @@ ContinueOnError="false" /> + + + + + + + + + + + + + + + From 26eb1f7cd8cc7de846a363df1b8045bf5859e7ff Mon Sep 17 00:00:00 2001 From: huangpf Date: Sat, 6 Dec 2014 17:59:10 -0800 Subject: [PATCH 05/13] build repeat target --- AzurePowershell.Test.targets | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/AzurePowershell.Test.targets b/AzurePowershell.Test.targets index a9db0c1cab97..1281e0df7499 100644 --- a/AzurePowershell.Test.targets +++ b/AzurePowershell.Test.targets @@ -172,38 +172,11 @@ ContinueOnError="false" /> - + - - - - - - - - - From fa0f731a9eb2f3c1b55b7d439d1f85036f4e3000 Mon Sep 17 00:00:00 2001 From: huangpf Date: Wed, 17 Dec 2014 21:51:04 -0800 Subject: [PATCH 06/13] update assembly references, in order to make msbuild always copy them to the build folder --- .../Commands.Common.Storage/Commands.Common.Storage.csproj | 4 ++++ src/Common/Commands.Common/Commands.Common.csproj | 4 ++++ .../Commands.DataFactories/Commands.DataFactories.csproj | 1 + src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj | 4 ++++ .../Commands.ServiceManagement.PlatformImageRepository.csproj | 4 ++++ .../Commands.ServiceManagement.Preview.csproj | 4 ++++ .../Commands.ServiceManagement.csproj | 4 ++++ src/ServiceManagement/Compute/Sync/Sync.csproj | 4 ++++ .../HDInsight/Commands.HDInsight/Commands.HDInsight.csproj | 4 ++++ .../Commands.ManagedCache/Commands.ManagedCache.csproj | 4 ++++ .../Services/Commands.Utilities/Commands.Utilities.csproj | 4 ++++ src/ServiceManagement/Services/Commands/Commands.csproj | 4 ++++ .../Sql/Commands.SqlDatabase/Commands.SqlDatabase.csproj | 4 ++++ .../Storage/Commands.Storage/Commands.Storage.csproj | 4 ++++ .../Commands.TrafficManager/Commands.TrafficManager.csproj | 4 ++++ 15 files changed, 57 insertions(+) diff --git a/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj b/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj index b1b8cc0d7dab..2321e2ea6494 100644 --- a/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj +++ b/src/Common/Commands.Common.Storage/Commands.Common.Storage.csproj @@ -50,12 +50,15 @@ ..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True False @@ -109,6 +112,7 @@ ..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/Common/Commands.Common/Commands.Common.csproj b/src/Common/Commands.Common/Commands.Common.csproj index 8a7df1ba2964..28d9f6b69093 100644 --- a/src/Common/Commands.Common/Commands.Common.csproj +++ b/src/Common/Commands.Common/Commands.Common.csproj @@ -56,12 +56,15 @@ ..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True False @@ -124,6 +127,7 @@ ..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj b/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj index 8f9119a49e28..7d0389d052d1 100644 --- a/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj +++ b/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj @@ -101,6 +101,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj b/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj index dbabb3532ef8..188c72a53d94 100644 --- a/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj +++ b/src/ResourceManager/Sql/Commands.Sql/Commands.Sql.csproj @@ -97,12 +97,15 @@ ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True False @@ -156,6 +159,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/Commands.ServiceManagement.PlatformImageRepository.csproj b/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/Commands.ServiceManagement.PlatformImageRepository.csproj index bc6bc775eec0..ac15e9769da5 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/Commands.ServiceManagement.PlatformImageRepository.csproj +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.PlatformImageRepository/Commands.ServiceManagement.PlatformImageRepository.csproj @@ -61,12 +61,15 @@ ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True False @@ -129,6 +132,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Commands.ServiceManagement.Preview.csproj b/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Commands.ServiceManagement.Preview.csproj index ec3002af9f09..87cf0f4efe35 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Commands.ServiceManagement.Preview.csproj +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Preview/Commands.ServiceManagement.Preview.csproj @@ -61,12 +61,15 @@ ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True False @@ -133,6 +136,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/Commands.ServiceManagement.csproj b/src/ServiceManagement/Compute/Commands.ServiceManagement/Commands.ServiceManagement.csproj index 6a433f6bb948..bb9c52db1f38 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/Commands.ServiceManagement.csproj +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/Commands.ServiceManagement.csproj @@ -63,12 +63,15 @@ ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True False @@ -139,6 +142,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ServiceManagement/Compute/Sync/Sync.csproj b/src/ServiceManagement/Compute/Sync/Sync.csproj index 2e833c2bc682..d22072425396 100644 --- a/src/ServiceManagement/Compute/Sync/Sync.csproj +++ b/src/ServiceManagement/Compute/Sync/Sync.csproj @@ -53,12 +53,15 @@ ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True ..\..\..\packages\Microsoft.WindowsAzure.ConfigurationManager.2.0.3\lib\net40\Microsoft.WindowsAzure.Configuration.dll @@ -78,6 +81,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj b/src/ServiceManagement/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj index 1b5491787cef..09473259b9cd 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Commands.HDInsight.csproj @@ -49,12 +49,15 @@ ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True ..\..\..\packages\Microsoft.Hadoop.Client.1.3.3.2\lib\net40\Microsoft.Hadoop.Client.dll @@ -115,6 +118,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ServiceManagement/ManagedCache/Commands.ManagedCache/Commands.ManagedCache.csproj b/src/ServiceManagement/ManagedCache/Commands.ManagedCache/Commands.ManagedCache.csproj index 1aeed4f80c51..8c3600b980f7 100644 --- a/src/ServiceManagement/ManagedCache/Commands.ManagedCache/Commands.ManagedCache.csproj +++ b/src/ServiceManagement/ManagedCache/Commands.ManagedCache/Commands.ManagedCache.csproj @@ -43,12 +43,15 @@ ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True False @@ -96,6 +99,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ServiceManagement/Services/Commands.Utilities/Commands.Utilities.csproj b/src/ServiceManagement/Services/Commands.Utilities/Commands.Utilities.csproj index f3277cd1a8d8..d5212907f7f3 100644 --- a/src/ServiceManagement/Services/Commands.Utilities/Commands.Utilities.csproj +++ b/src/ServiceManagement/Services/Commands.Utilities/Commands.Utilities.csproj @@ -60,12 +60,15 @@ ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True ..\..\..\packages\WindowsAzure.ServiceBus.2.3.2.0\lib\net40-full\Microsoft.ServiceBus.dll @@ -167,6 +170,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ServiceManagement/Services/Commands/Commands.csproj b/src/ServiceManagement/Services/Commands/Commands.csproj index c72ef1b612a9..b9d213dffb1c 100644 --- a/src/ServiceManagement/Services/Commands/Commands.csproj +++ b/src/ServiceManagement/Services/Commands/Commands.csproj @@ -58,12 +58,15 @@ ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True False @@ -173,6 +176,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ServiceManagement/Sql/Commands.SqlDatabase/Commands.SqlDatabase.csproj b/src/ServiceManagement/Sql/Commands.SqlDatabase/Commands.SqlDatabase.csproj index f09283a2d85e..58830cb5d17c 100644 --- a/src/ServiceManagement/Sql/Commands.SqlDatabase/Commands.SqlDatabase.csproj +++ b/src/ServiceManagement/Sql/Commands.SqlDatabase/Commands.SqlDatabase.csproj @@ -53,12 +53,15 @@ ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True False @@ -114,6 +117,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ServiceManagement/Storage/Commands.Storage/Commands.Storage.csproj b/src/ServiceManagement/Storage/Commands.Storage/Commands.Storage.csproj index f896296bf24c..c37d13211a81 100644 --- a/src/ServiceManagement/Storage/Commands.Storage/Commands.Storage.csproj +++ b/src/ServiceManagement/Storage/Commands.Storage/Commands.Storage.csproj @@ -43,12 +43,15 @@ ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True False @@ -105,6 +108,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True diff --git a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Commands.TrafficManager.csproj b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Commands.TrafficManager.csproj index 86ea75d0aa0a..b4f9516f2b09 100644 --- a/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Commands.TrafficManager.csproj +++ b/src/ServiceManagement/TrafficManager/Commands.TrafficManager/Commands.TrafficManager.csproj @@ -47,12 +47,15 @@ ..\..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll + True ..\..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll + True ..\..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll + True False @@ -102,6 +105,7 @@ ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True From b908a744b5f0259f1fe35b6a377f12f0c6976772 Mon Sep 17 00:00:00 2001 From: huangpf Date: Wed, 17 Dec 2014 22:32:03 -0800 Subject: [PATCH 07/13] update assemblies --- .../Commands.DataFactories/Commands.DataFactories.csproj | 9 +++++++++ .../DataFactories/Commands.DataFactories/packages.config | 3 +++ .../Commands.StreamAnalytics.csproj | 4 ++++ .../Commands.StreamAnalytics/packages.config | 3 +++ .../Tags/Commands.Tags/Commands.Tags.csproj | 4 ++++ src/ResourceManager/Tags/Commands.Tags/packages.config | 3 +++ .../Network/Commands.Network/Commands.Network.csproj | 4 ++++ 7 files changed, 30 insertions(+) diff --git a/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj b/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj index 7d0389d052d1..3df2a89b18d2 100644 --- a/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj +++ b/src/ResourceManager/DataFactories/Commands.DataFactories/Commands.DataFactories.csproj @@ -51,6 +51,15 @@ ..\..\..\packages\Microsoft.Azure.Management.DataFactories.0.12.0-preview\lib\net40\Microsoft.Azure.Management.DataFactories.dll + + True + + + True + + + True + ..\..\..\packages\Microsoft.DataFactories.Runtime.0.11.1-preview\lib\net45\Microsoft.DataFactories.Runtime.dll diff --git a/src/ResourceManager/DataFactories/Commands.DataFactories/packages.config b/src/ResourceManager/DataFactories/Commands.DataFactories/packages.config index 404260a2d015..a8a26e9b95e8 100644 --- a/src/ResourceManager/DataFactories/Commands.DataFactories/packages.config +++ b/src/ResourceManager/DataFactories/Commands.DataFactories/packages.config @@ -4,6 +4,9 @@ + + + diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj index e2755e3a7859..4d30de2bdeb7 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj @@ -52,6 +52,9 @@ False ..\..\..\packages\Microsoft.Azure.Management.StreamAnalytics.0.12.1-preview\lib\net40\Microsoft.Azure.Management.StreamAnalytics.dll + + + False ..\..\..\packages\Microsoft.WindowsAzure.Common.1.4.1\lib\net45\Microsoft.WindowsAzure.Common.dll @@ -73,6 +76,7 @@ ..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Primitives.dll + diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config index 13f6d3867e27..c6d7d646364f 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/packages.config @@ -4,6 +4,9 @@ + + + diff --git a/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj b/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj index fdedd95890ca..378db23d97ff 100644 --- a/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj +++ b/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj @@ -52,6 +52,9 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.7.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + + + False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll @@ -98,6 +101,7 @@ + diff --git a/src/ResourceManager/Tags/Commands.Tags/packages.config b/src/ResourceManager/Tags/Commands.Tags/packages.config index cf130c809bb4..e47478b00bcd 100644 --- a/src/ResourceManager/Tags/Commands.Tags/packages.config +++ b/src/ResourceManager/Tags/Commands.Tags/packages.config @@ -4,6 +4,9 @@ + + + diff --git a/src/ServiceManagement/Network/Commands.Network/Commands.Network.csproj b/src/ServiceManagement/Network/Commands.Network/Commands.Network.csproj index 22b4f7382b0d..c9b03af6d6e7 100644 --- a/src/ServiceManagement/Network/Commands.Network/Commands.Network.csproj +++ b/src/ServiceManagement/Network/Commands.Network/Commands.Network.csproj @@ -49,6 +49,9 @@ ..\..\..\packages\AutoMapper.3.1.1\lib\net40\AutoMapper.Net4.dll True + + + False ..\..\..\packages\Microsoft.WindowsAzure.Common.1.4.1\lib\net45\Microsoft.WindowsAzure.Common.dll @@ -91,6 +94,7 @@ ..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Primitives.dll + From 15b18fc527652fcdd724f2b32d0bf1a8886ad812 Mon Sep 17 00:00:00 2001 From: huangpf Date: Wed, 17 Dec 2014 22:53:06 -0800 Subject: [PATCH 08/13] update --- .../Commands.StreamAnalytics.csproj | 19 ++++++++++++++---- .../Tags/Commands.Tags/Commands.Tags.csproj | 20 +++++++++++++++---- .../Commands.Network/Commands.Network.csproj | 17 ++++++++++++---- 3 files changed, 44 insertions(+), 12 deletions(-) diff --git a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj index 4d30de2bdeb7..e18f468a7ce0 100644 --- a/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj +++ b/src/ResourceManager/StreamAnalytics/Commands.StreamAnalytics/Commands.StreamAnalytics.csproj @@ -52,9 +52,16 @@ False ..\..\..\packages\Microsoft.Azure.Management.StreamAnalytics.0.12.1-preview\lib\net40\Microsoft.Azure.Management.StreamAnalytics.dll - - - + + + True + + + True + + + True + False ..\..\..\packages\Microsoft.WindowsAzure.Common.1.4.1\lib\net45\Microsoft.WindowsAzure.Common.dll @@ -76,7 +83,11 @@ ..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Primitives.dll - + + + ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True + diff --git a/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj b/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj index 378db23d97ff..97f29871dbb0 100644 --- a/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj +++ b/src/ResourceManager/Tags/Commands.Tags/Commands.Tags.csproj @@ -52,9 +52,18 @@ False ..\..\..\packages\Microsoft.Azure.Management.Resources.2.7.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll - - - + + + + True + + + True + + + True + + False ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll @@ -101,7 +110,10 @@ - + + ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True + diff --git a/src/ServiceManagement/Network/Commands.Network/Commands.Network.csproj b/src/ServiceManagement/Network/Commands.Network/Commands.Network.csproj index c9b03af6d6e7..64661184704d 100644 --- a/src/ServiceManagement/Network/Commands.Network/Commands.Network.csproj +++ b/src/ServiceManagement/Network/Commands.Network/Commands.Network.csproj @@ -49,9 +49,15 @@ ..\..\..\packages\AutoMapper.3.1.1\lib\net40\AutoMapper.Net4.dll True - - - + + True + + + True + + + True + False ..\..\..\packages\Microsoft.WindowsAzure.Common.1.4.1\lib\net45\Microsoft.WindowsAzure.Common.dll @@ -94,7 +100,10 @@ ..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Primitives.dll - + + ..\..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll + True + From 2b9c55876ef9acd9cc500cf4fc6675e7dedf8468 Mon Sep 17 00:00:00 2001 From: huangpf Date: Wed, 31 Dec 2014 12:14:57 -0800 Subject: [PATCH 09/13] fix AzureDeploymentTest --- .../FunctionalTests/FunctionalTest.cs | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs index 0d9d3c02922f..f354afba807b 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs @@ -289,26 +289,38 @@ public void AzureDeploymentTest() // Move the deployment from 'Staging' to 'Production' - vmPowershellCmdlets.MoveAzureDeployment(serviceName); + Utilities.RetryActionUntilSuccess(() => + { + vmPowershellCmdlets.MoveAzureDeployment(serviceName); + }, "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"); // Set the deployment status to 'Suspended' - vmPowershellCmdlets.SetAzureDeploymentStatus(serviceName, DeploymentSlotType.Production, DeploymentStatus.Suspended); + Utilities.RetryActionUntilSuccess(() => + { + vmPowershellCmdlets.SetAzureDeploymentStatus(serviceName, DeploymentSlotType.Production, DeploymentStatus.Suspended); + }, "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, DeploymentStatus.Suspended, 1); Console.WriteLine("successfully changed the status"); // Update the deployment - vmPowershellCmdlets.SetAzureDeploymentConfig(serviceName, DeploymentSlotType.Production, configPath2.FullName); + Utilities.RetryActionUntilSuccess(() => + { + vmPowershellCmdlets.SetAzureDeploymentConfig(serviceName, DeploymentSlotType.Production, configPath2.FullName); + }, "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, 2); Console.WriteLine("successfully updated the deployment"); // Upgrade the deployment DateTime start = DateTime.Now; - vmPowershellCmdlets.SetAzureDeploymentUpgrade(serviceName, DeploymentSlotType.Production, UpgradeType.Simultaneous, packagePath2.FullName, configPath3.FullName); + Utilities.RetryActionUntilSuccess(() => + { + vmPowershellCmdlets.SetAzureDeploymentUpgrade(serviceName, DeploymentSlotType.Production, UpgradeType.Simultaneous, packagePath2.FullName, configPath3.FullName); + }, "The server encountered an internal error. Please retry the request.", 10, 30); TimeSpan duration = DateTime.Now - start; Console.WriteLine("Auto upgrade took {0}.", duration); From 293dd5e840ad4cf5d2214848df67fe04f16c22b4 Mon Sep 17 00:00:00 2001 From: huangpf Date: Mon, 5 Jan 2015 10:02:25 -0800 Subject: [PATCH 10/13] Fix NewWindowsAzureQuickVM Test's internal error/retry issue --- .../FunctionalTests/ScenarioTest.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ScenarioTest.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ScenarioTest.cs index c3467a78551a..a96514c62275 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ScenarioTest.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ScenarioTest.cs @@ -64,8 +64,19 @@ public void NewWindowsAzureQuickVM() { if (string.IsNullOrEmpty(imageName)) imageName = vmPowershellCmdlets.GetAzureVMImageName(new[] { "Windows" }, false); + + Utilities.RetryActionUntilSuccess(() => + { + var svcExists = vmPowershellCmdlets.TestAzureServiceName(serviceName); + if (svcExists) + { + // Try to delete the hosted service artifact in this subscription + vmPowershellCmdlets.RemoveAzureService(serviceName, true); + } + + vmPowershellCmdlets.NewAzureQuickVM(OS.Windows, newAzureQuickVMName1, serviceName, imageName, username, password, locationName); + }, "The server encountered an internal error. Please retry the request.", 10, 30); - vmPowershellCmdlets.NewAzureQuickVM(OS.Windows, newAzureQuickVMName1, serviceName, imageName, username, password, locationName); // Verify Assert.AreEqual(newAzureQuickVMName1, vmPowershellCmdlets.GetAzureVM(newAzureQuickVMName1, serviceName).Name, true); From 4b73a920d69640cfccc2b34db054a5292598b446 Mon Sep 17 00:00:00 2001 From: huangpf Date: Tue, 6 Jan 2015 18:28:43 -0800 Subject: [PATCH 11/13] fix test by retry --- .../FunctionalTests/ScenarioTest.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ScenarioTest.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ScenarioTest.cs index a96514c62275..5f650d5ce1c6 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ScenarioTest.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ScenarioTest.cs @@ -80,7 +80,11 @@ public void NewWindowsAzureQuickVM() // Verify Assert.AreEqual(newAzureQuickVMName1, vmPowershellCmdlets.GetAzureVM(newAzureQuickVMName1, serviceName).Name, true); - vmPowershellCmdlets.NewAzureQuickVM(OS.Windows, newAzureQuickVMName2, serviceName, imageName, username, password); + Utilities.RetryActionUntilSuccess(() => + { + vmPowershellCmdlets.NewAzureQuickVM(OS.Windows, newAzureQuickVMName2, serviceName, imageName, username, password); + }, "The server encountered an internal error. Please retry the request.", 10, 30); + // Verify Assert.AreEqual(newAzureQuickVMName2, vmPowershellCmdlets.GetAzureVM(newAzureQuickVMName2, serviceName).Name, true); From 37866ac9e104171358e0a69fd643f629e59f6375 Mon Sep 17 00:00:00 2001 From: huangpf Date: Wed, 7 Jan 2015 18:23:17 -0800 Subject: [PATCH 12/13] create vm using vm image with media location --- .../ConfigDataInfo/AzureVMConfigInfo.cs | 4 +- .../NewAzureVMConfigCmdletInfo.cs | 5 ++ .../ServiceManagementCmdletTestHelper.cs | 12 ++++- .../FunctionalTests/VMTemplateTests.cs | 53 +++++++++++++++++++ .../IaaS/PersistentVMs/NewAzureVM.cs | 8 +-- 5 files changed, 77 insertions(+), 5 deletions(-) diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ConfigDataInfo/AzureVMConfigInfo.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ConfigDataInfo/AzureVMConfigInfo.cs index 47959bc5b96c..f944aad93a7f 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ConfigDataInfo/AzureVMConfigInfo.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ConfigDataInfo/AzureVMConfigInfo.cs @@ -19,12 +19,14 @@ public class AzureVMConfigInfo public string vmName; public string imageName; public string vmSize; + public string mediaLocation; - public AzureVMConfigInfo(string vmName, string vmSize, string imageName) + public AzureVMConfigInfo(string vmName, string vmSize, string imageName, string mediaLocation = null) { this.vmName = vmName; this.vmSize = vmSize; this.imageName = imageName; + this.mediaLocation = mediaLocation; } } } \ No newline at end of file diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/IaasCmdletInfo/NewAzureVMConfigCmdletInfo.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/IaasCmdletInfo/NewAzureVMConfigCmdletInfo.cs index bb06c5fcb852..579bbf3f1c01 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/IaasCmdletInfo/NewAzureVMConfigCmdletInfo.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/IaasCmdletInfo/NewAzureVMConfigCmdletInfo.cs @@ -26,6 +26,11 @@ public NewAzureVMConfigCmdletInfo(AzureVMConfigInfo vmConfig) this.cmdletParams.Add(new CmdletParam("Name", vmConfig.vmName)); this.cmdletParams.Add(new CmdletParam("ImageName", vmConfig.imageName)); this.cmdletParams.Add(new CmdletParam("InstanceSize", vmConfig.vmSize)); + + if (!string.IsNullOrEmpty(vmConfig.mediaLocation)) + { + this.cmdletParams.Add(new CmdletParam("MediaLocation", vmConfig.mediaLocation)); + } } } } diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs index e0ba38719ec9..0641bf224e8f 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/ServiceManagementCmdletTestHelper.cs @@ -1418,7 +1418,17 @@ public void SaveAzureVMImage(string serviceName, string vmName, string newImageN public Collection GetAzureVMImageReturningVMImages(string imageName = null) { - return RunPSCmdletAndReturnAll(new GetAzureVMImageCmdletInfo(imageName)); + Collection images = GetAzureVMImage(); + Collection vmImages = new Collection(); + foreach (SM.OSImageContext image in images) + { + if (image is SM.VMImageContext) + { + vmImages.Add((SM.VMImageContext)image); + } + } + + return vmImages; } public string GetAzureVMImageName(string[] keywords, bool exactMatch = true) diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/VMTemplateTests.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/VMTemplateTests.cs index e920a66bcf31..468a4f4d1e6f 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/VMTemplateTests.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/VMTemplateTests.cs @@ -572,6 +572,59 @@ public void UpdateVMImageDataDiskAndOsDiskTest() } + [TestMethod(), TestCategory(Category.Scenario), TestProperty("Feature", "IaaS"), Priority(0), Owner("hylee"), Description("Test the cmdlets (Get-AzureVMImage, New-AzureVMConfig, New-AzureVM, Get-AzureVM, Remove-AzureVM, etc.)")] + public void CreateVirtualMachineUsingVMImageWithDataDisks() + { + StartTest(MethodBase.GetCurrentMethod().Name, DateTime.Now); + + try + { + // Try to get VM image with data disks + var vmImages = vmPowershellCmdlets.GetAzureVMImageReturningVMImages(); + var vmImage = vmImages.Where(t => t.OS == "Windows" && t.DataDiskConfigurations != null && t.DataDiskConfigurations.Any()).FirstOrDefault(); + + // New-AzureService and verify with Get-AzureService + vmPowershellCmdlets.NewAzureService(serviceName, serviceName, locationName); + Assert.IsTrue(Verify.AzureService(serviceName, serviceName, locationName)); + + // New-AzureVMConfig + var vmName = Utilities.GetUniqueShortName(vmNamePrefix); + var vmSize = vmPowershellCmdlets.GetAzureRoleSize().Where(t => t.MaxDataDiskCount != null && t.MaxDataDiskCount >= vmImage.DataDiskConfigurations.Count()).Select(t => t.InstanceSize).First(); + var currentStorage = vmPowershellCmdlets.GetAzureStorageAccount(defaultAzureSubscription.CurrentStorageAccountName).First(); + var mediaLocationStr = ("mloc" + vmName).ToLower(); + var vmMediaLocation = currentStorage.Endpoints.Where(p => p.Contains("blob")).First() + mediaLocationStr; + var azureVMConfigInfo = new AzureVMConfigInfo(vmName, vmSize, vmImage.ImageName, vmMediaLocation); + PersistentVM vm = vmPowershellCmdlets.NewAzureVMConfig(azureVMConfigInfo); + + // Add-AzureProvisioningConfig + AzureProvisioningConfigInfo azureProvisioningConfig = new AzureProvisioningConfigInfo(OS.Windows, username, password, true); + azureProvisioningConfig.Vm = vm; + vm = vmPowershellCmdlets.AddAzureProvisioningConfig(azureProvisioningConfig); + + // New-AzureVM + vmPowershellCmdlets.NewAzureVM(serviceName, new[] { vm }, null, null, null, null, null, null); + pass = true; + + // Get-AzureVM + var returnedVM = vmPowershellCmdlets.GetAzureVM(vmName, serviceName); + Assert.IsTrue(returnedVM.VM.DataVirtualHardDisks != null && returnedVM.VM.DataVirtualHardDisks.Count() == vmImage.DataDiskConfigurations.Count()); + Assert.IsTrue(returnedVM.VM.DataVirtualHardDisks.All(t => t.MediaLink.ToString().StartsWith(vmMediaLocation))); + + // Remove-AzureVM + vmPowershellCmdlets.RemoveAzureVM(vmName, serviceName); + + // Remove-AzureService + vmPowershellCmdlets.RemoveAzureService(serviceName, true); + + pass = true; + } + catch (Exception e) + { + Console.WriteLine(e.ToString()); + throw; + } + } + private void UpdateVmImageUsingDiskConfigSetAndVerifyChanges(DataDiskConfigurationList diskConfig, string disk1Name, string disk2Name) { cahcing = GetAlternateHostCachingForOsDisk(cahcing.ToString()); diff --git a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVM.cs b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVM.cs index 18678c8dc634..0309e3fd0553 100644 --- a/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVM.cs +++ b/src/ServiceManagement/Compute/Commands.ServiceManagement/IaaS/PersistentVMs/NewAzureVM.cs @@ -278,7 +278,7 @@ public void NewAzureVMProcess() Label = this.DeploymentLabel ?? this.ServiceName, VirtualNetworkName = this.VNetName, Roles = { persistentVMs[0] }, - ReservedIPName = ReservedIPName, + ReservedIPName = ReservedIPName }; if (this.DnsSettings != null) @@ -367,7 +367,8 @@ public void NewAzureVMProcess() RoleSize = persistentVMs[i].RoleSize, ProvisionGuestAgent = persistentVMs[i].ProvisionGuestAgent, ResourceExtensionReferences = persistentVMs[i].ProvisionGuestAgent != null && persistentVMs[i].ProvisionGuestAgent.Value ? persistentVMs[i].ResourceExtensionReferences : null, - VMImageName = VMTuples[i].Item3 ? persistentVMs[i].VMImageName : null + VMImageName = VMTuples[i].Item3 ? persistentVMs[i].VMImageName : null, + MediaLocation = VMTuples[i].Item3 ? persistentVMs[i].MediaLocation : null }; if (parameter.OSVirtualHardDisk != null) @@ -428,7 +429,8 @@ private Management.Compute.Models.Role CreatePersistentVMRole(Tuple>(persistentVM.ResourceExtensionReferences) : null, - VMImageName = isVMImage ? persistentVM.OSVirtualHardDisk.SourceImageName : null + VMImageName = isVMImage ? persistentVM.OSVirtualHardDisk.SourceImageName : null, + MediaLocation = isVMImage ? persistentVM.OSVirtualHardDisk.MediaLink : null }; if (result.OSVirtualHardDisk != null) From 20efd59bb07dfe5ef1e6fe8cea85d29bebe8edae Mon Sep 17 00:00:00 2001 From: huangpf Date: Wed, 14 Jan 2015 16:44:53 -0800 Subject: [PATCH 13/13] fix --- .../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 d2ea7e7a0363..1ac1693a8c9d 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() pass &= Utilities.PrintAndCompareDeployment(result, serviceName, deploymentName, serviceName, DeploymentSlotType.Production, null, 4); Console.WriteLine("successfully updated the deployment"); - var date = new DateTime(2014, 10, 17); + var date = DateTime.Now.AddMonths(-1); // Get Deployment Events by Name var events = vmPowershellCmdlets.GetAzureDeploymentEvent(serviceName, deploymentName, date, date.AddHours(1)); Assert.IsTrue(!events.Any() || events.All(e => e.DeploymentName == deploymentName