You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by de...@apache.org on 2013/10/30 10:29:10 UTC
git commit: updated refs/heads/hyperv to a134a9b
Updated Branches:
refs/heads/hyperv 9bfc1c0c3 -> a134a9bb1
Unit test for DestroyCommand implementation in hyperv agent.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a134a9bb
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a134a9bb
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a134a9bb
Branch: refs/heads/hyperv
Commit: a134a9bb17b24a590ff375939e0a4f5e2a231718
Parents: 9bfc1c0
Author: Anshul Gangwar <an...@citrix.com>
Authored: Wed Oct 30 14:59:47 2013 +0530
Committer: Devdeep Singh <de...@gmail.com>
Committed: Wed Oct 30 14:59:47 2013 +0530
----------------------------------------------------------------------
.../HypervResourceController1Test.cs | 36 ++++++++++++++++++--
plugins/hypervisors/hyperv/buildagent.sh | 1 -
2 files changed, 33 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a134a9bb/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 6cc5748..fd0a4bf 100644
--- a/plugins/hypervisors/hyperv/DotNet/ServerResource/ServerResource.Tests/HypervResourceController1Test.cs
+++ b/plugins/hypervisors/hyperv/DotNet/ServerResource/ServerResource.Tests/HypervResourceController1Test.cs
@@ -212,9 +212,39 @@ namespace ServerResource.Tests
sampleTemplateFile.Delete();
}
- /// <summary>
- /// Possible additional tests: place an ISO in the drive
- /// </summary>
+ [Fact]
+ public void TestDestroyCommand()
+ {
+ testSampleVolumeTempURIJSON = "\"storagepool\"";
+ // Arrange
+ String destoryCmd = //"{\"volume\":" + getSampleVolumeObjectTO() + "}";
+ "{\"volume\":{\"name\":\"" + testSampleVolumeTempUUIDNoExt
+ + "\",\"storagePoolType\":\"Filesystem\","
+ + "\"mountPoint\":"
+ + testLocalStorePathJSON
+ + ",\"path\":" + testSampleVolumeTempURIJSON
+ + ",\"storagePoolUuid\":\"" + testLocalStoreUUID
+ + "\","
+ + "\"type\":\"ROOT\",\"id\":9,\"size\":0}}";
+
+ ImageManagementService imgmgr = new ImageManagementService();
+ wmiCallsV2.GetImageManagementService().Returns(imgmgr);
+
+ HypervResourceController rsrcServer = new HypervResourceController();
+ HypervResourceController.wmiCallsV2 = wmiCallsV2;
+
+ dynamic jsonDestoryCmd = JsonConvert.DeserializeObject(destoryCmd);
+
+ // Act
+ dynamic destoryAns = rsrcServer.DestroyCommand(jsonDestoryCmd);
+
+ // Assert
+ JObject ansAsProperty2 = destoryAns[0];
+ dynamic ans = ansAsProperty2.GetValue(CloudStackTypes.Answer);
+ String path = jsonDestoryCmd.volume.path;
+ Assert.True((bool)ans.result, "DestroyCommand did not succeed " + ans.details);
+ Assert.True(!File.Exists(path), "Failed to delete file " + path);
+ }
[Fact]
public void TestStartCommand()
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a134a9bb/plugins/hypervisors/hyperv/buildagent.sh
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/buildagent.sh b/plugins/hypervisors/hyperv/buildagent.sh
index 4abde38..e5bff6e 100755
--- a/plugins/hypervisors/hyperv/buildagent.sh
+++ b/plugins/hypervisors/hyperv/buildagent.sh
@@ -22,7 +22,6 @@ chmod a+x ./DotNet/ServerResource/.nuget/NuGet.exe
if [ "$1" == "true" ] ; then
echo " skipping tests"
xbuild /p:Configuration="NoUnitTests" /p:BuildWithMono="true" ./DotNet/ServerResource/ServerResource.sln
-
else
echo " running tests "
xbuild /p:BuildWithMono="true" ./DotNet/ServerResource/ServerResource.sln