Skip to content

Commit f8c3528

Browse files
amolramolr
authored andcommitted
Merge branch 'preview' of https://github.com/Azure/azure-powershell into preview
2 parents e93da88 + 4ca9cbf commit f8c3528

File tree

18 files changed

+81628
-1003
lines changed

18 files changed

+81628
-1003
lines changed

src/ResourceManager/AnalysisServices/ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
-->
2020
## Current Release
2121

22+
* New SKUs added: B1, B2, S0
23+
* Scale up/down support added
24+
2225
## Version 0.3.0
2326

2427
## Version 0.2.0

src/ResourceManager/AnalysisServices/Commands.AnalysisServices.Test/Commands.AnalysisServices.Test.csproj

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
<Private>True</Private>
6060
</Reference>
6161
<Reference Include="Microsoft.Azure.Management.Analysis, Version=1.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
62-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Analysis.1.0.2-preview\lib\net45\Microsoft.Azure.Management.Analysis.dll</HintPath>
63-
<Private>True</Private>
62+
<SpecificVersion>False</SpecificVersion>
63+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Analysis.1.1.2\lib\net452\Microsoft.Azure.Management.Analysis.dll</HintPath>
6464
</Reference>
6565
<Reference Include="Microsoft.Azure.Management.Authorization">
6666
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
@@ -224,6 +224,9 @@
224224
<None Include="SessionRecords\Microsoft.Azure.Commands.AnalysisServices.Test.ScenarioTests.AsTests\TestNegativeAnalysisServicesServer.json">
225225
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
226226
</None>
227+
<None Include="SessionRecords\Microsoft.Azure.Commands.AnalysisServices.Test.ScenarioTests.AsTests\TestAnalysisServicesServerScaleUpDown.json">
228+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
229+
</None>
227230
</ItemGroup>
228231
<ItemGroup>
229232
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />

src/ResourceManager/AnalysisServices/Commands.AnalysisServices.Test/InMemoryTests/DataPlaneCommandTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ public void TestAddAzureASAccountCommand()
9595
expectedProfile.Context.TokenCache = Encoding.ASCII.GetBytes(testToken);
9696

9797
// Setup
98+
// Clear the the current profile
99+
AsAzureClientSession.Instance.Profile.Environments.Clear();
100+
98101
var mockAuthenticationProvider = new Mock<IAsAzureAuthenticationProvider>();
99102
mockAuthenticationProvider.Setup(
100103
authProvider => authProvider.GetAadAuthenticatedToken(

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +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
}
33-
33+
34+
[Fact]
35+
[Trait(Category.AcceptanceType, Category.CheckIn)]
36+
public void TestAnalysisServicesServerScaleUpDown()
37+
{
38+
NewInstance.RunPsTest("Test-AnalysisServicesServerScaleUpDown");
39+
}
40+
3441
[Fact]
3542
[Trait(Category.AcceptanceType, Category.CheckIn)]
3643
public void TestNegativeAnalysisServicesServer()
3744
{
38-
NewInstance.RunPsTest(string.Format("Test-NegativeAnalysisServicesServer -location '{0}'", AsTestsBase.resourceGroupLocation));
45+
NewInstance.RunPsTest("Test-NegativeAnalysisServicesServer");
3946
}
4047

4148
[Fact]

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

Lines changed: 58 additions & 9 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
@@ -123,23 +119,76 @@ function Test-AnalysisServicesServer
123119
}
124120
}
125121

