Updated Branches: refs/heads/hyperv f7bd4614c -> 273ac5c8c
Update the unit test to create a fake vhd file on the fly and run the test. The file is removed when the test completes. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/75857e3f Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/75857e3f Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/75857e3f Branch: refs/heads/hyperv Commit: 75857e3f0dd8029bb5fd9b2f2f3549d056220a0b Parents: f7bd461 Author: Anshul Gangwar <[email protected]> Authored: Mon Oct 28 18:00:05 2013 +0530 Committer: Devdeep Singh <[email protected]> Committed: Mon Oct 28 18:02:40 2013 +0530 ---------------------------------------------------------------------- .../ServerResource/AgentShell/AgentShell.csproj | 3 +-- .../HypervResourceController1Test.cs | 23 ++++++++++++++++++++ .../ServerResource.Tests.csproj | 7 ++---- .../storagepool/TestCopiedLocalTemplate.vhdx | 1 - 4 files changed, 26 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/75857e3f/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/AgentShell.csproj ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/AgentShell.csproj b/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/AgentShell.csproj index a813124..39fef16 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/AgentShell.csproj +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/AgentShell/AgentShell.csproj @@ -76,7 +76,6 @@ <Reference Include="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.AspNet.WebApi.Client.4.0.20710.0\lib\net40\System.Net.Http.Formatting.dll</HintPath> </Reference> - <Reference Include="System.Net.Http.WebRequest" /> <Reference Include="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\packages\Microsoft.AspNet.WebApi.Core.4.0.20710.0\lib\net40\System.Web.Http.dll</HintPath> </Reference> @@ -138,4 +137,4 @@ <Target Name="AfterBuild"> </Target> --> -</Project> \ No newline at end of file +</Project> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/75857e3f/plugins/hypervisors/hyperv/DotNet/ServerResource/ServerResource.Tests/HypervResourceController1Test.cs ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/ServerResource.Tests/HypervResourceController1Test.cs b/plugins/hypervisors/hyperv/DotNet/ServerResource/ServerResource.Tests/HypervResourceController1Test.cs index ec91e9f..1226561 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/ServerResource.Tests/HypervResourceController1Test.cs +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/ServerResource.Tests/HypervResourceController1Test.cs @@ -155,6 +155,28 @@ namespace ServerResource.Tests [Fact] public void TestCreateCommand() { + DirectoryInfo localStorePath = new DirectoryInfo(testLocalStorePath); + if (!localStorePath.Exists) + { + try + { + localStorePath.Create(); + } + catch (System.IO.IOException ex) + { + throw new NotImplementedException("Need to be able to create the folder " + localStorePath.FullName + " failed due to " + ex.Message); + } + } + + FileInfo sampleTemplateFile = new FileInfo(Path.Combine(testLocalStorePath, testSampleTemplateUUID)); + if (!sampleTemplateFile.Exists) + { + //Create a file to write to. + using (StreamWriter sw = sampleTemplateFile.CreateText()) + { + sw.WriteLine("This is fake template file for test"); + } + } var counter = 0; wmiCalls.When(x => x.CreateDynamicVirtualHardDisk(Arg.Any<ulong>(), Arg.Any<String>())).Do(x => counter++); // TODO: Need sample to update the test. @@ -188,6 +210,7 @@ namespace ServerResource.Tests FileInfo newFile = new FileInfo((string)ans.volume.path); Assert.True(newFile.Length > 0, "The new file should have a size greater than zero"); newFile.Delete(); + sampleTemplateFile.Delete(); } /// <summary> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/75857e3f/plugins/hypervisors/hyperv/DotNet/ServerResource/ServerResource.Tests/ServerResource.Tests.csproj ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/hyperv/DotNet/ServerResource/ServerResource.Tests/ServerResource.Tests.csproj b/plugins/hypervisors/hyperv/DotNet/ServerResource/ServerResource.Tests/ServerResource.Tests.csproj index ea78aa0..2e7a93c 100644 --- a/plugins/hypervisors/hyperv/DotNet/ServerResource/ServerResource.Tests/ServerResource.Tests.csproj +++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/ServerResource.Tests/ServerResource.Tests.csproj @@ -62,8 +62,7 @@ <Reference Include="log4net"> <HintPath>..\packages\log4net.2.0.0\lib\net40-full\log4net.dll</HintPath> </Reference> - <Reference Include="Microsoft.CSharp" /> - <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> + <Reference Include="Microsoft.CSharp" /> <Reference Include="Newtonsoft.Json"> <HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath> </Reference> @@ -86,9 +85,7 @@ <Reference Include="System.Xml" /> <Reference Include="System.Xml.Linq" /> <Reference Include="System.Net.Http"> - </Reference> - <Reference Include="System.Net.Http.WebRequest"> - </Reference> + </Reference> <Reference Include="xunit"> <HintPath>..\packages\xunit.1.9.2\lib\net20\xunit.dll</HintPath> </Reference> http://git-wip-us.apache.org/repos/asf/cloudstack/blob/75857e3f/plugins/hypervisors/hyperv/var/test/storagepool/TestCopiedLocalTemplate.vhdx ---------------------------------------------------------------------- diff --git a/plugins/hypervisors/hyperv/var/test/storagepool/TestCopiedLocalTemplate.vhdx b/plugins/hypervisors/hyperv/var/test/storagepool/TestCopiedLocalTemplate.vhdx deleted file mode 100644 index bea65f3..0000000 --- a/plugins/hypervisors/hyperv/var/test/storagepool/TestCopiedLocalTemplate.vhdx +++ /dev/null @@ -1 +0,0 @@ -fake template file \ No newline at end of file
