Skip to content

Commit

Permalink
Merge pull request #465 from hyonholee/dev
Browse files Browse the repository at this point in the history
Some test fixes for AzureRT tests.
  • Loading branch information
ogail committed Jun 6, 2015
2 parents ef7bb2a + 2523d79 commit b690811
Show file tree
Hide file tree
Showing 10 changed files with 168 additions and 133 deletions.
23 changes: 8 additions & 15 deletions AzurePowershell.Test.targets
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<ComputeTestDebug>.\src\ResourceManager\Compute\Commands.Compute.Test\bin\Debug\Microsoft.Azure.Commands.Compute.Test.dll</ComputeTestDebug>
<NetworkTestDebug>.\src\ResourceManager\Network\Commands.Network.Test\bin\Debug\Microsoft.Azure.Commands.Network.Test.dll</NetworkTestDebug>
<AzureRTTestSettings>.\src\AzureRT.testsettings</AzureRTTestSettings>
<AzureRTSeqTestSettings>.\src\AzureRTSeq.testsettings</AzureRTSeqTestSettings>
<AzureRTTestContainer>.\src\ServiceManagement\Compute\Commands.ServiceManagement.Test\bin\Debug\Microsoft.WindowsAzure.Commands.ServiceManagement.Test.dll</AzureRTTestContainer>
<StorageScenarioTestDebug>src\ServiceManagement\Storage\Commands.Storage.ScenarioTest\bin\Debug\CLITest.dll</StorageScenarioTestDebug>
<ManagementTestDebug>.\src\ServiceManagement\Services\Commands.Test\bin\Debug\Microsoft.WindowsAzure.Commands.Test.dll</ManagementTestDebug>
Expand Down Expand Up @@ -265,19 +266,11 @@
ContinueOnError="false" />
</Target>

<Target Name="AzureRTBVTsSeq" DependsOnTargets="Clean;BuildDebug;BeforeRunTests">
<Message Importance="high" Text="Running AzureRT BVT tests..." />
<Delete Files="$(TestOutputDirectory)\RTBVTDebug.trx" />
<Exec
Command="MSTest.exe /testcontainer:$(AzureRTTestContainer) /testsettings:$(TestSettings) /category:BVT /resultsfile:$(TestOutputDirectory)\RTBVTDebug.trx"
ContinueOnError="false" />
</Target>

<Target Name="AzureRTOne" DependsOnTargets="Clean;BuildDebug;BeforeRunTests">
<Message Importance="high" Text="Running a specific tests..." />
<Delete Files="$(TestOutputDirectory)\RTFunctionalDebug.trx" />
<Exec
Command="MSTest.exe /testcontainer:$(AzureRTTestContainer) /testsettings:$(TestSettings) /test:$(TestName) /resultsfile:$(TestOutputDirectory)\RTFunctionalDebug.trx"
Command="MSTest.exe /testcontainer:$(AzureRTTestContainer) /testsettings:$(AzureRTSeqTestSettings) /test:$(TestName) /resultsfile:$(TestOutputDirectory)\RTFunctionalDebug.trx"
ContinueOnError="false" />
</Target>

Expand All @@ -293,15 +286,15 @@
<Message Importance="high" Text="Running tests:" />
<Delete Files="$(TestOutputDirectory)\RTFunctionalDebug.trx" />
<Exec
Command="MSTest.exe /testcontainer:$(AzureRTTestContainer) /testsettings:$(TestSettings) $(TestParams) /resultsfile:$(TestOutputDirectory)\RTFunctionalDebug.trx"
Command="MSTest.exe /testcontainer:$(AzureRTTestContainer) /testsettings:$(AzureRTSeqTestSettings) $(TestParams) /resultsfile:$(TestOutputDirectory)\RTFunctionalDebug.trx"
ContinueOnError="false" />
</Target>

<Target Name="AzureRTAll" DependsOnTargets="Clean;BuildDebug;BeforeRunTests">
<Message Importance="high" Text="Running AzureRT all tests..." />
<Delete Files="$(TestOutputDirectory)\RTDebug.trx" />
<Exec
Command="MSTest.exe /testcontainer:$(AzureRTTestContainer) /testsettings:$(TestSettings) /category:$(AzureRTAllTestFilter) /resultsfile:$(TestOutputDirectory)\RTDebug.trx"
Command="MSTest.exe /testcontainer:$(AzureRTTestContainer) /testsettings:$(AzureRTSeqTestSettings) /category:$(AzureRTAllTestFilter) /resultsfile:$(TestOutputDirectory)\RTDebug.trx"
ContinueOnError="false" />
</Target>

