Skip to content

Commit

Permalink
Get-AzSynapseSqlPoolGeoBackup and Get-AzSynapseDroppedSqlPool. (#13621)
Browse files Browse the repository at this point in the history
* GetAzureSynapseSqlPoolGeoBackup

* refine function and constant

* add help

* GetAzureSynapseSqlDeletedDatabaseBackup

* refine backup function

* refine doc

* add Getazuresynapsesqldeleteddatabasebackup

* refined help doc

* refine function

* resolve id name type not found in output problem

* add test

* update command name

* resolve some comments

* resovle function problem

* test improvement

* add wildcard

* rename help doc

* add resourceid

* Update ChangeLog.md

Co-authored-by: Jin Lei <[email protected]>
  • Loading branch information
zesluo and msJinLei authored Feb 4, 2021
1 parent 966c440 commit 2697237
Show file tree
Hide file tree
Showing 16 changed files with 6,569 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/Synapse/Synapse.Test/ScenarioTests/SqlPoolBackupTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,24 @@ public void TestSqlPoolRestorePoint(){
"Test-SqlPoolRestorePoint");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestSqlPoolGeoBackup()
{
NewInstance.RunPsTest(
_logger,
"Test-SqlPoolGeoBackup");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestDroppedSqlPool()
{
NewInstance.RunPsTest(
_logger,
"Test-DroppedSqlPool");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestRestoreFromRestorePoint()
Expand Down
68 changes: 67 additions & 1 deletion src/Synapse/Synapse.Test/ScenarioTests/SqlPoolBackupTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,72 @@ function Test-SqlPoolRestorePoint
}
}

function Test-SqlPoolGeoBackup
{
# Setup
$testSuffix = 'ps2502'
$params = Get-SqlPoolBackupTestEnvironmentParameters $testSuffix

try
{
$SqlPoolGeoBackupGet =Get-AzSynapseSqlPoolGeoBackup -ResourceGroupName $params.rgname -WorkspaceName $params.workspaceName
Assert-AreEqual $params.sqlPoolName $SqlPoolGeoBackupGet[0].Name
Assert-Null $SqlPoolGeoBackupGet[0].ElasticPoolName
Assert-NotNull $SqlPoolGeoBackupGet[0].Edition
Assert-NotNull $SqlPoolGeoBackupGet[0].LastAvailableBackupDate

$SqlPoolGeoBackupGetByPool =Get-AzSynapseSqlPoolGeoBackup -ResourceGroupName $params.rgname -WorkspaceName $params.workspaceName -Name $params.sqlPoolName
Assert-AreEqual $params.sqlPoolName $SqlPoolGeoBackupGetByPool.Name
Assert-Null $SqlPoolGeoBackupGetByPool.ElasticPoolName
Assert-NotNull $SqlPoolGeoBackupGetByPool.Edition
Assert-NotNull $SqlPoolGeoBackupGetByPool.LastAvailableBackupDate
}
finally
{
# Cleanup
Remove-SqlPoolBackupTestEnvironment $testSuffix
}
}

function Test-DroppedSqlPool
{
# Setup
$testSuffix = getAssetName
Create-SqlPoolBackupTestEnvironment $testSuffix
$params = Get-SqlPoolBackupTestEnvironmentParameters $testSuffix

try
{
Remove-AzSynapseSqlPool -ResourceGroupName $params.rgname -WorkspaceName $params.workspaceName -Name $params.sqlPoolName -Force

Wait-Seconds 300

$DroppedSqlPoolGet =Get-AzSynapseDroppedSqlPool -ResourceGroupName $params.rgname -WorkspaceName $params.workspaceName
Assert-AreEqual $params.sqlPoolName $DroppedSqlPoolGet[0].DatabaseName
Assert-Null $DroppedSqlPoolGet[0].ElasticPoolName
Assert-NotNull $DroppedSqlPoolGet[0].Edition
Assert-NotNull $DroppedSqlPoolGet[0].MaxSizeBytes
Assert-NotNull $DroppedSqlPoolGet[0].ServiceLevelObjective
Assert-NotNull $DroppedSqlPoolGet[0].CreationDate
Assert-NotNull $DroppedSqlPoolGet[0].DeletionDate
Assert-NotNull $DroppedSqlPoolGet[0].EarliestRestoreDate

$DroppedSqlPoolGetByPool= Get-AzSynapseDroppedSqlPool -ResourceGroupName $params.rgname -WorkspaceName $params.workspaceName -Name $params.sqlPoolName
Assert-AreEqual $params.sqlPoolName $DroppedSqlPoolGetByPool[0].DatabaseName
Assert-Null $DroppedSqlPoolGetByPool[0].ElasticPoolName
Assert-NotNull $DroppedSqlPoolGetByPool[0].Edition
Assert-NotNull $DroppedSqlPoolGetByPool[0].MaxSizeBytes
Assert-NotNull $DroppedSqlPoolGetByPool[0].ServiceLevelObjective
Assert-NotNull $DroppedSqlPoolGetByPool[0].CreationDate
Assert-NotNull $DroppedSqlPoolGetByPool[0].DeletionDate
Assert-NotNull $DroppedSqlPoolGetByPool[0].EarliestRestoreDate
}
finally
{
# Cleanup
Remove-SqlPoolBackupTestEnvironment $testSuffix
}
}
<#
.SYNOPSIS
Tests for restoring from restore point
Expand Down Expand Up @@ -203,7 +269,7 @@ function Get-SqlPoolBackupTestEnvironmentParameters ($testSuffix)
loginName = "testlogin";
pwd = "testp@ssMakingIt1007Longer";
perfLevel = 'DW200c';
location = "westcentralus";
location = "northeurope";
restoredSqlPoolName = "dwrestore" + $testSuffix;
}
}
Expand Down
Loading

0 comments on commit 2697237

Please sign in to comment.