Skip to content

Commit

Permalink
Fix a null reference exception with extensible template deployment (A…
Browse files Browse the repository at this point in the history
…zure#19783)

* Add symbolic name test

* Add extensibility test, fix null ref bug

* Add changelog entry

* Update ChangeLog.md

Co-authored-by: Yabo Hu <yabhu@microsoft.com>
  • Loading branch information
anthony-c-martin and VeryEarly authored Oct 14, 2022
1 parent 2fb0fcc commit f003a89
Show file tree
Hide file tree
Showing 9 changed files with 456,304 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ private List<DeploymentOperation> GetNewOperations(List<DeploymentOperation> old
}

//If nested deployment, get the operations under those deployments as well
if (operation.Properties.TargetResource != null && operation.Properties.TargetResource.ResourceType.Equals(Constants.MicrosoftResourcesDeploymentType, StringComparison.OrdinalIgnoreCase))
if (operation.Properties.TargetResource?.ResourceType?.Equals(Constants.MicrosoftResourcesDeploymentType, StringComparison.OrdinalIgnoreCase) == true)
{
HttpStatusCode statusCode;
Enum.TryParse<HttpStatusCode>(operation.Properties.StatusCode, out statusCode);
Expand Down
14 changes: 14 additions & 0 deletions src/Resources/Resources.Test/ScenarioTests/DeploymentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,19 @@ public void TestNewDeploymentFromTemplateAndParameterFileContainingTagsOutput()
{
TestRunner.RunTestScript("Test-NewDeploymentFromTemplateAndParameterFileContainingTagsOutput");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestSymbolicNameDeployment()
{
TestRunner.RunTestScript("Test-SymbolicNameDeployment");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestExtensibleResourceDeployment()
{
TestRunner.RunTestScript("Test-ExtensibleResourceDeployment");
}
}
}
Loading

0 comments on commit f003a89

Please sign in to comment.