Skip to content

Adding Get-SqlAzureDatabaseRestorePoints #525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jun 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
* Added Batch cmdlets
* Start-AzureBatchPoolResize
* Stop-AzureBatchPoolResize
* Azure SQL Database
* Added cmdlets for pause/resume functionality and retrieving restore points for restoring backups:
* Suspend-AzureSqlDatabase
* Resume-AzureSqlDatabase
* Get-AzureSqlDatabaseRestorePoints
* Changed cmdlets:
* New-AzureSqlDatabase - Can now create Azure Sql Data Warehouse databases
* RedisCache cmdlets
* Set-AzureRedisCache - Added support for scaling, using RedisConfiguration instead of MaxMemoryPolicy #513
* New-AzureRedisCache - Using RedisConfiguration instead of MaxMemoryPolicy #513
Expand Down
14 changes: 11 additions & 3 deletions src/ResourceManager/Sql/Commands.Sql.Test/Commands.Sql.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
<Reference Include="Hyak.Common">
<HintPath>..\..\..\packages\Hyak.Common.1.0.2\lib\net45\Hyak.Common.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.Sql">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Sql.0.29.0-prerelease\lib\net40\Microsoft.Azure.Management.Sql.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Common">
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll</HintPath>
</Reference>
Expand All @@ -64,9 +67,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.18.2-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.Sql">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Sql.0.28.0-prerelease\lib\net40\Microsoft.Azure.Management.Sql.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>
Expand Down Expand Up @@ -150,11 +150,15 @@
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="ScenarioTests\DatabaseActivationTests.cs" />
<Compile Include="ScenarioTests\DatabaseBackupTests.cs" />
<Compile Include="ScenarioTests\DatabaseCrudTests.cs" />
<Compile Include="ScenarioTests\DataMaskingTests.cs" />
<None Include="ScenarioTests\DatabaseActivationTests.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ScenarioTests\DatabaseBackupTests.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="ScenarioTests\RecommendedElasticPoolTests.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand All @@ -175,6 +179,7 @@
<Compile Include="UnitTests\AzureSqlDatabaseServerFirewallRuleAttributeTests.cs" />
<Compile Include="UnitTests\AzureSqlDatabaseServerAttributeTests.cs" />
<Compile Include="UnitTests\AzureSqlServerUpgradeAttributeTests.cs" />
<Compile Include="UnitTests\AzureSqlDatabaseBackupAttributeTests.cs" />
<Compile Include="Utilities\UnitTestHelper.cs" />
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -337,6 +342,9 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DatabaseActivationTests\TestDatabasePauseResumePiped.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DatabaseBackupTests\TestListDatabaseRestorePoints.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.Sql.Test.ScenarioTests.DatabaseCrudTests\TestDatabaseCreate.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Commands.ScenarioTest.SqlTests;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;

namespace Microsoft.Azure.Commands.Sql.Test.ScenarioTests
{
public class DatabaseBackupTests : SqlTestsBase
{
[Fact]
[Trait(Category.Sql, Category.CheckIn)]
public void TestListDatabaseRestorePoints()
{
RunPowerShellTest("Test-ListDatabaseRestorePoints");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# ----------------------------------------------------------------------------------
#
# Copyright Microsoft Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ----------------------------------------------------------------------------------

<#
.SYNOPSIS
Test getting restore points from databases via piped cmdlets.
#>
function Test-ListDatabaseRestorePoints
{
# Setup
$location = "Japan East"
$serverVersion = "12.0";
$rg = Create-ResourceGroupForTest

try
{
$server = Create-ServerForTest $rg $serverVersion $location

# Create data warehouse database with all parameters.
$databaseName = Get-DatabaseName
$dwdb = New-AzureSqlDatabase -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -DatabaseName $databaseName `
-Edition DataWarehouse -RequestedServiceObjectiveName DW100

$databaseName = Get-DatabaseName
$standarddb = New-AzureSqlDatabase -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -DatabaseName $databaseName `
-Edition Standard -RequestedServiceObjectiveName S0

# Get restore points from data warehouse database.
$restorePoints = Get-AzureSqlDatabaseRestorePoints -ResourceGroupName $rg.ResourceGroupName -ServerName $server.ServerName -DatabaseName $dwdb.DatabaseName
Assert-Null $restorePoints # Since the data warehouse database has just been created, it should not have any discrete restore points.

# Get restore points from standard database through pipe.
$restorePoints = $standarddb | Get-AzureSqlDatabaseRestorePoints
Assert-AreEqual $restorePoints.Count 1 # Standard databases should only have 1 continuous restore point.
$restorePoint = $restorePoints[0]
Assert-AreEqual $restorePoint.RestorePointType Continuous
Assert-Null $restorePoint.RestorePointCreationDate
Assert-True { $restorePoint.EarliestRestoreDate -le [DateTime]::UtcNow }
}
finally
{
Remove-ResourceGroupForTest $rg
}
}
Loading