Skip to content

Commit eb7a09f

Browse files
committed
Add DnsAvailablity test
1 parent 460a262 commit eb7a09f

File tree

4 files changed

+127
-0
lines changed

4 files changed

+127
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@
139139
<Compile Include="ScenarioTests\NetworkInterfaceTests.cs" />
140140
<Compile Include="ScenarioTests\LoadBalancerTests.cs" />
141141
<Compile Include="ScenarioTests\NetworkSecurityGroupTests.cs" />
142+
<Compile Include="ScenarioTests\CheckDnsAvailabilityTest.cs" />
142143
<Compile Include="ScenarioTests\VirtualNetworkTests.cs" />
143144
<Compile Include="ScenarioTests\PublicIpAddressTests.cs" />
144145
</ItemGroup>
@@ -159,12 +160,18 @@
159160
<None Include="ScenarioTests\NetworkSecurityGroupTests.ps1">
160161
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
161162
</None>
163+
<None Include="ScenarioTests\CheckDnsAvailabilityTest.ps1">
164+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
165+
</None>
162166
<None Include="ScenarioTests\VirtualNetworkTests.ps1">
163167
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
164168
</None>
165169
<None Include="ScenarioTests\PublicIpAddressTests.ps1">
166170
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
167171
</None>
172+
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.CheckDnsAvailabilityTest\TestCheckDnsAvailability.json">
173+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
174+
</None>
168175
<None Include="SessionRecords\Commands.Network.Test.ScenarioTests.LoadBalancerTests\TestCreateEmptyLoadBalancer.json">
169176
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
170177
</None>
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 Commands.Network.Test.ScenarioTests
19+
{
20+
public class CheckDnsAvailabilityTest
21+
{
22+
[Fact]
23+
[Trait(Category.AcceptanceType, Category.CheckIn)]
24+
public void TestCheckDnsAvailability()
25+
{
26+
NetworkResourcesController.NewInstance.RunPsTest("Test-CheckDnsAvailability");
27+
}
28+
}
29+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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+
Tests creating new simple virtualNetwork.
18+
#>
19+
function Test-CheckDnsAvailability
20+
{
21+
# Setup
22+
$domainQualifiedName = Get-ResourceName
23+
24+
# Checkdnsavailability
25+
$checkdnsavailabilityStatus = Get-AzureCheckDnsAvailability -Location "westus" -DomainQualifiedName $domainQualifiedName
26+
Assert-AreEqual $checkdnsavailabilityStatus.DnsNameAvailability true
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"Entries": [
3+
{
4+
"RequestUri": "/subscriptions/9532a63e-f2eb-4649-bb23-5ed01077ce80/providers/microsoft.network/locations/westus/CheckDnsNameAvailability?domainNameLabel=onesdk9754&api-version=2014-12-01-preview",
5+
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvOTUzMmE2M2UtZjJlYi00NjQ5LWJiMjMtNWVkMDEwNzdjZTgwL3Byb3ZpZGVycy9taWNyb3NvZnQubmV0d29yay9sb2NhdGlvbnMvd2VzdHVzL0NoZWNrRG5zTmFtZUF2YWlsYWJpbGl0eT9kb21haW5OYW1lTGFiZWw9b25lc2RrOTc1NCZhcGktdmVyc2lvbj0yMDE0LTEyLTAxLXByZXZpZXc=",
6+
"RequestMethod": "GET",
7+
"RequestBody": "",
8+
"RequestHeaders": {
9+
"User-Agent": [
10+
"Microsoft.Azure.Management.Network.NetworkResourceProviderClient/1.0.0.0"
11+
]
12+
},
13+
"ResponseBody": "{\r\n \"available\": true\r\n}",
14+
"ResponseHeaders": {
15+
"Content-Length": [
16+
"25"
17+
],
18+
"Content-Type": [
19+
"application/json; charset=utf-8"
20+
],
21+
"Expires": [
22+
"-1"
23+
],
24+
"Pragma": [
25+
"no-cache"
26+
],
27+
"x-ms-request-id": [
28+
"f0d19344-aec0-4d62-94e1-8b7b7d036635"
29+
],
30+
"Strict-Transport-Security": [
31+
"max-age=31536000; includeSubDomains"
32+
],
33+
"Cache-Control": [
34+
"no-cache"
35+
],
36+
"Server": [
37+
"Microsoft-HTTPAPI/2.0",
38+
"Microsoft-HTTPAPI/2.0"
39+
],
40+
"x-ms-ratelimit-remaining-subscription-reads": [
41+
"31994"
42+
],
43+
"x-ms-correlation-request-id": [
44+
"75790eb2-e237-4775-9edf-ea53fa08f0e8"
45+
],
46+
"x-ms-routing-request-id": [
47+
"WESTUS:20150417T054022Z:75790eb2-e237-4775-9edf-ea53fa08f0e8"
48+
],
49+
"Date": [
50+
"Fri, 17 Apr 2015 05:40:22 GMT"
51+
]
52+
},
53+
"StatusCode": 200
54+
}
55+
],
56+
"Names": {
57+
"Test-CheckDnsAvailability": [
58+
"onesdk9754"
59+
]
60+
},
61+
"Variables": {
62+
"SubscriptionId": "9532a63e-f2eb-4649-bb23-5ed01077ce80"
63+
}
64+
}

0 commit comments

Comments
 (0)