Skip to content

Commit baeb2a9

Browse files
authored
Merge pull request #2905 from DeepakRajendranMsft/ahmed
Fixing Pr : #2893
2 parents 34a000e + 1dd3fe2 commit baeb2a9

17 files changed

+6859
-842
lines changed

src/ResourceManager/Network/Commands.Network.Test/Commands.Network.Test.csproj

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,18 @@
6363
<Reference Include="Microsoft.Azure.Management.Authorization">
6464
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
6565
</Reference>
66-
<Reference Include="Microsoft.Azure.Management.Network, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
67-
<SpecificVersion>False</SpecificVersion>
66+
<Reference Include="Microsoft.Azure.Management.Network">
6867
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Network.6.1.1-preview\lib\net45\Microsoft.Azure.Management.Network.dll</HintPath>
6968
<Private>True</Private>
7069
</Reference>
70+
<Reference Include="Microsoft.Azure.Insights">
71+
<HintPath>..\..\..\packages\Microsoft.Azure.Insights.0.13.1-preview\lib\net45\Microsoft.Azure.Insights.dll</HintPath>
72+
<Private>True</Private>
73+
</Reference>
74+
<Reference Include="Microsoft.Azure.Management.Redis">
75+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Redis.3.1.1-preview\lib\net45\Microsoft.Azure.Management.Redis.dll</HintPath>
76+
<Private>True</Private>
77+
</Reference>
7178
<Reference Include="Microsoft.Azure.ResourceManager">
7279
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.20.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>
7380
</Reference>
@@ -361,6 +368,9 @@
361368
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.VirtualNetworkGatewayTests\TestVirtualNetworkExpressRouteGatewayCRUD.json">
362369
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
363370
</None>
371+
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.VirtualNetworkTests\TestResourceNavigationLinksOnSubnetCRUD.json">
372+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
373+
</None>
364374
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.VirtualNetworkTests\TestVirtualNetworkCRUD.json">
365375
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
366376
</None>

src/ResourceManager/Network/Commands.Network.Test/NetworkResourcesController.cs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
using Microsoft.Azure.Commands.Common.Authentication;
1616
using Microsoft.Azure.Gallery;
1717
using Microsoft.Azure.Management.Authorization;
18+
using Microsoft.Azure.Management.Insights;
1819
using Microsoft.Azure.Management.Network;
20+
using Microsoft.Azure.Management.Redis;
1921
using Microsoft.Azure.Management.Resources;
2022
using Microsoft.Azure.Subscriptions;
2123
using Microsoft.Azure.Test;
@@ -44,6 +46,10 @@ public sealed class NetworkResourcesController
4446

4547
public NetworkManagementClient NetworkManagementClient { get; private set; }
4648

49+
public InsightsManagementClient InsightsManagementClient { get; private set; }
50+
51+
public RedisManagementClient RedisManagementClient { get; private set; }
52+
4753
public static NetworkResourcesController NewInstance
4854
{
4955
get
@@ -109,6 +115,8 @@ public void RunPsTestWorkflow(
109115
"ScenarioTests\\" + callingClassName + ".ps1",
110116
helper.RMProfileModule,
111117
helper.RMResourceModule,
118+
helper.GetRMModulePath("AzureRM.Insights.psd1"),
119+
helper.GetRMModulePath("AzureRM.RedisCache.psd1"),
112120
helper.GetRMModulePath("AzureRM.Network.psd1"),
113121
"AzureRM.Resources.ps1");
114122

@@ -141,13 +149,17 @@ private void SetupManagementClients(RestTestFramework.MockContext context)
141149
this.GalleryClient = this.GetGalleryClient();
142150
this.NetworkManagementClient = this.GetNetworkManagementClient(context);
143151
this.AuthorizationManagementClient = this.GetAuthorizationManagementClient();
152+
this.InsightsManagementClient = this.GetInsightsManagementClient();
153+
this.RedisManagementClient = this.GetRedisManagementClient(context);
144154

145155
helper.SetupManagementClients(
146156
ResourceManagementClient,
147157
SubscriptionClient,
148158
GalleryClient,
149159
AuthorizationManagementClient,
150-
this.NetworkManagementClient);
160+
this.NetworkManagementClient,
161+
this.InsightsManagementClient,
162+
this.RedisManagementClient);
151163
}
152164

153165
private AuthorizationManagementClient GetAuthorizationManagementClient()
@@ -169,9 +181,20 @@ private NetworkManagementClient GetNetworkManagementClient(RestTestFramework.Moc
169181
{
170182
return context.GetServiceClient<NetworkManagementClient>(RestTestFramework.TestEnvironmentFactory.GetTestEnvironment());
171183
}
184+
172185
private GalleryClient GetGalleryClient()
173186
{
174187
return TestBase.GetServiceClient<GalleryClient>(this.csmTestFactory);
175188
}
189+
190+
private InsightsManagementClient GetInsightsManagementClient()
191+
{
192+
return TestBase.GetServiceClient<InsightsManagementClient>(this.csmTestFactory);
193+
}
194+
195+
private RedisManagementClient GetRedisManagementClient(RestTestFramework.MockContext context)
196+
{
197+
return context.GetServiceClient<RedisManagementClient>(RestTestFramework.TestEnvironmentFactory.GetTestEnvironment());
198+
}
176199
}
177200
}

src/ResourceManager/Network/Commands.Network.Test/ScenarioTests/Common.ps1

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,16 @@ function Clean-ResourceGroup($rgname)
7575
if ([Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode -ne [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode]::Playback) {
7676
Remove-AzureRmResourceGroup -Name $rgname -Force
7777
}
78+
}
79+
80+
<#
81+
.SYNOPSIS
82+
Sleeps but only during recording.
83+
#>
84+
function Start-TestSleep($milliseconds)
85+
{
86+
if ([Microsoft.Azure.Test.HttpRecorder.HttpMockServer]::Mode -ne [Microsoft.Azure.Test.HttpRecorder.HttpRecorderMode]::Playback)
87+
{
88+
Start-Sleep -Milliseconds $milliseconds
89+
}
7890
}

src/ResourceManager/Network/Commands.Network.Test/ScenarioTests/VirtualNetworkTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,12 @@ public void TestVirtualNetworkPeeringCRUD()
4646
{
4747
NetworkResourcesController.NewInstance.RunPsTest("Test-VirtualNetworkPeeringCRUD");
4848
}
49+
50+
[Fact]
51+
[Trait(Category.AcceptanceType, Category.CheckIn)]
52+
public void TestResourceNavigationLinksOnSubnetCRUD()
53+
{
54+
NetworkResourcesController.NewInstance.RunPsTest("Test-ResourceNavigationLinksCRUD");
55+
}
4956
}
5057
}

0 commit comments

Comments
 (0)