Skip to content

Commit 6e266b7

Browse files
committed
Placeholder for policy tests
1 parent bd69d78 commit 6e266b7

File tree

6 files changed

+67
-98
lines changed

6 files changed

+67
-98
lines changed

src/ResourceManager/RecoveryServices.Backup/Cmdlets/ProtectionPolicy/GetAzureRMBackupRetentionPolicyObject.cs

Lines changed: 0 additions & 48 deletions
This file was deleted.

src/ResourceManager/RecoveryServices.Backup/Cmdlets/ProtectionPolicy/GetAzureRMBackupSchedulePolicyObject.cs

Lines changed: 0 additions & 48 deletions
This file was deleted.

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Cmdlets.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@
7676
<Compile Include="Cmdlets\ProtectionPolicy\GetAzureRmRecoveryServicesBackupRetentionPolicyObject.cs" />
7777
<Compile Include="Cmdlets\ProtectionPolicy\GetAzureRmRecoveryServicesPolicy.cs" />
7878
<Compile Include="Cmdlets\ProtectionPolicy\GetAzureRmRecoveryServicesSchedulePolicyObject.cs" />
79-
<Compile Include="Cmdlets\ProtectionPolicy\GetAzureRMBackupSchedulePolicyObject.cs" />
80-
<Compile Include="Cmdlets\ProtectionPolicy\GetAzureRMBackupRetentionPolicyObject.cs" />
8179
<Compile Include="Cmdlets\ProtectionPolicy\PolicyCmdletHelpers.cs" />
8280
<Compile Include="Cmdlets\ProtectionPolicy\SetAzureRmRecoveryServicesPolicy.cs" />
8381
<Compile Include="Cmdlets\ProtectionPolicy\NewAzureRmRecoveryServicesPolicy.cs" />

src/ResourceManager/RecoveryServices.Backup/Commands.RecoveryServices.Backup.Test/Commands.RecoveryServices.Backup.Test.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,13 @@
7272
</ItemGroup>
7373
<ItemGroup>
7474
<Compile Include="Properties\AssemblyInfo.cs" />
75+
<None Include="ScenarioTests\IaasVm\PolicyTests.ps1">
76+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
77+
</None>
7578
<None Include="ScenarioTests\IaasVm\ContainerTests.ps1">
7679
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
7780
</None>
81+
<Compile Include="ScenarioTests\IaasVm\PolicyTests.cs" />
7882
<Compile Include="ScenarioTests\IaasVm\ContainerTests.cs" />
7983
<Compile Include="ScenarioTests\TestsBase.cs" />
8084
<None Include="SessionRecords\Microsoft.Azure.Commands.RecoveryServices.Backup.Test.ScenarioTests.ContainerTests\TestGetContainerScenario.json">
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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.RecoveryServices.Backup.Cmdlets.Models;
16+
using System;
17+
using System.Collections.Generic;
18+
using System.Linq;
19+
using System.Text;
20+
using System.Threading.Tasks;
21+
using Xunit;
22+
23+
namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Test.ScenarioTests
24+
{
25+
public partial class ContainerTests : RecoveryServicesBackupTestsBase
26+
{
27+
[Fact]
28+
public void TestPolicyScenario()
29+
{
30+
this.RunPowerShellTest(PsBackupProviderTypes.IaasVm.ToString(), "Test-PolicyScenario");
31+
}
32+
}
33+
}
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+
function Test-PolicyScenario
16+
{
17+
$vault = Get-AzureRmRecoveryServicesVault -ResourceGroupName "phaniktRSV" -Name "phaniktRs1";
18+
$containers = Get-AzureRmRecoveryServicesContainer -Vault $vault -ContainerType "AzureVM" -Status "Registered";
19+
foreach ($container in $containers)
20+
{
21+
echo $container.Name $container.ResourceGroupName;
22+
}
23+
Assert-AreEqual $containers[0].Name "mylinux1";
24+
25+
$namedContainer = Get-AzureRmRecoveryServicesContainer -Vault $vault -ContainerType "AzureVM" -Status "Registered" -Name "mylinux1";
26+
Assert-AreEqual $namedContainer.Name "mylinux1";
27+
28+
$rgFilteredContainer = Get-AzureRmRecoveryServicesContainer -Vault $vault -ContainerType "AzureVM" -Status "Registered" -Name "mylinux1" -ResourceGroupName "00prjai12";
29+
echo $rgFilteredContainer.Name $rgFilteredContainer.ResourceGroupName;
30+
}

0 commit comments

Comments
 (0)