Skip to content

Commit 8f21cf8

Browse files
committed
add phase 2 changes to private repo
1 parent f541384 commit 8f21cf8

File tree

68 files changed

+9996
-610
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+9996
-610
lines changed

src/ServiceManagement.StorSimple.sln

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 2013
4-
VisualStudioVersion = 12.0.21005.1
4+
VisualStudioVersion = 12.0.31101.0
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.StorSimple.Library", "Commands.StorSimple.Library\Commands.StorSimple.Library.csproj", "{B0E9C13F-4E03-4DF0-91FA-9A8C76E7422D}"
7-
EndProject
86
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.StorSimple", "ServiceManagement\StorSimple\Commands.StorSimple\Commands.StorSimple.csproj", "{11524D98-6C40-4091-A8E1-86463FEE607C}"
97
EndProject
108
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.StorSimple.Test", "ServiceManagement\StorSimple\Commands.StorSimple.Test\Commands.StorSimple.Test.csproj", "{0FA676D5-1349-4086-B33F-65EC2CB7DA41}"
@@ -15,10 +13,6 @@ Global
1513
Release|Any CPU = Release|Any CPU
1614
EndGlobalSection
1715
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18-
{B0E9C13F-4E03-4DF0-91FA-9A8C76E7422D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19-
{B0E9C13F-4E03-4DF0-91FA-9A8C76E7422D}.Debug|Any CPU.Build.0 = Debug|Any CPU
20-
{B0E9C13F-4E03-4DF0-91FA-9A8C76E7422D}.Release|Any CPU.ActiveCfg = Release|Any CPU
21-
{B0E9C13F-4E03-4DF0-91FA-9A8C76E7422D}.Release|Any CPU.Build.0 = Release|Any CPU
2216
{11524D98-6C40-4091-A8E1-86463FEE607C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2317
{11524D98-6C40-4091-A8E1-86463FEE607C}.Debug|Any CPU.Build.0 = Debug|Any CPU
2418
{11524D98-6C40-4091-A8E1-86463FEE607C}.Release|Any CPU.ActiveCfg = Release|Any CPU

src/ServiceManagement/StorSimple/Commands.StorSimple.Test/Commands.StorSimple.Test.csproj

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\..\..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\..\..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props')" />
43
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
54
<PropertyGroup>
65
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -14,7 +13,7 @@
1413
<FileAlignment>512</FileAlignment>
1514
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\</SolutionDir>
1615
<RestorePackages>true</RestorePackages>
17-
<NuGetPackageImportStamp>3a787dec</NuGetPackageImportStamp>
16+
<NuGetPackageImportStamp>8ec1c917</NuGetPackageImportStamp>
1817
</PropertyGroup>
1918
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
2019
<DebugSymbols>true</DebugSymbols>
@@ -38,29 +37,30 @@
3837
<HintPath>..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll</HintPath>
3938
</Reference>
4039
<Reference Include="Microsoft.Azure.Common">
41-
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll</HintPath>
40+
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.0.4\lib\net45\Microsoft.Azure.Common.dll</HintPath>
4241
</Reference>
43-
<Reference Include="Microsoft.Azure.Common.Authentication">
44-
<HintPath>..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.22-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
42+
<Reference Include="Microsoft.Azure.Common.Authentication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
43+
<SpecificVersion>False</SpecificVersion>
44+
<HintPath>..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.17-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
4545
</Reference>
4646
<Reference Include="Microsoft.Azure.Common.NetFramework">
47-
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
47+
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.0.4\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
4848
</Reference>
4949
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
5050
<SpecificVersion>False</SpecificVersion>
51-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>
51+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.14.1-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>
5252
</Reference>
5353
<Reference Include="Microsoft.Azure.Test.Framework">
54-
<HintPath>..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5571.32271-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll</HintPath>
54+
<HintPath>..\..\..\packages\Microsoft.Azure.Test.Framework.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.Framework.dll</HintPath>
5555
</Reference>
5656
<Reference Include="Microsoft.Azure.Test.HttpRecorder">
57-
<HintPath>..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5571.32271-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll</HintPath>
57+
<HintPath>..\..\..\packages\Microsoft.Azure.Test.HttpRecorder.1.0.5513.27084-prerelease\lib\net45\Microsoft.Azure.Test.HttpRecorder.dll</HintPath>
5858
</Reference>
5959
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory">
6060
<SpecificVersion>False</SpecificVersion>
6161
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.14.201151115\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll</HintPath>
6262
</Reference>
63-
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms">
63+
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms, Version=2.11.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6464
<SpecificVersion>False</SpecificVersion>
6565
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.14.201151115\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll</HintPath>
6666
</Reference>
@@ -81,7 +81,7 @@
8181
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Scheduler.6.0.0\lib\net40\Microsoft.WindowsAzure.Management.Scheduler.dll</HintPath>
8282
</Reference>
8383
<Reference Include="Microsoft.WindowsAzure.Management.StorSimple">
84-
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.StorSimple.0.9.0-preview\lib\net40\Microsoft.WindowsAzure.Management.StorSimple.dll</HintPath>
84+
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.StorSimple.1.0.3-preview\lib\net40\Microsoft.WindowsAzure.Management.StorSimple.dll</HintPath>
8585
</Reference>
8686
<Reference Include="Newtonsoft.Json">
8787
<HintPath>..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
@@ -117,6 +117,7 @@
117117
<ItemGroup>
118118
<Compile Include="Properties\AssemblyInfo.cs" />
119119
<Compile Include="ScenarioTests\BackupPolicyTests.cs" />
120+
<Compile Include="ScenarioTests\BackupTests.cs" />
120121
<Compile Include="ScenarioTests\StorSimpleTestBase.cs" />
121122
</ItemGroup>
122123
<ItemGroup>
@@ -141,27 +142,37 @@
141142
<None Include="ScenarioTests\BackupPolicyTests.ps1">
142143
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
143144
</None>
144-
<None Include="ScenarioTests\Configuration\ConfigurationReader.ps1" />
145+
<None Include="ScenarioTests\BackupTests.ps1">
146+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
147+
</None>
148+
<None Include="ScenarioTests\Configuration\ConfigurationReader.ps1">
149+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
150+
</None>
145151
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.StorSimple.Test.ScenarioTests.BackupPolicyTests\TestNewBackupPolicyAddConfigDefaultValues.json">
146152
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
147153
</None>
148154
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.StorSimple.Test.ScenarioTests.BackupPolicyTests\TestNewBackupPolicyConfig.json">
149155
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
150156
</None>
157+
<None Include="SessionRecords\Microsoft.WindowsAzure.Commands.StorSimple.Test.ScenarioTests.BackupTests\TestCreateGetRestoreDeleteBackup.json">
158+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
159+
</None>
151160
</ItemGroup>
152161
<ItemGroup>
153162
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
154163
</ItemGroup>
155164
<ItemGroup />
156165
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
166+
<PropertyGroup>
167+
<PostBuildEvent>xcopy "$(SolutionDir)Package\$(ConfigurationName)\*.*" $(TargetDir) /Y /E</PostBuildEvent>
168+
</PropertyGroup>
157169
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
158170
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
159171
<PropertyGroup>
160172
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
161173
</PropertyGroup>
162174
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
163175
<Error Condition="!Exists('..\..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
164-
<Error Condition="!Exists('..\..\..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props'))" />
165176
</Target>
166177
<Import Project="..\..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
167178
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

src/ServiceManagement/StorSimple/Commands.StorSimple.Test/ScenarioTests/BackupPolicyTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@ public class BackupPolicyTests:StorSimpleTestBase
2121
{
2222
#region New-AzureStorSimpleDeviceBackupScheduleAddConfig
2323
[Fact]
24-
[Trait("StorSimpleCmdlets", "New-BackupPolicyConfig")]
2524
[Trait(Category.AcceptanceType, Category.CheckIn)]
2625
public void TestNewBackupPolicyConfig()
2726
{
2827
RunPowerShellTest("Test-NewBackupPolicyAddConfig");
2928
}
3029

3130
[Fact]
32-
[Trait("StorSimpleCmdlets", "New-BackupPolicyConfig")]
3331
[Trait(Category.AcceptanceType, Category.CheckIn)]
3432
public void TestNewBackupPolicyAddConfigDefaultValues()
3533
{
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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.WindowsAzure.Commands.ScenarioTest;
16+
using Xunit;
17+
18+
namespace Microsoft.WindowsAzure.Commands.StorSimple.Test.ScenarioTests
19+
{
20+
public class BackupTests : StorSimpleTestBase
21+
{
22+
[Fact]
23+
[Trait(Category.AcceptanceType, Category.CheckIn)]
24+
public void TestCreateGetRestoreDeleteBackup()
25+
{
26+
RunPowerShellTest("Test-CreateGetRestoreDeleteBackup");
27+
}
28+
}
29+
}
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
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+
<#
16+
.SYNOPSIS
17+
Generates unique name with given prefix
18+
#>
19+
function Generate-Name ($prefix)
20+
{
21+
$s = "Test" + $prefix
22+
#$s += "_"
23+
#$s += Get-Random
24+
$s
25+
}
26+
27+
<#
28+
.SYNOPSIS
29+
Polls for a job to finish, and returns the JobStatus object
30+
#>
31+
function Wait-Job ($taskId)
32+
{
33+
do {
34+
[Microsoft.WindowsAzure.Commands.Utilities.Common.TestMockSupport]::Delay(3000) #sleep for 3sec
35+
$taskStatus = Get-AzureStorSimpleTask -InstanceId $taskId
36+
$result = $taskStatus.AsyncTaskAggregatedResult
37+
} while($result -eq [Microsoft.WindowsAzure.Management.StorSimple.Models.AsyncTaskAggregatedResult]"InProgress")
38+
Assert-AreEqual $result ([Microsoft.WindowsAzure.Management.StorSimple.Models.AsyncTaskAggregatedResult]"Succeeded")
39+
}
40+
41+
<#
42+
.SYNOPSIS
43+
Returns default values for the test
44+
#>
45+
function Get-DefaultValue ($key)
46+
{
47+
$defaults = @{
48+
StorageAccountName = "wuscisclcis1diagj5sy4";
49+
StorageAccountPrimaryAccessKey = "gLm0tjCPJAUKzBFEVjN92ZtEwKnQK8MLasuX/ymNwMRQWFGmUA5sWZUZt9u8JfouhhYyzb3v5RQWtZSX+GxMbg==";
50+
StorageAccountSecondaryAccessKey = "zLo+ziNdEX86ffu6OURQFNRL5lrLJpf9J9T8TOk6ne/Mpl7syq1DUp4TIprBt+DGPzo4ytAON+H1N4p6GRwVHg=="
51+
}
52+
53+
return $defaults[$key];
54+
}
55+
56+
<#
57+
.SYNOPSIS
58+
Gets device name to use for the test
59+
#>
60+
function Get-DeviceName ()
61+
{
62+
$selectedResource = Select-AzureStorSimpleResource -ResourceName OneSDK-Resource -RegistrationKey "1975530557201809476:eOqMQdvHon3lGwKVYctxZVnwpZcqi8ZS1uyCLJAl6Wg=:JovQDqP1KyWdh4m3mYkdzQ==#4edfc1cde41104e5"
63+
$deviceName = (Get-AzureStorSimpleDevice) | Where{$_.Status -eq "Online"} | Select-Object -first 1 -wait | Select -ExpandProperty "FriendlyName"
64+
$pass = Assert-NotNull $deviceName
65+
$deviceName
66+
}
67+
68+
<#
69+
.SYNOPSIS
70+
Creates pre-req objects for backup related tests
71+
#>
72+
function SetupObjects-BackupScenario($deviceName, $dcName, $acrName, $iqn, $vdName)
73+
{
74+
$storageAccountName = Get-DefaultValue -key "StorageAccountName"
75+
$storageAccountKey = Get-DefaultValue -Key "StorageAccountPrimaryAccessKey"
76+
$sacToUse = Get-AzureStorSimpleStorageAccountCredential -Name $storageAccountName
77+
if($sacToUse -eq $null)
78+
{
79+
New-AzureStorSimpleStorageAccountCredential -Name $storageAccountName -Key $storageAccountKey -UseSSL $true -WaitForComplete
80+
$sacToUse = Get-AzureStorSimpleStorageAccountCredential -Name $storageAccountName
81+
}
82+
Assert-NotNull $sacToUse
83+
84+
$sacToUse | New-AzureStorSimpleDeviceVolumeContainer -Name $dcName -DeviceName $deviceName -BandWidthRate 256 -WaitForComplete
85+
$dcToUse = Get-AzureStorSimpleDeviceVolumeContainer -DeviceName $deviceName -VolumeContainerName $dcName
86+
Assert-NotNull $dcToUse
87+
88+
New-AzureStorSimpleAccessControlRecord -Name $acrName -iqn $iqn -WaitForComplete
89+
$acrList = @()
90+
$acrList += Get-AzureStorSimpleAccessControlRecord -ACRName $acrName
91+
Assert-AreNotEqual 0 @($acrList).Count
92+
93+
$dcToUse | New-AzureStorSimpleDeviceVolume -DeviceName $deviceName -Name $vdName -Size 2000000000 -AccessControlRecords $acrList -AppType PrimaryVolume -Online $true -EnableDefaultBackup $false -EnableMonitoring $false -WaitForComplete
94+
$vdToUse = Get-AzureStorSimpleDeviceVolume -DeviceName $deviceName -VolumeName $vdName
95+
Assert-NotNull $vdToUse
96+
}
97+
98+
<#
99+
.SYNOPSIS
100+
Deletes pre-req objects for backup related tests
101+
#>
102+
function CleanupObjects-BackupScenario($deviceName, $dcName, $acrName, $vdName)
103+
{
104+
Set-AzureStorSimpleDeviceVolume -DeviceName $deviceName -VolumeName $vdName -Online $false -WaitForComplete
105+
Remove-AzureStorSimpleDeviceVolume -DeviceName $deviceName -VolumeName $vdName -Force -WaitForComplete
106+
107+
Remove-AzureStorSimpleAccessControlRecord -Name $acrName -Force -WaitForComplete
108+
109+
[Microsoft.WindowsAzure.Commands.Utilities.Common.TestMockSupport]::Delay(90000)
110+
Get-AzureStorSimpleDeviceVolumeContainer -DeviceName $deviceName -Name $dcName | Remove-AzureStorSimpleDeviceVolumeContainer -DeviceName $deviceName -Force -WaitForComplete
111+
}
112+
113+
<#
114+
.SYNOPSIS
115+
Creates a custom backup policy
116+
#>
117+
function Create-CustomBackupPolicy($deviceName, $vdName, $bpName)
118+
{
119+
$vdToUse = Get-AzureStorSimpleDeviceVolume -DeviceName $deviceName -VolumeName $vdName
120+
Assert-NotNull $vdToUse
121+
122+
$schedule1 = New-AzureStorSimpleDeviceBackupScheduleAddConfig -BackupType LocalSnapshot -RecurrenceType Daily -RecurrenceValue 10 -RetentionCount 5 -Enabled $true
123+
$schedule2 = New-AzureStorSimpleDeviceBackupScheduleAddConfig -BackupType CloudSnapshot -RecurrenceType Hourly -RecurrenceValue 1 -RetentionCount 5 -Enabled $true
124+
$scheduleArray = @()
125+
$scheduleArray += $schedule1
126+
$scheduleArray += $schedule2
127+
$volumeArray = @()
128+
$volumeArray += $vdToUse.InstanceId
129+
130+
New-AzureStorSimpleDeviceBackupPolicy -DeviceName $deviceName -BackupPolicyName $bpName -BackupSchedulesToAdd $scheduleArray -VolumeIdsToAdd $volumeArray -WaitForComplete
131+
$bpToUse = Get-AzureStorSimpleDeviceBackupPolicy -DeviceName $deviceName -BackupPolicyName $bpName
132+
Assert-NotNull $bpToUse
133+
}
134+
135+
<#
136+
.SYNOPSIS
137+
Tests create, get, restore, delete of backup.
138+
#>
139+
function Test-CreateGetRestoreDeleteBackup
140+
{
141+
# Unique object names
142+
$dcName = Generate-Name("VolumeContainer")
143+
$acrName = Generate-Name("ACR")
144+
$iqn = Generate-Name("IQN")
145+
$vdName = Generate-Name("Volume")
146+
$bpName = Generate-Name("BackupPolicy")
147+
148+
# Setup
149+
$deviceName = Get-DeviceName
150+
SetupObjects-BackupScenario $deviceName $dcName $acrName $iqn $vdName
151+
152+
# Test
153+
Create-CustomBackupPolicy $deviceName $vdName $bpName
154+
$bpToUse = Get-AzureStorSimpleDeviceBackupPolicy -DeviceName $deviceName -BackupPolicyName $bpName
155+
$bpId = $bpToUse.InstanceId
156+
157+
Start-AzureStorSimpleDeviceBackupJob -DeviceName $deviceName -BackupPolicyId $bpId -BackupType CloudSnapshot -WaitForComplete
158+
159+
$retryCount = 0
160+
do {
161+
[Microsoft.WindowsAzure.Commands.Utilities.Common.TestMockSupport]::Delay(5000*$retryCount)
162+
$backupToRestore = Get-AzureStorSimpleDeviceBackup -DeviceName $deviceName -BackupPolicyId $bpId -First 1
163+
$retryCount += 1
164+
} while(($backupToRestore -eq $null) -and ($retryCount -lt 10))
165+
Assert-NotNull $backupToRestore
166+
167+
$backupId = $backupToRestore.InstanceId
168+
169+
Start-AzureStorSimpleDeviceBackupRestoreJob -DeviceName $deviceName -BackupId $backupId -Force -WaitForComplete
170+
171+
Remove-AzureStorSimpleDeviceBackup -DeviceName $deviceName -BackupId $backupId -Force -WaitForComplete
172+
173+
Remove-AzureStorSimpleDeviceBackupPolicy -DeviceName $deviceName -BackupPolicyId $bpId -Force -WaitForComplete
174+
175+
#Cleanup
176+
CleanupObjects-BackupScenario $deviceName $dcName $acrName $vdName
177+
}

0 commit comments

Comments
 (0)