Skip to content

Commit eac543c

Browse files
author
unknown
committed
Add ReservedIp test for PaaS
1 parent 246afed commit eac543c

File tree

7 files changed

+197
-0
lines changed

7 files changed

+197
-0
lines changed

src/ServiceManagement/Compute/Commands.ServiceManagement.Test/Commands.ServiceManagement.Test.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,14 @@
437437
<None Include="Resources\overwrite_VHD.csv" />
438438
<None Include="Resources\package.csv" />
439439
<None Include="Resources\packageADDomain.csv" />
440+
<None Include="Resources\packageReservedIP.csv" />
440441
<None Include="Resources\packageScenario.csv" />
441442
<None Include="Resources\patch_VHD.csv" />
442443
<None Include="Resources\rdpcert.pfx" />
444+
<None Include="Resources\ReservedIPConfig1.cscfg" />
445+
<None Include="Resources\ReservedIPConfig1update.cscfg" />
446+
<None Include="Resources\ReservedIPConfig2.cscfg" />
447+
<None Include="Resources\ReservedIPConfig2update.cscfg" />
443448
<None Include="Resources\resume_VHD.csv" />
444449
<None Include="Resources\SampleAppV1.cscfg" />
445450
<None Include="Resources\SampleAppV2.cscfg" />

src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/LocationBasedReservedIPTests.cs

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,96 @@ public void Cleanup()
6161
Utilities.ExecuteAndLog(() => CleanupService(serviceName), "Delete service");
6262
}
6363

