Skip to content

Commit e3c07ec

Browse files
committed
Merge pull request #58 from Azure/dev
.
2 parents 118a1a5 + 0ea0dcf commit e3c07ec

File tree

129 files changed

+16989
-22
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+16989
-22
lines changed

setup/azurecmdfiles.wxi

Lines changed: 380 additions & 0 deletions
Large diffs are not rendered by default.

src/AzurePowershell.sln

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ScenarioTest", "Co
2828
ProjectSection(ProjectDependencies) = postProject
2929
{CD5AA507-F5EF-473D-855B-84B91A1ABE54} = {CD5AA507-F5EF-473D-855B-84B91A1ABE54}
3030
{DDF5D225-C9C5-42B7-BDB5-2C3646E479AA} = {DDF5D225-C9C5-42B7-BDB5-2C3646E479AA}
31+
{E895BBDA-0B06-46AB-B909-9B97B3ECE47E} = {E895BBDA-0B06-46AB-B909-9B97B3ECE47E}
3132
EndProjectSection
3233
EndProject
3334
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ServiceManagement", "ServiceManagement\Compute\Commands.ServiceManagement\Commands.ServiceManagement.csproj", "{E1CA72BA-8374-45F6-904D-FD34ECDF5B6F}"
@@ -577,6 +578,7 @@ Global
577578
HideSolutionNode = FALSE
578579
EndGlobalSection
579580
GlobalSection(NestedProjects) = preSolution
581+
{B7FD03F6-98BC-4F54-9A14-0455E579FCD4} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
580582
{37455286-D8A7-4E0C-8B4D-C517D20C641A} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
581583
{D6F470A6-7395-4B8B-9D29-44DF0EC8F624} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
582584
{A3965B66-5A3E-4B8C-9574-28E5958D4828} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
@@ -587,7 +589,6 @@ Global
587589
{4BC0E3D3-6EDD-43AA-8F15-DCFED8ACC93D} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
588590
{9D5A40CA-5594-4F5C-8230-7ADF7CC0558E} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
589591
{3B48A77B-5956-4A62-9081-92BA04B02B27} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
590-
{B7FD03F6-98BC-4F54-9A14-0455E579FCD4} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
591592
{4C2FE49A-09E1-4979-AD46-CD64FD04C8F7} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
592593
{374D4000-DEDE-4995-9B63-E3B9FE0C4D29} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
593594
{127D0D51-FDEA-4E1A-8CD8-34DEB5C2F7F6} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}

src/Common/Commands.ScenarioTest/Commands.ScenarioTest.csproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,18 @@
206206
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.AutomationTests\TestAutomationSuspendAndResumeJob.json">
207207
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
208208
</None>
209+
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests\RunAutoGeneratedHostedServiceCmdletTests.json">
210+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
211+
</None>
212+
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests\RunAutoGeneratedVirtualMachineCmdletTests.json">
213+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
214+
</None>
215+
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests\RunNewAzureComputeArgumentListTests.json">
216+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
217+
</None>
218+
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests\RunNewAzureComputeParameterObjectTests.json">
219+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
220+
</None>
209221
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests\RunServiceManagementCloudExceptionTests.json">
210222
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
211223
</None>

