Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Common/Commands.ScenarioTest/Commands.ScenarioTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests\RunAutoGeneratedVirtualMachineCmdletTests.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests\RunAzurePlatformVMImageNegativeTest.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.ScenarioTest.ServiceManagementTests\RunNewAzureComputeArgumentListTests.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,4 +342,25 @@ function Run-NewAzureComputeParameterObjectTests
$full_name_query = $full_name.Replace('+', '.').Replace('<', '*').Replace('>', '*');
Assert-True { $param_type_name -like $full_name_query } "`'$param_type_name`' & `'$full_name`'";
}
}

function Run-AzurePlatformVMImageNegativeTest
{
$location = Get-DefaultLocation;
$imgName = Get-DefaultImage $location;
$replicate_locations = (Get-AzureLocation | where { $_.Name -like '*US*' } | select -ExpandProperty Name);

$c1 = New-AzurePlatformComputeImageConfig -Offer test -Sku test -Version test;
$c2 = New-AzurePlatformMarketplaceImageConfig -PlanName test -Product test -Publisher test -PublisherId test;

Assert-ThrowsContains `
{ Set-AzurePlatformVMImage -ImageName $imgName -ReplicaLocations $replicate_locations -ComputeImageConfig $c1 -MarketplaceImageConfig $c2 } `
"ForbiddenError: This operation is not allowed for this subscription.";

foreach ($mode in @("MSDN", "Private", "Public"))
{
Assert-ThrowsContains `
{ Set-AzurePlatformVMImage -ImageName $imgName -Permission $mode } `
"ForbiddenError: This operation is not allowed for this subscription.";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,14 @@ public void RunNewAzureComputeParameterObjectTests()
{
this.RunPowerShellTest("Run-NewAzureComputeParameterObjectTests");
}

[Fact]
[Trait(Category.Service, Category.ServiceManagement)]
[Trait(Category.AcceptanceType, Category.CheckIn)]
[Trait(Category.AcceptanceType, Category.BVT)]
public void RunAzurePlatformVMImageNegativeTest()
{
this.RunPowerShellTest("Run-AzurePlatformVMImageNegativeTest");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ protected void RunPowerShellTest(params string[] scripts)
modules.Add("Common.ps1");
modules.Add(@"..\..\..\..\Package\Debug\ServiceManagement\Azure\Azure.psd1");
modules.Add(@"..\..\..\..\Package\Debug\ServiceManagement\Azure\Compute\AzurePreview.psd1");
modules.Add(@"..\..\..\..\Package\Debug\ServiceManagement\Azure\Compute\PIR.psd1");

helper.SetupEnvironment(AzureModule.AzureServiceManagement);
helper.SetupModules(modules.ToArray());
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ function Test-VirtualMachineProfile

$p = Add-AzureVMDataDisk -VM $p -Name 'testDataDisk1' -Caching 'ReadOnly' -DiskSizeInGB 10 -Lun 0 -VhdUri $dataDiskVhdUri1 -CreateOption Empty;
$p = Add-AzureVMDataDisk -VM $p -Name 'testDataDisk2' -Caching 'ReadOnly' -DiskSizeInGB 11 -Lun 1 -VhdUri $dataDiskVhdUri2 -CreateOption Empty;
$p = Add-AzureVMDataDisk -VM $p -Name 'testDataDisk3' -Caching 'ReadOnly' -DiskSizeInGB 12 -Lun 2 -VhdUri $dataDiskVhdUri3 -CreateOption Empty;
$p = Add-AzureVMDataDisk -VM $p -Name 'testDataDisk3' -Caching 'ReadOnly' -DiskSizeInGB $null -Lun 2 -VhdUri $dataDiskVhdUri3 -CreateOption Empty;
Assert-Null $p.StorageProfile.DataDisks[2].DiskSizeGB;
$p = Remove-AzureVMDataDisk -VM $p -Name 'testDataDisk3';

Assert-AreEqual $p.StorageProfile.OSDisk.Caching $osDiskCaching;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class SetAzurePlatformVMImage : ServiceManagementBaseCmdlet
public string[] ReplicaLocations { get; set; }

[Parameter(Position = 1, Mandatory = true, ParameterSetName = ShareParameterSetName, ValueFromPipelineByPropertyName = true, HelpMessage = "Specifies the sharing permission of replicated image.")]
[ValidateSet("Public", "Private")]
[ValidateSet("Public", "Private", "MSDN")]
public string Permission { get; set; }

[Parameter(Mandatory = true, ParameterSetName = ReplicateParameterSetName), ValidateNotNullOrEmpty]
Expand Down