Skip to content

Commit 6ab3233

Browse files
committed
fixed backup/restore test
1 parent 397035f commit 6ab3233

File tree

7 files changed

+2280
-332
lines changed

7 files changed

+2280
-332
lines changed

AzurePowershell.Test.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
<XUnitTests Include=".\src\ServiceManagement\RecoveryServices\Commands.RecoveryServices.Test\bin\Debug\Microsoft.Azure.Commands.RecoveryServices.Test.dll"/>
5858
<XUnitTests Include=".\src\ResourceManager\TrafficManager\Commands.TrafficManager2.Test\bin\Debug\Microsoft.Azure.Commands.TrafficManager.Test.ScenarioTests.dll"/>
5959
<XUnitTests Include=".\src\ServiceManagement\Network\Commands.Network.Test\bin\Debug\Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Test.dll"/>
60+
<XUnitTests Include=".\src\ResourceManager\ApiManagement\Commands.ApiManagement.Test\bin\Debug\Microsoft.Azure.Commands.ApiManagement.Test.dll"/>
6061
</ItemGroup>
6162

6263
<Target Name="InvokeMSTest">

src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/Commands.ApiManagement.Test.csproj

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@
6060
<SpecificVersion>False</SpecificVersion>
6161
<HintPath>..\..\..\Package\Debug\ResourceManager\AzureResourceManager\Resources\Microsoft.Azure.Management.Authorization.dll</HintPath>
6262
</Reference>
63+
<Reference Include="Microsoft.Azure.Management.Compute">
64+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Compute.5.0.1-preview\lib\net40\Microsoft.Azure.Management.Compute.dll</HintPath>
65+
</Reference>
66+
<Reference Include="Microsoft.Azure.Management.Storage">
67+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Storage.2.4.0-preview\lib\net40\Microsoft.Azure.Management.Storage.dll</HintPath>
68+
</Reference>
6369
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6470
<SpecificVersion>False</SpecificVersion>
6571
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>
@@ -98,7 +104,7 @@
98104
</Reference>
99105
<Reference Include="Microsoft.WindowsAzure.Management.Storage, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
100106
<SpecificVersion>False</SpecificVersion>
101-
<HintPath>..\..\..\Package\Debug\ServiceManagement\Azure\Services\Microsoft.WindowsAzure.Management.Storage.dll</HintPath>
107+
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Storage.5.1.1\lib\net40\Microsoft.WindowsAzure.Management.Storage.dll</HintPath>
102108
</Reference>
103109
<Reference Include="Newtonsoft.Json">
104110
<HintPath>..\..\..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath>
@@ -179,7 +185,9 @@
179185
<None Include="SessionRecords\Microsoft.Azure.Commands.ApiManagement.Test.ScenarioTests.ApiManagementTests\TestUpdateApiManagementDeployment.json">
180186
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
181187
</None>
182-
<None Include="SessionRecords\Microsoft.Azure.Commands.ApiManagement.Test.ScenarioTests.ApiManagementTests\TestUpdateApiManagementDeploymentWithHelpersAndPipline.json" />
188+
<None Include="SessionRecords\Microsoft.Azure.Commands.ApiManagement.Test.ScenarioTests.ApiManagementTests\TestUpdateApiManagementDeploymentWithHelpersAndPipline.json">
189+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
190+
</None>
183191
<None Include="testcertificate.pfx">
184192
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
185193
</None>

src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/ScenarioTests/ApiManagementTests.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,28 @@ protected void SetupManagementClients()
4343
var authorizationManagementClient = GetAuthorizationManagementClient();
4444
var managementClient = GetManagementClient();
4545
var storageManagementClient = GetStorageManagementClient();
46+
var armStorageManagementClient = GetArmStorageManagementClient();
4647

4748
_helper.SetupManagementClients(
4849
apiManagementManagementClient,
4950
resourceManagementClient,
5051
galaryClient,
5152
authorizationManagementClient,
5253
managementClient,
53-
storageManagementClient);
54+
//storageManagementClient,
55+
armStorageManagementClient);
5456
}
5557

5658
protected StorageManagementClient GetStorageManagementClient()
5759
{
5860
return TestBase.GetServiceClient<StorageManagementClient>(new RDFETestEnvironmentFactory());
5961
}
6062

