Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,11 @@
<SubType>Designer</SubType>
</None>
<None Include="ScenarioTests\AzureBackupTests.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests\BackUpAzureBackUpItem.json" />
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests\EnableDisableAzureBackupProtectionTest.json" />
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests\DisableAzureBackupProtectionTest.json" />
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests\EnableAzureBackupProtectionTest.json" />
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests\GetAzureBackupJobTests.json" />
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests\GetRecoveryPointTests.json" />
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests\ListAzureBackupItemTests.json" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,19 @@ public void ListProtectionPolicyTests()
[Fact]
public void ListAzureBackupItemTests()
{
this.RunPowerShellTest("Test-GetAzureBackupItemTests");
this.RunPowerShellTest("Test-GetAzureBackupItem");
}

[Fact]
public void EnableDisableAzureBackupProtectionTest()
public void EnableAzureBackupProtectionTest()
{
this.RunPowerShellTest("Test-EnableDisableAzureBackupProtectionTest");
this.RunPowerShellTest("Test-EnableAzureBackupProtection");
}

[Fact]
public void DisableAzureBackupProtectionTest()
{
this.RunPowerShellTest("Test-DisableAzureBackupProtection");
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,16 @@ function GetAzureRecoveryPointTest
$recoveryPoints = Get-AzureBackupRecoveryPoint -Item $azureBackUpItem
if (!($recoveryPoints -eq $null))
{
foreach($recoveryPoint in $recoveryPoints)
{
Assert-NotNull $recoveryPoint.RecoveryPointTime 'RecoveryPointTime should not be null'
Assert-NotNull $recoveryPoint.RecoveryPointType 'RecoveryPointType should not be null'
Assert-NotNull $recoveryPoint.RecoveryPointId 'RecoveryPointId should not be null'
foreach($recoveryPoint in $recoveryPoints)
{
Assert-NotNull $recoveryPoint.RecoveryPointTime 'RecoveryPointTime should not be null'
Assert-NotNull $recoveryPoint.RecoveryPointType 'RecoveryPointType should not be null'
Assert-NotNull $recoveryPoint.RecoveryPointId 'RecoveryPointId should not be null'
}
}
}

function Test-GetAzureBackupItemTests
function Test-GetAzureBackupItem
{
$azureBackUpContainer = New-Object Microsoft.Azure.Commands.AzureBackup.Cmdlets.AzureBackupContainer
$azureBackUpContainer.ResourceGroupName = $ResourceGroupName
Expand All @@ -90,7 +91,7 @@ function Test-GetAzureBackupItemTests
}
}

function Test-EnableDisableAzureBackupProtectionTest
function Test-EnableAzureBackupProtection
{
$policy = New-Object Microsoft.Azure.Commands.AzureBackup.Cmdlets.AzureBackupProtectionPolicy
$policy.InstanceId = $PolicyId
Expand All @@ -111,12 +112,22 @@ function Test-EnableDisableAzureBackupProtectionTest
$azureBackUpItem.DataSourceId = $DataSourceId
$azureBackUpItem.Type = $DataSourceType
$azureBackUpItem.Name = $POName

$jobId = Enable-AzureBackupProtection -Item $azureBackUpItem -Policy $policy
sleep(20)

}

function Test-DisableAzureBackupProtection
{
$azureBackUpItem = New-Object Microsoft.Azure.Commands.AzureBackup.Cmdlets.AzureBackupItem
$azureBackUpItem.ResourceGroupName = $ResourceGroupName
$azureBackUpItem.ResourceName = $ResourceName
$azureBackUpItem.Location = $Location
$azureBackUpItem.ContainerUniqueName = $ContainerName
$azureBackUpItem.ContainerType = $ContainerType
$azureBackUpItem.DataSourceId = $DataSourceId
$azureBackUpItem.Type = $DataSourceType
$azureBackUpItem.Name = $POName
$jobId1 = Disable-AzureBackupProtection -Item $azureBackUpItem
sleep(20)
$jobId2 = Enable-AzureBackupProtection -Item $azureBackUpItem -Policy $policy
}

