Updated Branches:
  refs/heads/qemu-img 4d39ad412 -> 60206ad66

Improve the createAndInfo test

With the new code in the info method we can now better check if the created
image is what we expect from it


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/60206ad6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/60206ad6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/60206ad6

Branch: refs/heads/qemu-img
Commit: 60206ad6603d09a30912c5af2c89a07b2db690ce
Parents: ad9a20e
Author: Wido den Hollander <[email protected]>
Authored: Mon Feb 18 14:35:12 2013 +0100
Committer: Wido den Hollander <[email protected]>
Committed: Mon Feb 18 14:35:12 2013 +0100

----------------------------------------------------------------------
 .../apache/cloudstack/utils/qemu/QemuImgTest.java  |   18 +++++++++++---
 1 files changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/60206ad6/utils/test/org/apache/cloudstack/utils/qemu/QemuImgTest.java
----------------------------------------------------------------------
diff --git a/utils/test/org/apache/cloudstack/utils/qemu/QemuImgTest.java 
b/utils/test/org/apache/cloudstack/utils/qemu/QemuImgTest.java
index ef22390..2e78012 100644
--- a/utils/test/org/apache/cloudstack/utils/qemu/QemuImgTest.java
+++ b/utils/test/org/apache/cloudstack/utils/qemu/QemuImgTest.java
@@ -30,15 +30,25 @@ public class QemuImgTest {
     @Test
     public void testCreateAndInfo() {
         String filename = "/tmp/test-image.qcow2";
-        long size = 10240;
-        QemuImgFile file = new QemuImgFile(filename);
+
+        /* 10TB virtual_size */
+        long size = 10995116277760l;
+        QemuImgFile file = new QemuImgFile(filename, size, 
PhysicalDiskFormat.QCOW2);
 
         QemuImg qemu = new QemuImg();
         qemu.create(file);
-        List<Map<String, String>> info = qemu.info(file);
+        Map<String, String> info = qemu.info(file);
+
         if (info == null) {
             fail("We didn't get any information back from qemu-img");
         }
+
+        Long infoSize = Long.parseLong(info.get(new String("virtual_size")));
+        assertEquals(Long.valueOf(size), Long.valueOf(infoSize));
+
+        String infoPath = info.get(new String("image"));
+        assertEquals(filename, infoPath);
+
     }
 
     @Test
@@ -53,7 +63,7 @@ public class QemuImgTest {
         QemuImg qemu = new QemuImg();
         qemu.create(srcFile);
         qemu.convert(srcFile, destFile);
-        List<Map<String, String>> info = qemu.info(destFile);
+        Map<String, String> info = qemu.info(destFile);
         if (info == null) {
             fail("We didn't get any information back from qemu-img");
         }

Reply via email to