src/Common/Commands.ScenarioTest/Resources/ServiceManagement/ServiceManagementTests.ps1

Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,217 @@ function Run-StartAndStopMultipleVirtualMachinesTest
129129
# Cleanup
130130
Cleanup-CloudService $svcName;
131131
}
132+
}
133+
134+
# Run Auto-Generated Hosted Service Cmdlet Tests
135+
function Run-AutoGeneratedHostedServiceCmdletTests
136+
{
137+
# Setup
138+
$location = Get-DefaultLocation;
139+
$imgName = Get-DefaultImage $location;
140+
141+
$storageName = 'pstest' + (getAssetName);
142+
New-AzureStorageAccount -StorageAccountName $storageName -Location $location;
143+
144+
# Associate the new storage account with the current subscription
145+
Set-CurrentStorageAccountName $storageName;
146+
147+
$vmNameList = @("vm01", "vm02", "test04");
148+
$svcName = 'pstest' + (Get-CloudServiceName);
149+
$userName = "pstestuser";
150+
$password = "p@ssw0rd";
151+
152+
try
153+
{
154+
# Create Parameters
155+
$svcCreateParams = New-AzureComputeParameterObject -FriendlyName 'HostedServiceCreateParameters';
156+
$svcCreateParams.ServiceName = $svcName;
157+
$svcCreateParams.Location = $location;
158+
$svcCreateParams.Description = $svcName;
159+
$svcCreateParams.Label = $svcName;
160+
161+
# Invoke Create
162+
$st = Invoke-AzureComputeMethod -MethodName 'HostedServiceCreate' -HostedServiceCreateParameters $svcCreateParams;
163+
164+
Assert-AreEqual $st.StatusCode 'Created';
165+
Assert-NotNull $st.RequestId;
166+
167+
# Invoke Get
168+
$svcGetResult = Invoke-AzureComputeMethod -MethodName 'HostedServiceGet' -ServiceName $svcName;
169+
Assert-AreEqual $svcGetResult.ServiceName $svcName;
170+
Assert-AreEqual $svcGetResult.Properties.Description $svcName;
171+
Assert-AreEqual $svcGetResult.Properties.Label $svcName;
172+
173+
# Update Parameters
174+
$svcUpdateParams = New-AzureComputeParameterObject -FriendlyName 'HostedServiceUpdateParameters';
175+
$svcUpdateParams.Description = 'update1';
176+
$svcUpdateParams.Label = 'update2';
177+
178+
# Invoke Update
179+
$svcGetResult2 = Invoke-AzureComputeMethod -MethodName 'HostedServiceUpdate' -ServiceName $svcName -HostedServiceUpdateParameters $svcUpdateParams;
180+
181+
# Invoke Get
182+
$svcGetResult2 = Invoke-AzureComputeMethod -MethodName 'HostedServiceGet' -ServiceName $svcName;
183+
Assert-AreEqual $svcGetResult2.ServiceName $svcName;
184+
Assert-AreEqual $svcGetResult2.Properties.Description $svcUpdateParams.Description;
185+
Assert-AreEqual $svcGetResult2.Properties.Label $svcUpdateParams.Label;
186+
187+
# Invoke List
188+
$svcListResult = Invoke-AzureComputeMethod -MethodName 'HostedServiceList';
189+
Assert-True { ($svcListResult | where { $_.ServiceName -eq $svcName }).Count -gt 0 };
190+
191+
# Invoke Delete
192+
$st = Invoke-AzureComputeMethod -MethodName 'HostedServiceDelete' -ServiceName $svcName;
193+
Assert-AreEqual $st.StatusCode 'OK';
194+
Assert-NotNull $st.RequestId;
195+
}
196+
finally
197+
{
198+
# Cleanup
199+
Cleanup-CloudService $svcName;
200+
}
201+
}
202+
203+
# Run Auto-Generated Virtual Machine Cmdlet Tests
204+
function Run-AutoGeneratedVirtualMachineCmdletTests
205+
{
206+
# Setup
207+
$location = Get-DefaultLocation;
208+
209+
$storageName = 'pstest' + (getAssetName);
210+
New-AzureStorageAccount -StorageAccountName $storageName -Location $location;
211+
212+
# Associate the new storage account with the current subscription
213+
Set-CurrentStorageAccountName $storageName;
214+
215+
$svcName = 'pstest' + (Get-CloudServiceName);
216+
$userName = "pstestuser";
217+
$password = "p@ssw0rd";
218+
219+
try
220+
{
221+
# Create Hosted Service Parameters
222+
$svcCreateParams = New-AzureComputeParameterObject -FriendlyName 'HostedServiceCreateParameters';
223+
$svcCreateParams.ServiceName = $svcName;
224+
$svcCreateParams.Location = $location;
225+
$svcCreateParams.Description = $svcName;
226+
$svcCreateParams.Label = $svcName;
227+
228+
# Invoke Hosted Service Create
229+
$st = Invoke-AzureComputeMethod -MethodName 'HostedServiceCreate' -ArgumentList $svcCreateParams;
230+
Assert-AreEqual $st.StatusCode 'Created';
231+
Assert-NotNull $st.RequestId;
232+
233+
# Invoke Hosted Service Get
234+
$svcGetResult = Invoke-AzureComputeMethod -MethodName 'HostedServiceGet' -ArgumentList $svcName;
235+
Assert-AreEqual $svcGetResult.ServiceName $svcName;
236+
Assert-AreEqual $svcGetResult.Properties.Description $svcName;
237+
Assert-AreEqual $svcGetResult.Properties.Label $svcName;
238+
239+
# Invoke Virtual Machine OS Image List
240+
$images = (Invoke-AzureComputeMethod -MethodName 'VirtualMachineOSImageList').Images;
241+
$image = $images | where { $_.OperatingSystemType -eq 'Windows' -and $_.LogicalSizeInGB -le 100 } | select -First 1;
242+
243+
# Create Virtual Machine Deployment Create Parameters
244+
$vmDeployment = New-AzureComputeParameterObject -FriendlyName 'VirtualMachineCreateDeploymentParameters';
245+
$vmDeployment.Name = $svcName;
246+
$vmDeployment.Label = $svcName;
247+
$vmDeployment.DeploymentSlot = 'Production';
248+
$vmDeployment.Roles = New-AzureComputeParameterObject -FriendlyName 'VirtualMachineRoleList';
249+
$vmDeployment.Roles.Add((New-AzureComputeParameterObject -FriendlyName 'VirtualMachineRole'));
250+
$vmDeployment.Roles[0].RoleName = $svcName;
251+
$vmDeployment.Roles[0].RoleSize = 'Large';
252+
$vmDeployment.Roles[0].RoleType = 'PersistentVMRole';
253+
$vmDeployment.Roles[0].ProvisionGuestAgent = $false;
254+
$vmDeployment.Roles[0].ResourceExtensionReferences = $null;
255+
$vmDeployment.Roles[0].DataVirtualHardDisks = $null;
256+
$vmDeployment.Roles[0].OSVirtualHardDisk = New-AzureComputeParameterObject -FriendlyName 'VirtualMachineOSVirtualHardDisk';
257+
$vmDeployment.Roles[0].OSVirtualHardDisk.SourceImageName = $image.Name;
258+
$vmDeployment.Roles[0].OSVirtualHardDisk.MediaLink = "http://${storageName}.blob.core.windows.net/myvhds/${svcName}.vhd";
259+
$vmDeployment.Roles[0].OSVirtualHardDisk.ResizedSizeInGB = 128;
260+
$vmDeployment.Roles[0].OSVirtualHardDisk.HostCaching = 'ReadWrite';
261+
$vmDeployment.Roles[0].ConfigurationSets = New-AzureComputeParameterObject -FriendlyName 'VirtualMachineConfigurationSetList';
262+
$vmDeployment.Roles[0].ConfigurationSets.Add((New-AzureComputeParameterObject -FriendlyName 'VirtualMachineConfigurationSet'));
263+
$vmDeployment.Roles[0].ConfigurationSets[0].ConfigurationSetType = "WindowsProvisioningConfiguration";
264+
$vmDeployment.Roles[0].ConfigurationSets[0].AdminUserName = $userName;
265+
$vmDeployment.Roles[0].ConfigurationSets[0].AdminPassword = $password;
266+
$vmDeployment.Roles[0].ConfigurationSets[0].ComputerName = 'test';
267+
$vmDeployment.Roles[0].ConfigurationSets[0].HostName = "${svcName}.cloudapp.net";
268+
$vmDeployment.Roles[0].ConfigurationSets[0].EnableAutomaticUpdates = $false;
269+
$vmDeployment.Roles[0].ConfigurationSets[0].TimeZone = "Pacific Standard Time";
270+
271+
# Invoke Virtual Machine Create Deployment
272+
$st = Invoke-AzureComputeMethod -MethodName 'VirtualMachineCreateDeployment' -ArgumentList $svcName,$vmDeployment;
273+
Assert-AreEqual $st.StatusCode 'OK';
274+
Assert-NotNull $st.RequestId;
275+
276+
# Invoke Virtual Machine Get
277+
$st = Invoke-AzureComputeMethod -MethodName 'VirtualMachineGet' -ArgumentList $svcName,$svcName,$svcName;
278+
Assert-AreEqual $st.RoleName $svcName;
279+
280+
# Invoke Hosted Service Delete
281+
$st = Invoke-AzureComputeMethod -MethodName 'HostedServiceDeleteAll' -ArgumentList $svcName;
282+
Assert-AreEqual $st.StatusCode 'OK';
283+
Assert-NotNull $st.RequestId;
284+
}
285+
finally
286+
{
287+
# Cleanup
288+
Cleanup-CloudService $svcName;
289+
}
290+
}
291+
292+
293+
# Run New-AzureComputeArgumentList Cmdlet Tests Using Method Names
294+
function Run-NewAzureComputeArgumentListTests
295+
{
296+
$command = Get-Command -Name 'New-AzureComputeArgumentList';
297+
$all_methods = $command.Parameters['MethodName'].Attributes.ValidValues;
298+
299+
foreach ($method in $all_methods)
300+
{
301+
$args = New-AzureComputeArgumentList -MethodName $method;
302+
foreach ($arg in $args)
303+
{
304+
Assert-NotNull $arg;
305+
}
306+
307+
Write-Verbose "Invoke-AzureComputeMethod -MethodName $method -ArgumentList $args;";
308+
309+
if ($args.Count -gt 0)
310+
{
311+
# If the method requires any inputs, empty/null input call would fail
312+
Assert-Throws { Invoke-AzureComputeMethod -MethodName $method -ArgumentList $args; }
313+
}
314+
else
315+
{
316+
# If the method doesn't requires any inputs, it shall succeed.
317+
$st = Invoke-AzureComputeMethod -MethodName $method;
318+
}
319+
}
320+
}
321+
322+
323+
# Run New-AzureComputeParameterObject Cmdlet Tests
324+
function Run-NewAzureComputeParameterObjectTests
325+
{
326+
$command = Get-Command -Name 'New-AzureComputeParameterObject';
327+
328+
$all_friendly_names = $command.Parameters['FriendlyName'].Attributes.ValidValues;
329+
foreach ($friendly_name in $all_friendly_names)
330+
{
331+
$param = New-AzureComputeParameterObject -FriendlyName $friendly_name;
332+
Assert-NotNull $param;
333+
}
334+
335+
$all_full_names = $command.Parameters['FullName'].Attributes.ValidValues;
336+
foreach ($full_name in $all_full_names)
337+
{
338+
$param = New-AzureComputeParameterObject -FullName $full_name;
339+
Assert-NotNull $param;
340+
341+
$param_type_name = $param.GetType().ToString().Replace('+', '.');
342+
$full_name_query = $full_name.Replace('+', '.').Replace('<', '*').Replace('>', '*');
343+
Assert-True { $param_type_name -like $full_name_query } "`'$param_type_name`' & `'$full_name`'";
344+
}
132345
}