Expand All @@ -311,7 +304,7 @@
<Delete Files="$(TestOutputDirectory)\RTSequentialDebug.trx" />
<Delete Files="$(TestOutputDirectory)\RTDebug.trx" />
<Exec
Command="MSTest.exe /testcontainer:$(AzureRTTestContainer) /testsettings:$(TestSettings) /category:$(AzureRTSeqAllFilter) /resultsfile:$(TestOutputDirectory)\RTSequentialDebug.trx"
Command="MSTest.exe /testcontainer:$(AzureRTTestContainer) /testsettings:$(AzureRTSeqTestSettings) /category:$(AzureRTSeqAllFilter) /resultsfile:$(TestOutputDirectory)\RTSequentialDebug.trx"
ContinueOnError="true" />
<Exec
Command="MSTest.exe /testcontainer:$(AzureRTTestContainer) /testsettings:$(AzureRTTestSettings) /category:$(AzureRTParAllFilter) /resultsfile:$(TestOutputDirectory)\RTDebug.trx"
Expand All @@ -323,7 +316,7 @@

<Delete Files="$(TestOutputDirectory)\RTSequentialDebug.trx" />
<Exec
Command="MSTest.exe /testcontainer:$(AzureRTTestContainer) /testsettings:$(TestSettings) /category:$(AzureRTSeqAllFilter) /resultsfile:$(TestOutputDirectory)\RTSequentialDebug.trx"
Command="MSTest.exe /testcontainer:$(AzureRTTestContainer) /testsettings:$(AzureRTSeqTestSettings) /category:$(AzureRTSeqAllFilter) /resultsfile:$(TestOutputDirectory)\RTSequentialDebug.trx"
ContinueOnError="true" />
</Target>

Expand All @@ -332,7 +325,7 @@

<Delete Files="$(TestOutputDirectory)\RTSequentialDebug.trx" />
<Exec
Command="MSTest.exe /testcontainer:$(AzureRTTestContainer) /testsettings:$(TestSettings) /category:Network /resultsfile:$(TestOutputDirectory)\RTSequentialDebug.trx"
Command="MSTest.exe /testcontainer:$(AzureRTTestContainer) /testsettings:$(AzureRTSeqTestSettings) /category:Network /resultsfile:$(TestOutputDirectory)\RTSequentialDebug.trx"
ContinueOnError="false" />
</Target>

Expand All @@ -341,7 +334,7 @@

<Delete Files="$(TestOutputDirectory)\RTSequentialDebug.trx" />
<Exec
Command="MSTest.exe /testcontainer:$(AzureRTTestContainer) /testsettings:$(TestSettings) /category:$(AzureRTUploadSeqFilter) /resultsfile:$(TestOutputDirectory)\RTSequentialDebug.trx"
Command="MSTest.exe /testcontainer:$(AzureRTTestContainer) /testsettings:$(AzureRTSeqTestSettings) /category:$(AzureRTUploadSeqFilter) /resultsfile:$(TestOutputDirectory)\RTSequentialDebug.trx"
ContinueOnError="false" />
</Target>

