Skip to content

Commit 521a9b8

Browse files
author
Hovsep
committed
Merge pull request Azure#525 from caln-microsoft/dev
Adding Get-SqlAzureDatabaseRestorePoints
2 parents bd685f0 + a48e397 commit 521a9b8

File tree

14 files changed

+3014
-8
lines changed

14 files changed

+3014
-8
lines changed

ChangeLog.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
* Added Batch cmdlets
33
* Start-AzureBatchPoolResize
44
* Stop-AzureBatchPoolResize
5+
* Azure SQL Database
6+
* Added cmdlets for pause/resume functionality and retrieving restore points for restoring backups:
7+
* Suspend-AzureSqlDatabase
8+
* Resume-AzureSqlDatabase
9+
* Get-AzureSqlDatabaseRestorePoints
10+
* Changed cmdlets:
11+
* New-AzureSqlDatabase - Can now create Azure Sql Data Warehouse databases
512
* RedisCache cmdlets
613
* Set-AzureRedisCache - Added support for scaling, using RedisConfiguration instead of MaxMemoryPolicy #513
714
* New-AzureRedisCache - Using RedisConfiguration instead of MaxMemoryPolicy #513

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
<Reference Include="Hyak.Common">
4848
<HintPath>..\..\..\packages\Hyak.Common.1.0.2\lib\net45\Hyak.Common.dll</HintPath>
4949
</Reference>
50+
<Reference Include="Microsoft.Azure.Management.Sql">
51+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Sql.0.29.0-prerelease\lib\net40\Microsoft.Azure.Management.Sql.dll</HintPath>
52+
</Reference>
5053
<Reference Include="Microsoft.Azure.Common">
5154
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll</HintPath>
5255
</Reference>
@@ -64,9 +67,6 @@
6467
<SpecificVersion>False</SpecificVersion>
6568
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.18.2-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
6669
</Reference>
67-
<Reference Include="Microsoft.Azure.Management.Sql">
68-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Sql.0.28.0-prerelease\lib\net40\Microsoft.Azure.Management.Sql.dll</HintPath>
69-
</Reference>
7070
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
7171
<SpecificVersion>False</SpecificVersion>
7272
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>
@@ -150,11 +150,15 @@
150150
<DependentUpon>Resources.resx</DependentUpon>
151151
</Compile>
152152
<Compile Include="ScenarioTests\DatabaseActivationTests.cs" />
153+
<Compile Include="ScenarioTests\DatabaseBackupTests.cs" />
153154
<Compile Include="ScenarioTests\DatabaseCrudTests.cs" />
154155
<Compile Include="ScenarioTests\DataMaskingTests.cs" />
155156
<None Include="ScenarioTests\DatabaseActivationTests.ps1">
156157
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
157158
</None>
159+
<None Include="ScenarioTests\DatabaseBackupTests.ps1">
160+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
161+
</None>
158162
<None Include="ScenarioTests\RecommendedElasticPoolTests.ps1">
159163
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
160164
</None>
@@ -175,6 +179,7 @@
175179
<Compile Include="UnitTests\AzureSqlDatabaseServerFirewallRuleAttributeTests.cs" />
176180
<Compile Include="UnitTests\AzureSqlDatabaseServerAttributeTests.cs" />
177181
<Compile Include="UnitTests\AzureSqlServerUpgradeAttributeTests.cs" />
182+
<Compile Include="UnitTests\AzureSqlDatabaseBackupAttributeTests.cs" />
178183
<Compile Include="Utilities\UnitTestHelper.cs" />
179184
</ItemGroup>
180185
<ItemGroup>
@@ -337,6 +342,9 @@
337342
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DatabaseActivationTests\TestDatabasePauseResumePiped.json">
338343
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
339344
</None>
345+
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DatabaseBackupTests\TestListDatabaseRestorePoints.json">
346+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
347+
</None>
340348
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DatabaseCrudTests\TestDatabaseCreate.json">
341349
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
342350
</None>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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 DatabaseBackupTests : SqlTestsBase
22+
{
23+
[Fact]
24+
[Trait(Category.Sql, Category.CheckIn)]
25+
public void TestListDatabaseRestorePoints()
26+
{
27+
RunPowerShellTest("Test-ListDatabaseRestorePoints");
28+
}
29+
}
30+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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 getting restore points from databases via piped cmdlets.
18+
#>
19+
function Test-ListDatabaseRestorePoints
20+
{
21+
# Setup
22+
$location = "Japan East"
23+
$serverVersion = "12.0";
24+
$rg = Create-ResourceGroupForTest
25+
26+
try
27+
{
28+
$server = Create-ServerForTest $rg $serverVersion $location
29+
30+
# Create data warehouse database with all parameters.
31+
$databaseName = Get-DatabaseName
32+
$dwdb = New-AzureSqlDatabase -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -DatabaseName $databaseName `
33+
-Edition DataWarehouse -RequestedServiceObjectiveName DW100
34+
35+
$databaseName = Get-DatabaseName
36+
$standarddb = New-AzureSqlDatabase -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -DatabaseName $databaseName `
37+
-Edition Standard -RequestedServiceObjectiveName S0
38+
39+
# Get restore points from data warehouse database.
40+
$restorePoints = Get-AzureSqlDatabaseRestorePoints -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -DatabaseName $dwdb.DatabaseName
41+
Assert-Null $restorePoints # Since the data warehouse database has just been created, it should not have any discrete restore points.
42+
43+
# Get restore points from standard database through pipe.
44+
$restorePoints = $standarddb | Get-AzureSqlDatabaseRestorePoints
45+
Assert-AreEqual $restorePoints.Count 1 # Standard databases should only have 1 continuous restore point.
46+
$restorePoint = $restorePoints[0]
47+
Assert-AreEqual $restorePoint.RestorePointType Continuous
48+
Assert-Null $restorePoint.RestorePointCreationDate
49+
Assert-True { $restorePoint.EarliestRestoreDate -le [DateTime]::UtcNow }
50+
}
51+
finally
52+
{
53+
Remove-ResourceGroupForTest $rg
54+
}
55+
}

0 commit comments

Comments
 (0)