src/Common/Commands.ScenarioTest/ServiceManagement/ScenarioTests.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,41 @@ public void RunStartAndStopMultipleVirtualMachinesTest()
5353
{
5454
this.RunPowerShellTest("Run-StartAndStopMultipleVirtualMachinesTest");
5555
}
56+
57+
[Fact]
58+
[Trait(Category.Service, Category.ServiceManagement)]
59+
[Trait(Category.AcceptanceType, Category.CheckIn)]
60+
[Trait(Category.AcceptanceType, Category.BVT)]
61+
public void RunAutoGeneratedHostedServiceCmdletTests()
62+
{
63+
this.RunPowerShellTest("Run-AutoGeneratedHostedServiceCmdletTests");
64+
}
65+
66+
[Fact]
67+
[Trait(Category.Service, Category.ServiceManagement)]
68+
[Trait(Category.AcceptanceType, Category.CheckIn)]
69+
[Trait(Category.AcceptanceType, Category.BVT)]
70+
public void RunAutoGeneratedVirtualMachineCmdletTests()
71+
{
72+
this.RunPowerShellTest("Run-AutoGeneratedVirtualMachineCmdletTests");
73+
}
74+
75+
[Fact]
76+
[Trait(Category.Service, Category.ServiceManagement)]
77+
[Trait(Category.AcceptanceType, Category.CheckIn)]
78+
[Trait(Category.AcceptanceType, Category.BVT)]
79+
public void RunNewAzureComputeArgumentListTests()
80+
{
81+
this.RunPowerShellTest("Run-NewAzureComputeArgumentListTests");
82+
}
83+
84+
[Fact]
85+
[Trait(Category.Service, Category.ServiceManagement)]
86+
[Trait(Category.AcceptanceType, Category.CheckIn)]
87+
[Trait(Category.AcceptanceType, Category.BVT)]
88+
public void RunNewAzureComputeParameterObjectTests()
89+
{
90+
this.RunPowerShellTest("Run-NewAzureComputeParameterObjectTests");
91+
}
5692
}
5793
}

