Skip to content

Commit d4ac18f

Browse files
feat(estimation): Added support for P0V3 premium plan
Closes #269
1 parent 03c82e6 commit d4ac18f

File tree

5 files changed

+75
-0
lines changed

5 files changed

+75
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
namespace ACE_Tests.Reworked.AppService;
3+
4+
[Parallelizable(ParallelScope.Self)]
5+
public class AppServiceTests
6+
{
7+
[Test]
8+
[TestCase("F1", 0.00d)]
9+
[TestCase("P0V3", 64.97d)]
10+
public void AppService_Sku_WhenAppServicePlanWithGivenSKUIsUsed_ItShouldBeSupported(string sku, double cost)
11+
{
12+
var outputFilename = $"ace_test_{DateTime.Now.Ticks}";
13+
var exitCode = Program.Main([
14+
"templates/reworked/app-service/skus.bicep",
15+
"cf70b558-b930-45e4-9048-ebcefb926adf",
16+
"arm-estimator-tests-rg",
17+
"--generateJsonOutput",
18+
"--jsonOutputFilename",
19+
outputFilename,
20+
"--debug",
21+
"--inline",
22+
$"paramSkuName={sku}",
23+
]);
24+
25+
Assert.That(exitCode, Is.EqualTo(0));
26+
27+
var outputFile = File.ReadAllText($"{outputFilename}.json");
28+
var output = JsonSerializer.Deserialize<EstimationOutput>(outputFile, Shared.JsonSerializerOptions);
29+
30+
Assert.That(output, Is.Not.Null);
31+
Assert.Multiple(() =>
32+
{
33+
Assert.That(output.TotalCost.OriginalValue, Is.EqualTo(cost));
34+
Assert.That(output.TotalResourceCount, Is.EqualTo(2));
35+
});
36+
}
37+
}

ace-tests/azure-cost-estimator-tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
<None Remove="mocked-responses\retail-api\asr\inferred-2.json" />
4949
<None Remove="mocked-responses\retail-api\asr\inferred-3.json" />
5050
<None Remove="mocked-responses\retail-api\automation-account\usage-patterns.json" />
51+
<None Remove="templates/reworked/app-service/skus.bicep" />
5152
<None Remove="templates/reworked/key-vault/usage-patterns-1.bicep" />
5253
<None Remove="templates/reworked/postgresql/fix-261.bicep" />
5354
<None Remove="templates/reworked/static-web-app/static-web-app-free.bicep" />
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
param paramSkuName string = 'F1'
2+
3+
resource appserviceplan 'Microsoft.Web/serverfarms@2023-12-01' = {
4+
name: 'myAppServicePlan'
5+
location: resourceGroup().location
6+
sku: {
7+
name: paramSkuName
8+
}
9+
properties: {
10+
reserved: true
11+
}
12+
}
13+
14+
resource webapp 'Microsoft.Web/sites@2023-12-01' = {
15+
name: 'myWebApp'
16+
location: resourceGroup().location
17+
properties: {
18+
serverFarmId: appserviceplan.id
19+
}
20+
}

ace/Products/AppService/AppServicePlanEstimationCalculation.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public TotalCostSummary GetTotalCost(WhatIfChange[] changes, IDictionary<string,
7878
|| item.meterName == "P1 v2 App"
7979
|| item.meterName == "P2 v2 App"
8080
|| item.meterName == "P3 v2 App"
81+
|| item.meterName == "P0v3 App"
8182
|| item.meterName == "P1 v3 App"
8283
|| item.meterName == "P2 v3 App"
8384
|| item.meterName == "P3 v3 App"

ace/Products/AppService/AppServicePlanSupportedData.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
{ "P1V2", "DZH317GT8G5N" },
2121
{ "P2V2", "DZH317GT8G5N" },
2222
{ "P3V2", "DZH317GT8G5N" },
23+
{ "P0V3", "DZH317GT8G5N" },
2324
{ "P1V3", "DZH317GT8G5N" },
2425
{ "P2V3", "DZH317GT8G5N" },
2526
{ "P3V3", "DZH317GT8G5N" },
@@ -87,6 +88,9 @@
8788
{ "P3V2",
8889
"P3 v2"
8990
},
91+
{ "P0V3",
92+
"P0v3"
93+
},
9094
{ "P1V3",
9195
"P1 v3"
9296
},
@@ -193,6 +197,12 @@
193197
"Azure App Service Premium v2 Plan"
194198
}
195199
},
200+
{
201+
"P0V3", new[]
202+
{
203+
"Azure App Service Premium v3 Plan"
204+
}
205+
},
196206
{
197207
"P1V3", new[]
198208
{
@@ -317,6 +327,12 @@
317327
"Azure App Service Premium v2 Plan - Linux"
318328
}
319329
},
330+
{
331+
"P0V3", new[]
332+
{
333+
"Azure App Service Premium v3 Plan - Linux"
334+
}
335+
},
320336
{
321337
"P1V3", new[]
322338
{

0 commit comments

Comments
 (0)