Skip to content

Commit 435aa93

Browse files
committed
update
1 parent 5649cd2 commit 435aa93

File tree

1 file changed

+14
-3
lines changed
  • src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests

1 file changed

+14
-3
lines changed

src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/FunctionalTest.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,22 +1690,33 @@ public void AzurePlatformVMImageNegativeTest()
16901690
{
16911691
StartTest(MethodBase.GetCurrentMethod().Name, testStartTime);
16921692

1693+
var imgName = Utilities.GetUniqueShortName("img");
1694+
16931695
try
16941696
{
16951697
var scripts = new string[]
16961698
{
16971699
"Import-Module '.\\" + Utilities.AzurePowershellModuleServiceManagementPirModule + "';",
16981700
"$c1 = New-AzurePlatformComputeImageConfig -Offer test -Sku test -Version test;",
16991701
"$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;"
17011703
};
17021704

17031705
vmPowershellCmdlets.RunPSScript(string.Join(System.Environment.NewLine, scripts), true);
17041706
}
17051707
catch (Exception e)
17061708
{
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+
}
17091720
}
17101721
}
17111722
}

0 commit comments

Comments
 (0)