Skip to content

Commit fc4dae9

Browse files
author
REDMOND\chanwan
committed
Keep resource group name in budget test hardcode
1 parent 7a5bfb4 commit fc4dae9

File tree

5 files changed

+423
-233
lines changed

5 files changed

+423
-233
lines changed

src/ResourceManager/Consumption/Commands.Consumption.Test/ScenarioTests/BudgetTests.ps1

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,6 @@ function Get-NotificationKey
3737
return "NotificationKey-" + (getAssetName)
3838
}
3939

40-
<#
41-
.SYNOPSIS
42-
Get Resource Group Name
43-
#>
44-
function Get-ResourceGroupName
45-
{
46-
return "ResourceGroupName-" + (getAssetName)
47-
}
48-
4940
<#
5041
.SYNOPSIS
5142
Test budget at subscription level
@@ -103,14 +94,10 @@ function Test-BudgetAtResourceGroupLevel
10394
$notificationKey1 = Get-NotificationKey
10495
$notificationKey2 = Get-NotificationKey
10596
# This resource group is created at the scope of test subscription
106-
$resourceGroupName = Get-ResourceGroupName
97+
$resourceGroupName = 'RGBudgets'
10798
$startDate = Get-Date -Day 1
10899
$endDate = ($startDate).AddMonths(3).AddDays(-1)
109100

110-
# Create resource group
111-
Import-Module AzureRM.Resources
112-
$resourceGroup = New-AzureRmResourceGroup -Name $resourceGroupName -Location westus -Force
113-
114101
# Create budget
115102
Write-Debug "Create a new budget $budgetName at resource group level"
116103
$budgetNew = New-AzureRmConsumptionBudget -Amount 6000 -Name $budgetName -ResourceGroupName $resourceGroupName -Category Cost -StartDate $startDate -EndDate $endDate -TimeGrain Monthly
@@ -148,9 +135,6 @@ function Test-BudgetAtResourceGroupLevel
148135
Assert-AreEqual True $response
149136

150137
Assert-Throws {Get-AzureRmConsumptionBudget -Name $budgetName -ResourceGroupName $resourceGroupName}
151-
152-
# Remove resource group
153-
Remove-AzureRmResourceGroup -Name $resourceGroupName -Force
154138
}
155139

156140
<#

src/ResourceManager/Consumption/Commands.Consumption.Test/ScenarioTests/TestController.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@
3333

3434
namespace Microsoft.Azure.Commands.Consumption.Test.ScenarioTests.ScenarioTest
3535
{
36-
using Rest;
37-
using TokenAudience = Rest.ClientRuntime.Azure.TestFramework.TokenAudience;
38-
3936
public class TestController : RMTestBase
4037
{
4138
private CSMTestEnvironmentFactory _csmTestFactory;
@@ -170,7 +167,9 @@ protected ResourceManagementClient GetResourceManagementClient()
170167

171168
private RM.Fluent.ResourceManagementClient GetResourceClient(MockContext context)
172169
{
173-
return context.GetServiceClient<RM.Fluent.ResourceManagementClient>(Rest.ClientRuntime.Azure.TestFramework.TestEnvironmentFactory.GetTestEnvironment());
170+
return
171+
context.GetServiceClient<RM.Fluent.ResourceManagementClient>(
172+
Rest.ClientRuntime.Azure.TestFramework.TestEnvironmentFactory.GetTestEnvironment());
174173
}
175174

176175
private AuthorizationManagementClient GetAuthorizationManagementClient()

0 commit comments

Comments
 (0)