File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -1690,22 +1690,33 @@ public void AzurePlatformVMImageNegativeTest()
1690
1690
{
1691
1691
StartTest ( MethodBase . GetCurrentMethod ( ) . Name , testStartTime ) ;
1692
1692
1693
+ var imgName = Utilities . GetUniqueShortName ( "img" ) ;
1694
+
1693
1695
try
1694
1696
{
1695
1697
var scripts = new string [ ]
1696
1698
{
1697
1699
"Import-Module '.\\ " + Utilities . AzurePowershellModuleServiceManagementPirModule + "';" ,
1698
1700
"$c1 = New-AzurePlatformComputeImageConfig -Offer test -Sku test -Version test;" ,
1699
1701
"$c2 = New-AzurePlatformMarketplaceImageConfig -PlanName test -Product test -Publisher test -PublisherId test;" ,
1700
- "Set-AzurePlatformVMImage -ImageName test -ReplicaLocations 'West US' -ComputeImageConfig $c1 -MarketplaceImageConfig $c2;"
1702
+ "Set-AzurePlatformVMImage -ImageName " + imgName + " -ReplicaLocations 'West US' -ComputeImageConfig $c1 -MarketplaceImageConfig $c2;"
1701
1703
} ;
1702
1704
1703
1705
vmPowershellCmdlets . RunPSScript ( string . Join ( System . Environment . NewLine , scripts ) , true ) ;
1704
1706
}
1705
1707
catch ( Exception e )
1706
1708
{
1707
- pass = true ;
1708
- Console . WriteLine ( e . ToString ( ) ) ;
1709
+ var expectedMsg = "ResourceNotFound: The image with the specified name does not exist." ;
1710
+ if ( e . InnerException != null && e . InnerException . Message != null && e . InnerException . Message . Contains ( expectedMsg ) )
1711
+ {
1712
+ pass = true ;
1713
+ Console . WriteLine ( e . InnerException . ToString ( ) ) ;
1714
+ }
1715
+ else
1716
+ {
1717
+ pass = false ;
1718
+ Assert . Fail ( "Exception occurred: {0}" , e . ToString ( ) ) ;
1719
+ }
1709
1720
}
1710
1721
}
1711
1722
}
You can’t perform that action at this time.
0 commit comments