64+
[TestMethod(), Priority(0), TestProperty("Feature", "IaaS"), TestCategory(Category.Network), Owner("hylee"), Description("Test the cmdlets (New-AzureReservedIP,Get-AzureReservedIP,Remove-AzureReservedIP)")]
65+
[DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\Resources\\packageReservedIP.csv", "package#csv", DataAccessMethod.Sequential)]
66+
public void CreateReservedIPThenPaaSVM()
67+
{
68+
try
69+
{
70+
string reservedIpName1 = "ResrvdIP1";
71+
string reservedIpName2 = "ResrvdIP2";
72+
string reservedIpLabel1 = Utilities.GetUniqueShortName("ResrvdIPLbl", 5);
73+
string reservedIpLabel2 = Utilities.GetUniqueShortName("ResrvdIPLbl", 5);
74+
string dnsName = Utilities.GetUniqueShortName("Dns");
75+
//string vmName = Utilities.GetUniqueShortName(vmNamePrefix);
76+
string deploymentName = Utilities.GetUniqueShortName("Depl");
77+
var input1 = new ReservedIPContext()
78+
{
79+
//Address = string.Empty,
80+
DeploymentName = string.Empty,
81+
Label = reservedIpLabel1,
82+
InUse = false,
83+
Location = locationName,
84+
ReservedIPName = reservedIpName1,
85+
State = "Created"
86+
};
87+
88+
var input2 = new ReservedIPContext()
89+
{
90+
//Address = string.Empty,
91+
DeploymentName = string.Empty,
92+
Label = reservedIpLabel2,
93+
InUse = false,
94+
Location = locationName,
95+
ReservedIPName = reservedIpName2,
96+
State = "Created"
97+
};
98+
99+
// Reserve a new IP
100+
Utilities.ExecuteAndLog(() => vmPowershellCmdlets.NewAzureReservedIP(reservedIpName1, locationName, reservedIpLabel1), "Reserve a new IP");
101+
//Get the reserved ip and verify the reserved Ip properties.
102+
VerifyReservedIpNotInUse(input1);
103+
104+
// Reserve a new IP
105+
Utilities.ExecuteAndLog(() => vmPowershellCmdlets.NewAzureReservedIP(reservedIpName2, locationName, reservedIpLabel2), "Reserve a new IP");
106+
//Get the reserved ip and verify the reserved Ip properties.
107+
VerifyReservedIpNotInUse(input2);
108+
109+
vmPowershellCmdlets.NewAzureService(serviceName, locationName);
110+
111+
112+
var _packageName = Convert.ToString(TestContext.DataRow["packageName"]);
113+
var _configName1 = Convert.ToString(TestContext.DataRow["configName1"]);
114+
var _configName2 = Convert.ToString(TestContext.DataRow["configName2"]);
115+
var _configName1update = Convert.ToString(TestContext.DataRow["updateConfig1"]);
116+
var _configName2update = Convert.ToString(TestContext.DataRow["updateConfig2"]);
117+
118+
var _packagePath = new FileInfo(Directory.GetCurrentDirectory() + "\\" + _packageName);
119+
var _configPath1 = new FileInfo(Directory.GetCurrentDirectory() + "\\" + _configName1);
120+
var _configPath2 = new FileInfo(Directory.GetCurrentDirectory() + "\\" + _configName2);
121+
var _configPath1update = new FileInfo(Directory.GetCurrentDirectory() + "\\" + _configName1update);
122+
var _configPath2update = new FileInfo(Directory.GetCurrentDirectory() + "\\" + _configName2update);
123+
124+
125+
vmPowershellCmdlets.NewAzureDeployment(serviceName, _packagePath.FullName, _configPath1.FullName,
126+
DeploymentSlotType.Production, "label", deploymentName, false, false);
127+
128+
vmPowershellCmdlets.NewAzureDeployment(serviceName, _packagePath.FullName, _configPath2.FullName,
129+
DeploymentSlotType.Staging, "label", deploymentName, false, false);
130+
131+
132+
133+
134+
vmPowershellCmdlets.MoveAzureDeployment(serviceName);
135+
136+
vmPowershellCmdlets.GetAzureDeployment(serviceName, DeploymentSlotType.Production);
137+
vmPowershellCmdlets.GetAzureDeployment(serviceName, DeploymentSlotType.Staging);
138+
139+
vmPowershellCmdlets.SetAzureDeploymentConfig(serviceName, DeploymentSlotType.Production, _configPath1update.FullName);
140+
vmPowershellCmdlets.SetAzureDeploymentConfig(serviceName, DeploymentSlotType.Staging, _configPath2update.FullName);
141+
142+
143+
144+
pass = true;
145+
}
146+
catch (Exception ex)
147+
{
148+
pass = false;
149+
Console.WriteLine(ex.ToString());
150+
throw;
151+
}
152+
}
153+
64154
[TestMethod(), Priority(0), TestProperty("Feature", "IaaS"), TestCategory(Category.Network), Owner("hylee"), Description("Test the cmdlets (New-AzureReservedIP,Get-AzureReservedIP,Remove-AzureReservedIP)")]
65155
public void CreateReservedIPThenWindowsVM()
66156
{
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
**********************************************************************************************
4+
5+
This file was generated by a tool from the project file: ServiceConfiguration.Cloud.cscfg
6+
7+
Changes to this file may cause incorrect behavior and will be lost if the file is regenerated.
8+
9+
**********************************************************************************************
10+
-->
11+
<ServiceConfiguration serviceName="SampleApp" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="2" osVersion="*" schemaVersion="2012-10.1.8">
12+
<Role name="WebRole1">
13+
<Instances count="1" />
14+
<ConfigurationSettings>
15+
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
16+
</ConfigurationSettings>
17+
</Role>
18+
<NetworkConfiguration>
19+
<AddressAssignments>
20+
<ReservedIPs>
21+
<ReservedIP name="ResrvdIP1"/>
22+
</ReservedIPs>
23+
</AddressAssignments>
24+
</NetworkConfiguration>
25+
</ServiceConfiguration>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
**********************************************************************************************
4+
5+
This file was generated by a tool from the project file: ServiceConfiguration.Cloud.cscfg
6+
7+
Changes to this file may cause incorrect behavior and will be lost if the file is regenerated.
8+
9+
**********************************************************************************************
10+
-->
11+
<ServiceConfiguration serviceName="SampleApp" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="2" osVersion="*" schemaVersion="2012-10.1.8">
12+
<Role name="WebRole1">
13+
<Instances count="1" />
14+
<ConfigurationSettings>
15+
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
16+
</ConfigurationSettings>
17+
</Role>
18+
<NetworkConfiguration>
19+
<AddressAssignments>
20+
<ReservedIPs>
21+
<ReservedIP name="ResrvdIP1"/>
22+
</ReservedIPs>
23+
</AddressAssignments>
24+
</NetworkConfiguration>
25+
</ServiceConfiguration>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
**********************************************************************************************
4+
5+
This file was generated by a tool from the project file: ServiceConfiguration.Cloud.cscfg
6+
7+
Changes to this file may cause incorrect behavior and will be lost if the file is regenerated.
8+
9+
**********************************************************************************************
10+
-->
11+
<ServiceConfiguration serviceName="SampleApp" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="2" osVersion="*" schemaVersion="2012-10.1.8">
12+
<Role name="WebRole1">
13+
<Instances count="2" />
14+
<ConfigurationSettings>
15+
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
16+
</ConfigurationSettings>
17+
</Role>
18+
<NetworkConfiguration>
19+
<AddressAssignments>
20+
<ReservedIPs>
21+
<ReservedIP name="ResrvdIP2"/>
22+
</ReservedIPs>
23+
</AddressAssignments>
24+
</NetworkConfiguration>
25+
</ServiceConfiguration>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
**********************************************************************************************
4+
5+
This file was generated by a tool from the project file: ServiceConfiguration.Cloud.cscfg
6+
7+
Changes to this file may cause incorrect behavior and will be lost if the file is regenerated.
8+
9+
**********************************************************************************************
10+
-->
11+
<ServiceConfiguration serviceName="SampleApp" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="2" osVersion="*" schemaVersion="2012-10.1.8">
12+
<Role name="WebRole1">
13+
<Instances count="2" />
14+
<ConfigurationSettings>
15+
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
16+
</ConfigurationSettings>
17+
</Role>
18+
<NetworkConfiguration>
19+
<AddressAssignments>
20+
<ReservedIPs>
21+
<ReservedIP name="ResrvdIP2"/>
22+
</ReservedIPs>
23+
</AddressAssignments>
24+
</NetworkConfiguration>
25+
</ServiceConfiguration>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
packageName,configName1,configName2,updateConfig1,updateConfig2
2+
SampleAppV1.cspkg,ReservedIPConfig1.cscfg,ReservedIPConfig2.cscfg,ReservedIPConfig1update.cscfg,ReservedIPConfig2update.cscfg

0 commit comments

Comments
 (0)