function BackUpAzureBackUpItemTest
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"Entries": [
{
"RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/containers/iaasvmcontainer%3Bdev01testing%3Bdev01testing/datasources/VM/17593283453810/unprotect?api-version=2014-09-01",
"EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vY29udGFpbmVycy9pYWFzdm1jb250YWluZXIlM0JkZXYwMXRlc3RpbmclM0JkZXYwMXRlc3RpbmcvZGF0YXNvdXJjZXMvVk0vMTc1OTMyODM0NTM4MTAvdW5wcm90ZWN0P2FwaS12ZXJzaW9uPTIwMTQtMDktMDE=",
"RequestMethod": "POST",
"RequestBody": "{\r\n \"RemoveProtectionOption\": \"RetainBackupData\"\r\n}",
"RequestHeaders": {
"Content-Type": [
"application/json"
],
"Content-Length": [
"52"
],
"Accept-Language": [
"en-us"
],
"User-Agent": [
"Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0"
]
},
"ResponseBody": "\"2fa60bcf-b87e-4fbf-b1dd-0003ece38f40\"",
"ResponseHeaders": {
"Content-Length": [
"38"
],
"Content-Type": [
"application/json"
],
"Expires": [
"-1"
],
"Pragma": [
"no-cache"
],
"x-ms-request-id": [
"18e31f54-88cd-43e8-969f-0b1cd783cf1f"
],
"x-ms-client-request-id": [
"5ec97812-7689-447c-8218-ffd9841835d9",
"5ec97812-7689-447c-8218-ffd9841835d9"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
"x-ms-ratelimit-remaining-subscription-writes": [
"1193"
],
"x-ms-correlation-request-id": [
"18e31f54-88cd-43e8-969f-0b1cd783cf1f"
],
"x-ms-routing-request-id": [
"CENTRALUS:20150617T085657Z:18e31f54-88cd-43e8-969f-0b1cd783cf1f"
],
"Cache-Control": [
"no-cache"
],
"Date": [
"Wed, 17 Jun 2015 08:56:56 GMT"
],
"Server": [
"Microsoft-IIS/8.0"
],
"X-Powered-By": [
"ASP.NET"
]
},
"StatusCode": 202
}
],
"Names": {},
"Variables": {
"SubscriptionId": "f5303a0b-fae4-4cdb-b44d-0e4c032dde26"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"Entries": [
{
"RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/protectableobjects/protect?api-version=2014-09-01",
"EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vcHJvdGVjdGFibGVvYmplY3RzL3Byb3RlY3Q/YXBpLXZlcnNpb249MjAxNC0wOS0wMQ==",
"RequestMethod": "POST",
"RequestBody": "{\r\n \"ProtectableObjects\": [\r\n \"iaasvmcontainer;dev01testing;dev01testing\"\r\n ],\r\n \"ProtectableObjectType\": \"VM\",\r\n \"PolicyId\": \"c87bbada-6e1b-4db2-b76c-9062d28959a4\"\r\n}",
"RequestHeaders": {
"Content-Type": [
"application/json"
],
"Content-Length": [
"174"
],
"Accept-Language": [
"en-us"
],
"User-Agent": [
"Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0"
]
},
"ResponseBody": "\"a9bab2af-4d9b-40a9-ad02-c5d20973aa52\"",
"ResponseHeaders": {
"Content-Length": [
"38"
],
"Content-Type": [
"application/json"
],
"Expires": [
"-1"
],
"Pragma": [
"no-cache"
],
"x-ms-request-id": [
"31de0e3d-4909-482b-80e1-b3957f16569e"
],
"x-ms-client-request-id": [
"2b2f4905-23d0-44a9-876b-3d6e8e7ca9c2",
"2b2f4905-23d0-44a9-876b-3d6e8e7ca9c2"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
"x-ms-ratelimit-remaining-subscription-writes": [
"1192"
],
"x-ms-correlation-request-id": [
"31de0e3d-4909-482b-80e1-b3957f16569e"
],
"x-ms-routing-request-id": [
"CENTRALUS:20150617T085435Z:31de0e3d-4909-482b-80e1-b3957f16569e"
],
"Cache-Control": [
"no-cache"
],
"Date": [
"Wed, 17 Jun 2015 08:54:35 GMT"
],
"Server": [
"Microsoft-IIS/8.0"
],
"X-Powered-By": [
"ASP.NET"
]
},
"StatusCode": 202
}
],
"Names": {},
"Variables": {
"SubscriptionId": "f5303a0b-fae4-4cdb-b44d-0e4c032dde26"
}
}
Loading