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 @@ -39,9 +39,6 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.25-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.BackupServicesManagment">
<HintPath>..\..\..\..\..\azure-sdk-for-net\src\ResourceManagement\AzureBackup\BackupServicesManagment\bin\Net45-Debug\Microsoft.Azure.Management.BackupServicesManagment.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 @@ -129,10 +126,15 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ScenarioTests\BackupItemTests.cs" />
<Compile Include="ScenarioTests\AzureBackupJobTests.cs" />
<Compile Include="ScenarioTests\ContainerTest\AzureBackupContainerTest.cs" />
<Compile Include="ScenarioTests\RecoveryPointTests.cs" />
<Compile Include="ScenarioTests\AzureBackupContainerTests.cs" />
<Compile Include="ScenarioTests\AzureBackupVaultTests.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\azure-sdk-for-net\src\ResourceManagement\AzureBackup\BackupServicesManagment\BackupServicesManagment.csproj">
<Project>{38a6741c-77a3-42a8-a846-83373be57c7f}</Project>
<Name>BackupServicesManagment</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Common\Commands.Common\Commands.Common.csproj">
<Project>{5ee72c53-1720-4309-b54b-5fb79703195f}</Project>
<Name>Commands.Common</Name>
Expand Down Expand Up @@ -168,17 +170,26 @@
<None Include="ScenarioTests\AzureBackupJobTests.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ScenarioTests\ContainerTest\AzureBackupContainerTest.ps1" />
<None Include="ScenarioTests\RecoveryPointTests.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests\GetAzureBackupContainerTests.json" />
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests\RegisterAzureBackupContainerTest.json" />
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupContainerTests\UnregisterAzureBackupContainerTest.json" />
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupItemTestCases\DisableAzureBackupProtectionTest.json" />
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupItemTestCases\EnableAzureBackupProtectionTest.json" />
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupItemTestCases\ListAzureBackupItemTests.json" />
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupJobTests\GetAzureBackupJobTests.json" />
<None Include="ScenarioTests\AzureBackupContainerTests.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="ScenarioTests\AzureBackupVaultTests.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupTests\ListProtectionPolicyTests.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.AzureBackupVaultTests\GetAzureBackupVaultCredentialsTests.json" />
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.BackupItemTests\BackUpAzureBackUpItem.json" />
<None Include="SessionRecords\Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests.RecoveryPointTests\GetRecoveryPointTests.json" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,25 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.WindowsAzure.Commands.ScenarioTest;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;