63+
protected Management.Storage.StorageManagementClient GetArmStorageManagementClient()
64+
{
65+
return TestBase.GetServiceClient<Management.Storage.StorageManagementClient>(new CSMTestEnvironmentFactory());
66+
}
67+
6168
private ManagementClient GetManagementClient()
6269
{
6370
return TestBase.GetServiceClient<ManagementClient>(new RDFETestEnvironmentFactory());
@@ -133,11 +140,11 @@ private void RunPowerShellTest(params string[] scripts)
133140

134141
//Environment.SetEnvironmentVariable(
135142
// "TEST_CSM_ORGID_AUTHENTICATION",
136-
// "SubscriptionId=bb3f6f90-0996-4c18-8d61-028ab0f0f29b;Environment=Dogfood;AADTenant=83abe5cd-bcc3-441a-bd86-e6a75360cecc");
143+
// "SubscriptionId=;Environment=;AADTenant=");
137144

138145
//Environment.SetEnvironmentVariable(
139146
// "TEST_ORGID_AUTHENTICATION",
140-
// "SubscriptionId=bb3f6f90-0996-4c18-8d61-028ab0f0f29b;Environment=Dogfood");
147+
// "SubscriptionId=;Environment=");
141148
#endif
142149

143150
using (var context = UndoContext.Current)

src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/ScenarioTests/ApiManagementTests.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ function Test-BackupRestoreApiManagement
126126

127127
$storageLocation = Get-ProviderLocation "Microsoft.ClassicStorage/storageAccounts"
128128
$storageAccountName = Get-ApiManagementServiceName
129-
New-AzureStorageAccount -StorageAccountName $storageAccountName -Location $storageLocation
129+
New-AzureStorageAccount -StorageAccountName $storageAccountName -Location $storageLocation -ResourceGroupName $resourceGroupName -Type Standard_LRS
130130

131-
$storageKey = (Get-AzureStorageKey -StorageAccountName $storageAccountName).Primary
131+
$storageKey = (Get-AzureStorageAccountKey -ResourceGroupName $resourceGroupName -StorageAccountName $storageAccountName).Key1
132132
$storageContext = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageKey
133133

134134
$apiManagementName = Get-ApiManagementServiceName
@@ -163,7 +163,7 @@ function Test-BackupRestoreApiManagement
163163
Remove-AzureApiManagement -ResourceGroupName $resourceGroupName -Name $apiManagementName -Force
164164

165165
# Remove storage account
166-
Remove-AzureStorageAccount -StorageAccountName $storageAccountName
166+
Remove-AzureStorageAccount -ResourceGroupName $resourceGroupName -StorageAccountName $storageAccountName
167167

168168
# Remove resource group
169169
Remove-AzureResourceGroup -Name $resourceGroupName -Force

src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/SessionRecords/Microsoft.Azure.Commands.ApiManagement.Test.ScenarioTests.ApiManagementTests/TestBackupRestoreApiManagement.json

Lines changed: 2252 additions & 322 deletions
Large diffs are not rendered by default.

src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/packages.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
<package id="Microsoft.Azure.Common.Authentication" version="1.0.25-preview" targetFramework="net45" />
66
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
77
<package id="Microsoft.Azure.Management.ApiManagement" version="0.3.2-preview" targetFramework="net45" />
8+
<package id="Microsoft.Azure.Management.Compute" version="5.0.1-preview" targetFramework="net45" />
89
<package id="Microsoft.Azure.Management.Resources" version="2.18.0-preview" targetFramework="net45" />
10+
<package id="Microsoft.Azure.Management.Storage" version="2.4.0-preview" targetFramework="net45" />
911
<package id="Microsoft.Azure.Test.Framework" version="1.0.5571.32271-prerelease" targetFramework="net45" />
1012
<package id="Microsoft.Azure.Test.HttpRecorder" version="1.0.5571.32271-prerelease" targetFramework="net45" />
1113
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
@@ -14,6 +16,7 @@
1416
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.14.201151115" targetFramework="net45" />
1517
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
1618
<package id="Microsoft.WindowsAzure.Management" version="4.1.1" targetFramework="net45" />
19+
<package id="Microsoft.WindowsAzure.Management.Storage" version="5.1.1" targetFramework="net45" />
1720
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
1821
<package id="xunit" version="1.9.2" targetFramework="net45" />
1922
<package id="xunit.extensions" version="1.9.2" targetFramework="net45" />

src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ FormatsToProcess = @(
7070
'.\StreamAnalytics\Microsoft.Azure.Commands.StreamAnalytics.format.ps1xml',
7171
'.\Compute\Microsoft.Azure.Commands.Compute.format.ps1xml',
7272
'.\Network\Microsoft.Azure.Commands.Network.format.ps1xml',
73-
'.\Storage\Microsoft.WindowsAzure.Commands.Storage.format.ps1xml',
74-
'.\ApiManagement\Microsoft.Azure.Commands.ApiManagement.format.ps1xml'
73+
'.\Storage\Microsoft.WindowsAzure.Commands.Storage.format.ps1xml'
7574
)
7675

7776
# Modules to import as nested modules of the module specified in ModuleToProcess

0 commit comments

Comments
 (0)