Skip to content

Commit 50b6c9c

Browse files
author
Radhika Kashyap
committed
Merge branch 'dev' of https://github.com/Azure/azure-powershell into GetRoleDefinitions
Conflicts: src/ResourceManager/Sql/Commands.Sql.Test/packages.config src/ResourceManager/Sql/Commands.Sql/packages.config
2 parents 3b0337d + 4df2066 commit 50b6c9c

22 files changed

+10691
-346
lines changed

setup/azurecmdfiles.wxi

Lines changed: 0 additions & 336 deletions
Large diffs are not rendered by default.

src/ResourceManager/Sql/Commands.Sql.Test/Commands.Sql.Test.csproj

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.19.1-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
6666
</Reference>
6767
<Reference Include="Microsoft.Azure.Management.Sql">
68-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Sql.0.26.0-prerelease\lib\net40\Microsoft.Azure.Management.Sql.dll</HintPath>
68+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Sql.0.28.0-prerelease\lib\net40\Microsoft.Azure.Management.Sql.dll</HintPath>
6969
</Reference>
7070
<Reference Include="Microsoft.Azure.ResourceManager">
7171
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.1-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>
@@ -148,8 +148,12 @@
148148
<DesignTime>True</DesignTime>
149149
<DependentUpon>Resources.resx</DependentUpon>
150150
</Compile>
151+
<Compile Include="ScenarioTests\DatabaseActivationTests.cs" />
151152
<Compile Include="ScenarioTests\DatabaseCrudTests.cs" />
152153
<Compile Include="ScenarioTests\DataMaskingTests.cs" />
154+
<None Include="ScenarioTests\DatabaseActivationTests.ps1">
155+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
156+
</None>
153157
<None Include="ScenarioTests\RecommendedElasticPoolTests.ps1">
154158
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
155159
</None>
@@ -164,6 +168,7 @@
164168
<Compile Include="ScenarioTests\SqlTestsBase.cs" />
165169
<Compile Include="ScenarioTests\TransparentDataEncryptionCrudTests.cs" />
166170
<Compile Include="UnitTests\AzureSqlCmdletBaseAttributeTests.cs" />
171+
<Compile Include="UnitTests\AzureSqlDatabaseActivationAttributeTest.cs" />
167172
<Compile Include="UnitTests\AzureSqlDatabaseAttributeTests.cs" />
168173
<Compile Include="UnitTests\AzureSqlDatabaseServerServiceObjectiveAttributeTests.cs" />
169174
<Compile Include="UnitTests\AzureSqlDatabaseServerFirewallRuleAttributeTests.cs" />
@@ -325,6 +330,12 @@
325330
<None Include="SessionRecords\Microsoft.Azure.Commands.ScenarioTest.SqlTests.SecurityTests\TestUseServerDefault.json">
326331
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
327332
</None>
333+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DatabaseActivationTests\TestDatabasePauseResume.json">
334+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
335+
</None>
336+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DatabaseActivationTests\TestDatabasePauseResumePiped.json">
337+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
338+
</None>
328339
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DatabaseCrudTests\TestDatabaseCreate.json">
329340
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
330341
</None>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.Azure.Commands.ScenarioTest.SqlTests;
16+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
17+
using Xunit;
18+
19+
namespace Microsoft.Azure.Commands.Sql.Test.ScenarioTests
20+
{
21+
public class DatabaseActivationTests : SqlTestsBase
22+
{
23+
[Fact]
24+
[Trait(Category.Sql, Category.CheckIn)]
25+
public void TestDatabasePauseResume()
26+
{
27+
RunPowerShellTest("Test-DatabasePauseResume");
28+
}
29+
30+
[Fact]
31+
[Trait(Category.Sql, Category.CheckIn)]
32+
public void TestDatabasePauseResumePiped()
33+
{
34+
RunPowerShellTest("Test-DatabasePauseResumePiped");
35+
}
36+
}
37+
}
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# ----------------------------------------------------------------------------------
2+
#
3+
# Copyright Microsoft Corporation
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
# ----------------------------------------------------------------------------------
14+
15+
<#
16+
.SYNOPSIS
17+
Test pasuing and resuming database.
18+
#>
19+
function Test-DatabasePauseResume
20+
{
21+
# Setup
22+
$location = "Southeast Asia"
23+
$serverVersion = "12.0";
24+
$rg = Create-ResourceGroupForTest
25+
$server = Create-ServerForTest $rg $serverVersion $location
26+
27+
# Create data warehouse database with all parameters.
28+
$databaseName = Get-DatabaseName
29+
$collationName = "SQL_Latin1_General_CP1_CI_AS"
30+
$maxSizeBytes = 250GB
31+
$dwdb = New-AzureSqlDatabase -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -DatabaseName $databaseName `
32+
-CollationName $collationName -MaxSizeBytes $maxSizeBytes -Edition DataWarehouse -RequestedServiceObjectiveName DW100
33+
34+
try
35+
{
36+
# Pause the database. Make sure the database specs remain the same and its Status is Paused.
37+
$dwdb2 = Suspend-AzureSqlDatabase -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -DatabaseName $dwdb.DatabaseName
38+
Assert-AreEqual $dwdb2.DatabaseName $databaseName
39+
Assert-AreEqual $dwdb2.MaxSizeBytes $maxSizeBytes
40+
Assert-AreEqual $dwdb2.Edition DataWarehouse
41+
Assert-AreEqual $dwdb2.CurrentServiceObjectiveName DW100
42+
Assert-AreEqual $dwdb2.CollationName $collationName
43+
Assert-AreEqual $dwdb2.Status "Paused"
44+
45+
# Resume the database. Make sure the database specs remain the same and its Status is Online.
46+
$dwdb3 = Resume-AzureSqlDatabase -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -DatabaseName $dwdb.DatabaseName
47+
Assert-AreEqual $dwdb3.DatabaseName $databaseName
48+
Assert-AreEqual $dwdb3.MaxSizeBytes $maxSizeBytes
49+
Assert-AreEqual $dwdb3.Edition DataWarehouse
50+
Assert-AreEqual $dwdb3.CurrentServiceObjectiveName DW100
51+
Assert-AreEqual $dwdb3.CollationName $collationName
52+
Assert-AreEqual $dwdb3.Status "Online"
53+
}
54+
finally
55+
{
56+
Remove-ResourceGroupForTest $rg
57+
}
58+
}
59+
60+
<#
61+
.SYNOPSIS
62+
Test pasuing and resuming database via piped cmdlets.
63+
#>
64+
function Test-DatabasePauseResumePiped
65+
{
66+
# Setup
67+
$location = "Japan East"
68+
$serverVersion = "12.0";
69+
$rg = Create-ResourceGroupForTest
70+
71+
try
72+
{
73+
$server = Create-ServerForTest $rg $serverVersion $location
74+
75+
# Create data warehouse database with all parameters.
76+
$databaseName = Get-DatabaseName
77+
$collationName = "SQL_Latin1_General_CP1_CI_AS"
78+
$maxSizeBytes = 250GB
79+
$dwdb = New-AzureSqlDatabase -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -DatabaseName $databaseName `
80+
-CollationName $collationName -MaxSizeBytes $maxSizeBytes -Edition DataWarehouse -RequestedServiceObjectiveName DW100
81+
82+
83+
# Pause the database. Make sure the database specs remain the same and its Status is Paused.
84+
$dwdb2 = $dwdb | Suspend-AzureSqlDatabase
85+
Assert-AreEqual $dwdb2.DatabaseName $databaseName
86+
Assert-AreEqual $dwdb2.MaxSizeBytes $maxSizeBytes
87+
Assert-AreEqual $dwdb2.Edition DataWarehouse
88+
Assert-AreEqual $dwdb2.CurrentServiceObjectiveName DW100
89+
Assert-AreEqual $dwdb2.CollationName $collationName
90+
Assert-AreEqual $dwdb2.Status "Paused"
91+
92+
# Resume the database. Make sure the database specs remain the same and its Status is Online.
93+
$dwdb3 = $dwdb2 | Resume-AzureSqlDatabase
94+
Assert-AreEqual $dwdb3.DatabaseName $databaseName
95+
Assert-AreEqual $dwdb3.MaxSizeBytes $maxSizeBytes
96+
Assert-AreEqual $dwdb3.Edition DataWarehouse
97+
Assert-AreEqual $dwdb3.CurrentServiceObjectiveName DW100
98+
Assert-AreEqual $dwdb3.CollationName $collationName
99+
Assert-AreEqual $dwdb3.Status "Online"
100+
}
101+
finally
102+
{
103+
Remove-ResourceGroupForTest $rg
104+
}
105+
}

0 commit comments

Comments
 (0)