Skip to content

Commit

Permalink
feat(estimation): Added support for P0V3 premium plan
Browse files Browse the repository at this point in the history
Closes #269
  • Loading branch information
kamil-mrzyglod committed Aug 23, 2024
1 parent 03c82e6 commit d4ac18f
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 0 deletions.
37 changes: 37 additions & 0 deletions ace-tests/Reworked/AppService/AppServiceTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

namespace ACE_Tests.Reworked.AppService;

[Parallelizable(ParallelScope.Self)]
public class AppServiceTests
{
[Test]
[TestCase("F1", 0.00d)]
[TestCase("P0V3", 64.97d)]
public void AppService_Sku_WhenAppServicePlanWithGivenSKUIsUsed_ItShouldBeSupported(string sku, double cost)
{
var outputFilename = $"ace_test_{DateTime.Now.Ticks}";
var exitCode = Program.Main([
"templates/reworked/app-service/skus.bicep",
"cf70b558-b930-45e4-9048-ebcefb926adf",
"arm-estimator-tests-rg",
"--generateJsonOutput",
"--jsonOutputFilename",
outputFilename,
"--debug",
"--inline",
$"paramSkuName={sku}",
]);

Assert.That(exitCode, Is.EqualTo(0));

var outputFile = File.ReadAllText($"{outputFilename}.json");
var output = JsonSerializer.Deserialize<EstimationOutput>(outputFile, Shared.JsonSerializerOptions);

Assert.That(output, Is.Not.Null);
Assert.Multiple(() =>
{
Assert.That(output.TotalCost.OriginalValue, Is.EqualTo(cost));
Assert.That(output.TotalResourceCount, Is.EqualTo(2));
});
}
}
1 change: 1 addition & 0 deletions ace-tests/azure-cost-estimator-tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<None Remove="mocked-responses\retail-api\asr\inferred-2.json" />
<None Remove="mocked-responses\retail-api\asr\inferred-3.json" />
<None Remove="mocked-responses\retail-api\automation-account\usage-patterns.json" />
<None Remove="templates/reworked/app-service/skus.bicep" />
<None Remove="templates/reworked/key-vault/usage-patterns-1.bicep" />
<None Remove="templates/reworked/postgresql/fix-261.bicep" />
<None Remove="templates/reworked/static-web-app/static-web-app-free.bicep" />
Expand Down
20 changes: 20 additions & 0 deletions ace-tests/templates/reworked/app-service/skus.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
param paramSkuName string = 'F1'

resource appserviceplan 'Microsoft.Web/serverfarms@2023-12-01' = {
name: 'myAppServicePlan'
location: resourceGroup().location
sku: {
name: paramSkuName
}
properties: {
reserved: true
}
}

resource webapp 'Microsoft.Web/sites@2023-12-01' = {
name: 'myWebApp'
location: resourceGroup().location
properties: {
serverFarmId: appserviceplan.id
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public TotalCostSummary GetTotalCost(WhatIfChange[] changes, IDictionary<string,
|| item.meterName == "P1 v2 App"
|| item.meterName == "P2 v2 App"
|| item.meterName == "P3 v2 App"
|| item.meterName == "P0v3 App"
|| item.meterName == "P1 v3 App"
|| item.meterName == "P2 v3 App"
|| item.meterName == "P3 v3 App"
Expand Down
16 changes: 16 additions & 0 deletions ace/Products/AppService/AppServicePlanSupportedData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
{ "P1V2", "DZH317GT8G5N" },
{ "P2V2", "DZH317GT8G5N" },
{ "P3V2", "DZH317GT8G5N" },
{ "P0V3", "DZH317GT8G5N" },
{ "P1V3", "DZH317GT8G5N" },
{ "P2V3", "DZH317GT8G5N" },
{ "P3V3", "DZH317GT8G5N" },
Expand Down Expand Up @@ -87,6 +88,9 @@
{ "P3V2",
"P3 v2"
},
{ "P0V3",
"P0v3"
},
{ "P1V3",
"P1 v3"
},
Expand Down Expand Up @@ -193,6 +197,12 @@
"Azure App Service Premium v2 Plan"
}
},
{
"P0V3", new[]
{
"Azure App Service Premium v3 Plan"
}
},
{
"P1V3", new[]
{
Expand Down Expand Up @@ -317,6 +327,12 @@
"Azure App Service Premium v2 Plan - Linux"
}
},
{
"P0V3", new[]
{
"Azure App Service Premium v3 Plan - Linux"
}
},
{
"P1V3", new[]
{
Expand Down

0 comments on commit d4ac18f

Please sign in to comment.