src/Common/Commands.ScenarioTest/ServiceManagement/ServiceManagementTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ protected void RunPowerShellTest(params string[] scripts)
5454
List<string> modules = Directory.GetFiles(@"Resources\ServiceManagement", "*.ps1").ToList();
5555
modules.Add("Common.ps1");
5656
modules.Add(@"..\..\..\..\Package\Debug\ServiceManagement\Azure\Azure.psd1");
57+
modules.Add(@"..\..\..\..\Package\Debug\ServiceManagement\Azure\Compute\AzurePreview.psd1");
5758

5859
helper.SetupEnvironment(AzureModule.AzureServiceManagement);
5960
helper.SetupModules(modules.ToArray());

src/Common/Commands.ScenarioTest/SessionRecords/Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests/RunAutoGeneratedHostedServiceCmdletTests.json

Lines changed: 954 additions & 0 deletions
Large diffs are not rendered by default.

src/Common/Commands.ScenarioTest/SessionRecords/Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests/RunAutoGeneratedVirtualMachineCmdletTests.json

Lines changed: 802 additions & 0 deletions
Large diffs are not rendered by default.

src/Common/Commands.ScenarioTest/SessionRecords/Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests/RunNewAzureComputeArgumentListTests.json

Lines changed: 360 additions & 0 deletions
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"Entries": [],
3+
"Names": {},
4+
"Variables": {
5+
"SubscriptionId": "4d368445-cbb1-42a7-97a6-6850ab99f48e"
6+
}
7+
}

src/ResourceManager/Automation/Commands.Automation.Test/Commands.ResourceManagement.Automation.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<ProductVersion>
77
</ProductVersion>
88
<SchemaVersion>2.0</SchemaVersion>
9-
<ProjectGuid>{127D0D51-FDEA-4E1A-8CD8-34DEB5C2F7F6}</ProjectGuid>
9+
<ProjectGuid>{59D1B5DC-9175-43EC-90C6-CBA601B3565F}</ProjectGuid>
1010
<OutputType>Library</OutputType>
1111
<AppDesignerFolder>Properties</AppDesignerFolder>
1212
<RootNamespace>Microsoft.Azure.Commands.ResourceManager.Automation.Test</RootNamespace>

src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Config/AddAzureVMDataDiskCommand.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public class AddAzureVMDataDiskCommand : AzurePSCmdlet
6868
Position = 4,
6969
ValueFromPipelineByPropertyName = true,
7070
HelpMessage = HelpMessages.VMDataDiskSizeInGB)]
71+
[AllowNull]
7172
public int? DiskSizeInGB { get; set; }
7273

7374
[Parameter(

0 commit comments

Comments
 (0)