namespace Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests
{
public class AzureBackupContainerTest : AzureBackupTestsBase
public class AzureBackupContainerTests : AzureBackupTestsBase
{
[Fact]
public void GetAzureBackupContainerTests()
{
this.RunPowerShellTest("Test-GetAzureBackupContainerWithoutFilterReturnsNonZeroContainers");

this.RunPowerShellTest("Test-GetAzureBackupContainerWithUniqueFilterReturnsOneContainer");
}

[Fact]
public void RegisterAzureBackupContainerTest()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# ----------------------------------------------------------------------------------
#
# 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.
# ----------------------------------------------------------------------------------

$ResourceGroupName = "backuprg"
$ResourceName = "backuprn"
$Location = "SouthEast Asia"
$ContainerResourceGroupName = "dev01Testing"
$ContainerResourceName = "dev01Testing"

<#
.SYNOPSIS
Tests to test list containers
#>
function Test-GetAzureBackupContainerWithoutFilterReturnsNonZeroContainers
{
$containers = Get-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location
Assert-NotNull $containers 'Container list should not be null';
}

function Test-GetAzureBackupContainerWithUniqueFilterReturnsOneContainer
{
$container = Get-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -ContainerResourceGroupName $ContainerResourceGroupName -ContainerResourceName $ContainerResourceName
Assert-NotNull $container 'Container should not be null';
Assert-AreEqual $container.ResourceName $ContainerResourceName -CaseSensitive 'Returned container resource name (a.k.a friendly name) does not match the test VM resource name';
Assert-AreEqual $container.ResourceGroupName $ContainerResourceGroupName -CaseSensitive 'Returned container resource group name (a.k.a parent friendly name) does not match the test VM resource group name';
}

<#
.SYNOPSIS
Tests to register the container
#>
function Test-RegisterAzureBackupContainer
{
$jobId = Register-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -location $Location -Name $ContainerResourceName -ServiceName $ContainerResourceGroupName

Assert-NotNull $jobId 'JobID should not be null';
}

function Test-UnregisterAzureBackupContainer
{
$container = Get-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -location $Location -ContainerResourceName $ContainerResourceName -ContainerResourceGroupName $ContainerResourceGroupName
$jobId = Unregister-AzureBackupContainer -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -location $Location -AzureBackupContainer $container

Assert-NotNull $jobId 'JobID should not be null';
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
$ResourceGroupName = "backuprg"
$ResourceName = "backuprn"
$ContainerName = "iaasvmcontainer;dev01testing;dev01testing"
$ContainerResourceGroupName = "dev01Testing"
$ContainerResourceName = "dev01Testing"
$ContainerType = "IaasVMContainer"
$DataSourceType = "VM"
$DataSourceId = "17593283453810"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// ----------------------------------------------------------------------------------
//
// 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 System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;

namespace Microsoft.Azure.Commands.AzureBackup.Test.ScenarioTests
{
public class AzureBackupVaultTests : AzureBackupTestsBase
{
[Fact]
public void GetAzureBackupVaultCredentialsTests()
{
this.RunPowerShellTest("Test-GetAzureBackupVaultCredentialsReturnsFileNameAndDownloadsCert");
}

[Fact]
public void SetAzureBackupVaultStorageTypeTests()
{
this.RunPowerShellTest("Test-SetAzureBackupVaultStorageTypeWithFreshResourceDoesNotThrowException");

this.RunPowerShellTest("Test-SetAzureBackupVaultStorageTypeWithLockedResourceThrowsException");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# ----------------------------------------------------------------------------------
#
# 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.
# ----------------------------------------------------------------------------------

$ResourceGroupName = "backuprg"
$ResourceName = "backuprn"
$Location = "SouthEast Asia"
$CertTargetLocation = (Get-Item -Path ".\" -Verbose).FullName;

function Test-GetAzureBackupVaultCredentialsReturnsFileNameAndDownloadsCert
{
$fileName = Get-AzureBackupVaultCredentials -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -TargetLocation $CertTargetLocation
Assert-NotNull $fileName 'File name should not be null';
$certFileFullPath = [io.path]::combine($CertTargetLocation, $fileName);
Assert-True {{ Test-Path $certFileFullPath }}
}

function Test-SetAzureBackupVaultStorageTypeWithFreshResourceDoesNotThrowException
{
# TODO: Create a new resource and use it for these calls. At the end, delete it.

Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type GeoRedundant

Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type LocallyRedundant

Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type GeoRedundant

Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type LocallyRedundant
}

function Test-SetAzureBackupVaultStorageTypeWithLockedResourceThrowsException
{
# One of them is bound to fail

Assert-Throws { Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type GeoRedundant }

Assert-Throws { Set-AzureBackupVaultStorageType -ResourceGroupName $ResourceGroupName -ResourceName $ResourceName -Location $Location -Type LocallyRedundant }
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"Entries": [
{
"RequestUri": "/Subscriptions/f5303a0b-fae4-4cdb-b44d-0e4c032dde26/resourceGroups/backuprg/providers/Microsoft.Backupseadev01/BackupVault/backuprn/containers?api-version=2014-09-01&dummy=%26FriendlyName%3Ddev01Testing",
"EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjUzMDNhMGItZmFlNC00Y2RiLWI0NGQtMGU0YzAzMmRkZTI2L3Jlc291cmNlR3JvdXBzL2JhY2t1cHJnL3Byb3ZpZGVycy9NaWNyb3NvZnQuQmFja3Vwc2VhZGV2MDEvQmFja3VwVmF1bHQvYmFja3Vwcm4vY29udGFpbmVycz9hcGktdmVyc2lvbj0yMDE0LTA5LTAxJmR1bW15PSUyNkZyaWVuZGx5TmFtZSUzRGRldjAxVGVzdGluZw==",
"RequestMethod": "GET",
"RequestBody": "",
"RequestHeaders": {
"Accept-Language": [
"en-us"
],
"x-ms-version": [
"2013-03-01"
],
"User-Agent": [
"Microsoft.Azure.Management.BackupServices.BackupServicesManagementClient/0.0.0.0"
]
},
"ResponseBody": "{\r\n \"Objects\": [\r\n {\r\n \"FriendlyName\": \"dev01Testing\",\r\n \"SubscriptionId\": \"f5303a0b-fae4-4cdb-b44d-0e4c032dde26\",\r\n \"ContainerType\": \"IaasVMContainer\",\r\n \"ParentContainerName\": \"dev01Testing\",\r\n \"ParentContainerFriendlyName\": \"dev01Testing\",\r\n \"RegistrationStatus\": \"Registered\",\r\n \"HealthStatus\": \"Healthy\",\r\n \"PropertyBag\": null,\r\n \"InstanceId\": null,\r\n \"Name\": \"iaasvmcontainer;dev01testing;dev01testing\",\r\n \"OperationInProgress\": false\r\n },\r\n {\r\n \"FriendlyName\": \"dev01Testing\",\r\n \"SubscriptionId\": \"f5303a0b-fae4-4cdb-b44d-0e4c032dde26\",\r\n \"ContainerType\": \"IaasVMServiceContainer\",\r\n \"ParentContainerName\": null,\r\n \"ParentContainerFriendlyName\": null,\r\n \"RegistrationStatus\": \"NotRegistered\",\r\n \"HealthStatus\": \"Healthy\",\r\n \"PropertyBag\": \"\",\r\n \"InstanceId\": null,\r\n \"Name\": \"dev01testing\",\r\n \"OperationInProgress\": false\r\n }\r\n ],\r\n \"ResultCount\": 2,\r\n \"Skiptoken\": null\r\n}",
"ResponseHeaders": {
"Content-Length": [
"763"
],
"Content-Type": [
"application/json"
],
"Expires": [
"-1"
],
"Pragma": [
"no-cache"
],
"x-ms-request-id": [
"ce4dfbf6-9708-49f2-9532-0dbc9e912bf7"
],
"x-ms-client-request-id": [
"0482c73c-7196-49f8-96a0-3dcd0ccdaa90",
"0482c73c-7196-49f8-96a0-3dcd0ccdaa90"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
"x-ms-ratelimit-remaining-subscription-reads": [
"14997"
],
"x-ms-correlation-request-id": [
"ce4dfbf6-9708-49f2-9532-0dbc9e912bf7"
],
"x-ms-routing-request-id": [
"CENTRALUS:20150617T170930Z:ce4dfbf6-9708-49f2-9532-0dbc9e912bf7"
],
"Cache-Control": [
"no-cache"
],
"Date": [
"Wed, 17 Jun 2015 17:09:30 GMT"
],
"Server": [
"Microsoft-IIS/8.0"
],
"X-Powered-By": [
"ASP.NET"
]
},
"StatusCode": 200
}
],
"Names": {},
"Variables": {
"SubscriptionId": "f5303a0b-fae4-4cdb-b44d-0e4c032dde26"
}
}
Loading