Expand Down
15 changes: 15 additions & 0 deletions src/AzureRTSeq.testsettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<TestSettings
id="bbc9ef85-493f-459f-bc76-434f1966c32c"
name="AzureRTSeq"
enableDefaultDataCollectors="false"
xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<Description>These are test settings for AzureRT test run.</Description>
<Deployment>
<DeploymentItem filename="ServiceManagement\Compute\Commands.ServiceManagement.Test\Resources\" />
<DeploymentItem filename="Package\Debug\" />
</Deployment>
<Execution parallelTestCount="1">
<Timeouts testTimeout="3000000" />
</Execution>
</TestSettings>
Original file line number Diff line number Diff line change
Expand Up @@ -423,64 +423,132 @@
<None Include="AzureRTExtensions.playlist" />
<None Include="AzureRTFull.playlist" />
<None Include="Resources\HelloWorld_SDK20.cspkg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\ServiceConfiguration.cscfg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="MSSharedLibKey.snk" />
<None Include="packages.config" />
<None Include="Resources\affinityGroupData.csv" />
<None Include="Resources\certificateData.csv" />
<None Include="Resources\affinityGroupData.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\certificateData.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\CustomData.bin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\cloudinittest.sh">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\download_VHD.csv" />
<None Include="Resources\DSC\DscExtensionTestConfigurationData.psd1" />
<None Include="Resources\HelloNoDiag.cscfg" />
<None Include="Resources\nodiagpackage.csv" />
<None Include="Resources\OneWebOneWorker.cscfg" />
<None Include="Resources\OneWebOneWorkerRDP.cscfg" />
<None Include="Resources\overwrite_VHD.csv" />
<None Include="Resources\package.csv" />
<None Include="Resources\packageADDomain.csv" />
<None Include="Resources\packageReservedIP.csv" />
<None Include="Resources\packageScenario.csv" />
<None Include="Resources\patch_VHD.csv" />
<None Include="Resources\rdpcert.pfx" />
<None Include="Resources\ReservedIPConfig1.cscfg" />
<None Include="Resources\ReservedIPConfig1update.cscfg" />
<None Include="Resources\ReservedIPConfig2.cscfg" />
<None Include="Resources\ReservedIPConfig2update.cscfg" />
<None Include="Resources\resume_VHD.csv" />
<None Include="Resources\SampleAppV1.cscfg" />
<None Include="Resources\SampleAppV2.cscfg" />
<None Include="Resources\SampleAppV3.cscfg" />
<None Include="Resources\StaticCAvnetconfig.netcfg" />
<None Include="Resources\storageAccountTestData.csv" />
<None Include="Resources\DSC\DscExtensionTestConfiguration.ps1" />
<None Include="Resources\test1.ps1" />
<None Include="Resources\test2.ps1" />
<None Include="Resources\thread_VHD.csv" />
<None Include="Resources\upload_VHD.csv" />
<None Include="Resources\vnetconfig.netcfg" />
<None Include="Resources\download_VHD.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\DSC\DscExtensionTestConfigurationData.psd1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\HelloNoDiag.cscfg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\nodiagpackage.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\OneWebOneWorker.cscfg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\OneWebOneWorkerRDP.cscfg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\overwrite_VHD.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\package.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\packageADDomain.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\packageReservedIP.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\packageScenario.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\patch_VHD.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\rdpcert.pfx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\ReservedIPConfig.cscfg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\ReservedIPConfigupdate.cscfg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\resume_VHD.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\SampleAppV1.cscfg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\SampleAppV2.cscfg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\SampleAppV3.cscfg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\StaticCAvnetconfig.netcfg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\storageAccountTestData.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\DSC\DscExtensionTestConfiguration.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\test1.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\test2.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\thread_VHD.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\upload_VHD.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\vnetconfig.netcfg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\VnetconfigWithLocation.netcfg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\wrongPara_VHD.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\wrongPara_VHD.csv" />
</ItemGroup>
<ItemGroup>
<Content Include="FunctionalTests\ExtensionTests\MicrosoftAntimalware\AntimalwareConfig.xml" />
<Content Include="FunctionalTests\Readme.txt" />
<Content Include="lib\Security.Cryptography.dll" />
<Content Include="Resources\clxtshar.dll" />
<Content Include="Resources\da.xml" />
<Content Include="Resources\PrivateConfig.xml" />
<Content Include="Resources\PublicConfig.xml" />
<Content Include="Resources\VmAccessExtensionConfiguration.xml" />
<Content Include="Resources\clxtshar.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Resources\da.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Resources\PrivateConfig.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Resources\PublicConfig.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Resources\VmAccessExtensionConfiguration.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Folder Include="TestScripts\" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
using Microsoft.WindowsAzure.Commands.ServiceManagement.Model;
using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.ConfigDataInfo;

using System.Threading;

namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests
{
[TestClass]
Expand Down Expand Up @@ -72,7 +74,9 @@ public void CreateReservedIPThenPaaSVM()
string reservedIpLabel1 = Utilities.GetUniqueShortName("ResrvdIPLbl", 5);
string reservedIpLabel2 = Utilities.GetUniqueShortName("ResrvdIPLbl", 5);
string dnsName = Utilities.GetUniqueShortName("Dns");
string deploymentName = Utilities.GetUniqueShortName("Depl");
string deploymentName1 = Utilities.GetUniqueShortName("Depl");
string deploymentName2 = Utilities.GetUniqueShortName("Depl");

var input1 = new ReservedIPContext()
{
DeploymentName = string.Empty,
Expand All @@ -95,48 +99,41 @@ public void CreateReservedIPThenPaaSVM()

// Reserve a new IP
Utilities.ExecuteAndLog(() => vmPowershellCmdlets.NewAzureReservedIP(reservedIpName1, locationName, reservedIpLabel1), "Reserve a new IP");

//Get the reserved ip and verify the reserved Ip properties.
VerifyReservedIpNotInUse(input1);

// Reserve a new IP
Utilities.ExecuteAndLog(() => vmPowershellCmdlets.NewAzureReservedIP(reservedIpName2, locationName, reservedIpLabel2), "Reserve a new IP");

//Get the reserved ip and verify the reserved Ip properties.
VerifyReservedIpNotInUse(input2);

vmPowershellCmdlets.NewAzureService(serviceName, locationName);


var _packageName = Convert.ToString(TestContext.DataRow["packageName"]);
var _configName1 = Convert.ToString(TestContext.DataRow["configName1"]);
var _configName2 = Convert.ToString(TestContext.DataRow["configName2"]);
var _configName1update = Convert.ToString(TestContext.DataRow["updateConfig1"]);
var _configName2update = Convert.ToString(TestContext.DataRow["updateConfig2"]);

var _packagePath = new FileInfo(Directory.GetCurrentDirectory() + "\\" + _packageName);
var _configPath1 = new FileInfo(Directory.GetCurrentDirectory() + "\\" + _configName1);
var _configPath2 = new FileInfo(Directory.GetCurrentDirectory() + "\\" + _configName2);
var _configPath1update = new FileInfo(Directory.GetCurrentDirectory() + "\\" + _configName1update);
var _configPath2update = new FileInfo(Directory.GetCurrentDirectory() + "\\" + _configName2update);


vmPowershellCmdlets.NewAzureDeployment(serviceName, _packagePath.FullName, _configPath1.FullName,
DeploymentSlotType.Production, "label", deploymentName, false, false);

vmPowershellCmdlets.NewAzureDeployment(serviceName, _packagePath.FullName, _configPath2.FullName,
DeploymentSlotType.Staging, "label", deploymentName, false, false);
var _configName = Convert.ToString(TestContext.DataRow["configName"]);
var _configNameupdate = Convert.ToString(TestContext.DataRow["updateConfig"]);

string _packagePath = (new FileInfo(Directory.GetCurrentDirectory() + "\\" + _packageName)).FullName;
string _configPath1 = StoreConfigFileWithReservedIp(_configName, reservedIpName1);
string _configPath2 = StoreConfigFileWithReservedIp(_configName, reservedIpName2);
string _configPath1update = StoreConfigFileWithReservedIp(_configNameupdate, reservedIpName1);
string _configPath2update = StoreConfigFileWithReservedIp(_configNameupdate, reservedIpName2);

vmPowershellCmdlets.NewAzureDeployment(serviceName, _packagePath, _configPath1,
DeploymentSlotType.Production, "label", deploymentName1, false, false);

vmPowershellCmdlets.NewAzureDeployment(serviceName, _packagePath, _configPath2,
DeploymentSlotType.Staging, "label", deploymentName2, false, false);

vmPowershellCmdlets.MoveAzureDeployment(serviceName);

vmPowershellCmdlets.GetAzureDeployment(serviceName, DeploymentSlotType.Production);
vmPowershellCmdlets.GetAzureDeployment(serviceName, DeploymentSlotType.Staging);

vmPowershellCmdlets.SetAzureDeploymentConfig(serviceName, DeploymentSlotType.Production, _configPath1update.FullName);
vmPowershellCmdlets.SetAzureDeploymentConfig(serviceName, DeploymentSlotType.Staging, _configPath2update.FullName);


vmPowershellCmdlets.SetAzureDeploymentConfig(serviceName, DeploymentSlotType.Production, _configPath1update);
vmPowershellCmdlets.SetAzureDeploymentConfig(serviceName, DeploymentSlotType.Staging, _configPath2update);

pass = true;
}
Expand All @@ -148,6 +145,17 @@ public void CreateReservedIPThenPaaSVM()
}
}

private string StoreConfigFileWithReservedIp(string configFileName, string reservedIpName)
{
var originalConfigPath = new FileInfo(Directory.GetCurrentDirectory() + "\\" + configFileName);
var tempConfigPath = new FileInfo(Directory.GetCurrentDirectory() + "\\" + Utilities.GetUniqueShortName(configFileName));

string _config1_format = File.ReadAllText(originalConfigPath.FullName);

File.WriteAllText(tempConfigPath.FullName, string.Format(_config1_format, reservedIpName));
return tempConfigPath.FullName;
}

[TestMethod(), Priority(0), TestProperty("Feature", "IaaS"), TestCategory(Category.Network), Owner("hylee"), Description("Test the cmdlets (New-AzureReservedIP,Get-AzureReservedIP,Remove-AzureReservedIP)")]
public void CreateReservedIPThenWindowsVM()
{
Expand Down
Loading

0 comments on commit b690811

Please sign in to comment.