122+
<#
123+
.SYNOPSIS
124+
Tests scale up and down of Analysis Services server (B1 -> S2 -> S1).
125+
#>
126+
function Test-AnalysisServicesServerScaleUpDown
127+
{
128+
try
129+
{
130+
# Creating server
131+
$location = Get-Location
132+
$resourceGroupName = Get-ResourceGroupName
133+
$serverName = Get-AnalysisServicesServerName
134+
New-AzureRmResourceGroup -Name $resourceGroupName -Location $location
135+
136+
$serverCreated = New-AzureRmAnalysisServicesServer -ResourceGroupName $resourceGroupName -Name $serverName -Location $location -Sku 'B1' -Administrator '[email protected],[email protected]'
137+
138+
Assert-AreEqual $serverName $serverCreated.Name
139+
Assert-AreEqual $location $serverCreated.Location
140+
Assert-AreEqual "Microsoft.AnalysisServices/servers" $serverCreated.Type
141+
Assert-AreEqual B1 $serverCreated.Sku.Name
142+
Assert-True {$serverCreated.Id -like "*$resourceGroupName*"}
143+
Assert-True {$serverCreated.ServerFullName -ne $null -and $serverCreated.ServerFullName.Contains("$serverName")}
144+
145+
# Check server was created successfully
146+
[array]$serverGet = Get-AzureRmAnalysisServicesServer -ResourceGroupName $resourceGroupName -Name $serverName
147+
$serverGetItem = $serverGet[0]
148+
149+
Assert-True {$serverGetItem.ProvisioningState -like "Succeeded"}
150+
Assert-True {$serverGetItem.State -like "Succeeded"}
151+
152+
Assert-AreEqual $serverName $serverGetItem.Name
153+
Assert-AreEqual $location $serverGetItem.Location
154+
Assert-AreEqual B1 $serverGetItem.Sku.Name
155+
Assert-AreEqual "Microsoft.AnalysisServices/servers" $serverGetItem.Type
156+
Assert-True {$serverGetItem.Id -like "*$resourceGroupName*"}
157+
158+
# Scale up B1 -> S2
159+
$serverUpdated = Set-AzureRmAnalysisServicesServer -Name $serverName -Sku S2 -PassThru
160+
Assert-AreEqual S2 $serverUpdated.Sku.Name
161+
162+
# Scale down S2 -> S1
163+
$serverUpdated = Set-AzureRmAnalysisServicesServer -Name $serverName -Sku S1 -PassThru
164+
Assert-AreEqual S1 $serverUpdated.Sku.Name
165+
166+
# Delete Analysis Servicesserver
167+
Remove-AzureRmAnalysisServicesServer -ResourceGroupName $resourceGroupName -Name $serverName -PassThru
168+
}
169+
finally
170+
{
171+
# cleanup the resource group that was used in case it still exists. This is a best effort task, we ignore failures here.
172+
Invoke-HandledCmdlet -Command {Remove-AzureRmAnalysisServicesServer -ResourceGroupName $resourceGroupName -Name $serverName -ErrorAction SilentlyContinue} -IgnoreFailures
173+
Invoke-HandledCmdlet -Command {Remove-AzureRmResourceGroup -Name $resourceGroupName -ErrorAction SilentlyContinue} -IgnoreFailures
174+
}
175+
}
126176

127177
<#
128178
.SYNOPSIS
129179
Tests Analysis Services server lifecycle Failure scenarios (Create, Update, Get, Delete).
130180
#>
131181
function Test-NegativeAnalysisServicesServer
132182
{
133-
134183
param
135184
(
136-
$location = "West US",
137185
$fakeserverName = "psfakeservertest"
138186
)
139187

140188
try
141189
{
142190
# Creating Account
191+
$location = Get-Location
143192
$resourceGroupName = Get-ResourceGroupName
144193
$serverName = Get-AnalysisServicesServerName
145194
New-AzureRmResourceGroup -Name $resourceGroupName -Location $location
@@ -188,12 +237,12 @@ function Test-AnalysisServicesServerRestart
188237
{
189238
param
190239
(
191-
$rolloutEnvironment = $env.ASAZURE_TEST_ROLLOUT,
192-
$location = "West US"
240+
$rolloutEnvironment = $env.ASAZURE_TEST_ROLLOUT
193241
)
194242
try
195243
{
196244
# Creating server
245+
$location = Get-Location
197246
$resourceGroupName = Get-ResourceGroupName
198247
$serverName = Get-AnalysisServicesServerName
199248
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)