Skip to content

Commit e83dc75

Browse files
author
Igor Uzhviev
committed
Azure Analysis Services: test resource RP location is moved to a function for further improvements
1 parent b6e789c commit e83dc75

File tree

7 files changed

+52091
-6542
lines changed

7 files changed

+52091
-6542
lines changed

src/ResourceManager/AnalysisServices/Commands.AnalysisServices.Test/ScenarioTests/AsTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,21 @@ public AsTests(Xunit.Abstractions.ITestOutputHelper output)
2828
[Trait(Category.AcceptanceType, Category.CheckIn)]
2929
public void TestAnalysisServicesServer()
3030
{
31-
NewInstance.RunPsTest(string.Format("Test-AnalysisServicesServer -location '{0}'", AsTestsBase.resourceGroupLocation));
31+
NewInstance.RunPsTest("Test-AnalysisServicesServer");
3232
}
3333

3434
[Fact]
3535
[Trait(Category.AcceptanceType, Category.CheckIn)]
3636
public void TestAnalysisServicesServerScaleUpDown()
3737
{
38-
NewInstance.RunPsTest(string.Format("Test-AnalysisServicesServerScaleUpDown -location '{0}'", AsTestsBase.resourceGroupLocation));
38+
NewInstance.RunPsTest("Test-AnalysisServicesServerScaleUpDown");
3939
}
4040

4141
[Fact]
4242
[Trait(Category.AcceptanceType, Category.CheckIn)]
4343
public void TestNegativeAnalysisServicesServer()
4444
{
45-
NewInstance.RunPsTest(string.Format("Test-NegativeAnalysisServicesServer -location '{0}'", AsTestsBase.resourceGroupLocation));
45+
NewInstance.RunPsTest("Test-NegativeAnalysisServicesServer");
4646
}
4747

4848
[Fact]

src/ResourceManager/AnalysisServices/Commands.AnalysisServices.Test/ScenarioTests/AsTests.ps1

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,10 @@ Tests Analysis Services server lifecycle (Create, Update, Get, List, Delete).
44
#>
55
function Test-AnalysisServicesServer
66
{
7-
param
8-
(
9-
$location = "West US"
10-
)
11-
127
try
138
{
149
# Creating server
10+
$location = Get-Location
1511
$resourceGroupName = Get-ResourceGroupName
1612
$serverName = Get-AnalysisServicesServerName
1713
New-AzureRmResourceGroup -Name $resourceGroupName -Location $location
@@ -129,14 +125,10 @@ Tests scale up and down of Analysis Services server (B1 -> S2 -> S1).
129125
#>
130126
function Test-AnalysisServicesServerScaleUpDown
131127
{
132-
param
133-
(
134-
$location = "West US"
135-
)
136-
137128
try
138129
{
139130
# Creating server
131+
$location = Get-Location
140132
$resourceGroupName = Get-ResourceGroupName
141133
$serverName = Get-AnalysisServicesServerName
142134
New-AzureRmResourceGroup -Name $resourceGroupName -Location $location
@@ -188,16 +180,15 @@ Tests Analysis Services server lifecycle Failure scenarios (Create, Update, Get
188180
#>
189181
function Test-NegativeAnalysisServicesServer
190182
{
191-
192183
param
193184
(
194-
$location = "West US",
195185
$fakeserverName = "psfakeservertest"
196186
)
197187

198188
try
199189
{
200190
# Creating Account
191+
$location = Get-Location
201192
$resourceGroupName = Get-ResourceGroupName
202193
$serverName = Get-AnalysisServicesServerName
203194
New-AzureRmResourceGroup -Name $resourceGroupName -Location $location
@@ -246,12 +237,12 @@ function Test-AnalysisServicesServerRestart
246237
{
247238
param
248239
(
249-
$rolloutEnvironment = $env.ASAZURE_TEST_ROLLOUT,
250-
$location = "West US"
240+
$rolloutEnvironment = $env.ASAZURE_TEST_ROLLOUT
251241
)
252242
try
253243
{
254244
# Creating server
245+
$location = Get-Location
255246
$resourceGroupName = Get-ResourceGroupName
256247
$serverName = Get-AnalysisServicesServerName
257248
New-AzureRmResourceGroup -Name $resourceGroupName -Location $location

src/ResourceManager/AnalysisServices/Commands.AnalysisServices.Test/ScenarioTests/AsTestsBase.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public class AsTestsBase : RMTestBase
4040
private LegacyTest.CSMTestEnvironmentFactory csmTestFactory;
4141
private EnvironmentSetupHelper helper;
4242
private const string AuthorizationApiVersion = "2014-07-01-preview";
43-
internal const string resourceGroupLocation = "West US";
4443

4544
public ResourceManagementClient ResourceManagementClient { get; private set; }
4645

src/ResourceManager/AnalysisServices/Commands.AnalysisServices.Test/ScenarioTests/Common.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ function Get-ResourceGroupName
3030
return getAssetName
3131
}
3232

33+
<#
34+
.SYNOPSIS
35+
Gets a location for testing.
36+
#>
37+
function Get-Location
38+
{
39+
# TODO: should be implemented via Get-AzureRmResourceProvider
40+
return "West US"
41+
}
42+
3343
<#
3444
.SYNOPSIS
3545
Executes a cmdlet and enables ignoring of errors if desired

0 commit comments

Comments
 (0)