Hello Ravi Nori,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/19699

to review the following change.

Change subject: core : DAO Tests fail because of fk_vm_static_quota
......................................................................

core : DAO Tests fail because of fk_vm_static_quota

A new foreign key constraint added to
vm_static table fk_vm_static_quota requires
tests to have a existing quota id and
also requires that the quota table be
populated before inserting data into
vm_static table

Change-Id: Ia15cd17950c7b5aa082452a9014ec67ffa0da0da
Bug-Url: https://bugzilla.redhat.com/1003839
Signed-off-by: Ravi Nori <[email protected]>
---
M 
backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/ImageDaoTest.java
M 
backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmStaticDAOTest.java
M backend/manager/modules/dal/src/test/resources/fixtures.xml
3 files changed, 77 insertions(+), 75 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/99/19699/1

diff --git 
a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/ImageDaoTest.java
 
b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/ImageDaoTest.java
index b38be21..88664eb 100644
--- 
a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/ImageDaoTest.java
+++ 
b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/ImageDaoTest.java
@@ -18,6 +18,7 @@
     private static final Guid EXISTING_IMAGE_ID = new 
Guid("42058975-3d5e-484a-80c1-01c31207f578");
     private static final Guid EXISTING_IMAGE_DISK_TEMPLATE_ID = new 
Guid("52058975-3d5e-484a-80c1-01c31207f578");
     private static final Guid EXISTING_SNAPSHOT_ID = new 
Guid("a7bb24df-9fdf-4bd6-b7a9-f5ce52da0f89");
+    private static final Guid QUOTA_ID = new 
Guid("88296e00-0cad-4e5a-9291-008a7b7f4399");
 
     private static final int TOTAL_IMAGES = 11;
     private Image newImage;
@@ -65,7 +66,7 @@
         newImage.setVolumeFormat(VolumeFormat.COW);
         newImage.setVolumeType(VolumeType.Sparse);
         newImage.setDiskId(Guid.newGuid());
-        newImage.setQuotaId(Guid.newGuid());
+        newImage.setQuotaId(QUOTA_ID);
     }
 
     @Test
diff --git 
a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmStaticDAOTest.java
 
b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmStaticDAOTest.java
index f412d71..07a99d9 100644
--- 
a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmStaticDAOTest.java
+++ 
b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmStaticDAOTest.java
@@ -29,6 +29,7 @@
     private static final Guid EXISTING_VM_ID = new 
Guid("77296e00-0cad-4e5a-9299-008a7b6f4355");
     private static final Guid VDS_STATIC_ID = new 
Guid("afce7a39-8e8c-4819-ba9c-796d316592e6");
     private static final Guid VDS_GROUP_ID = new 
Guid("b399944a-81ab-4ec5-8266-e19ba7c3c9d1");
+    private static final Guid QUOTA_ID = new 
Guid("88296e00-0cad-4e5a-9291-008a7b7f4399");
 
     private static final String STATIC_VM_NAME = "rhel5-pool-50";
     private static final int NUM_OF_VM_STATIC_IN_FIXTURES = 3;
@@ -52,7 +53,7 @@
         newVmStatic.setVdsGroupId(VDS_GROUP_ID);
         newVmStatic.setVmtGuid(vmtemplate.getId());
         newVmStatic.setOrigin(OriginType.OVIRT);
-        newVmStatic.setQuotaId(Guid.newGuid());
+        newVmStatic.setQuotaId(QUOTA_ID);
     }
 
     /**
diff --git a/backend/manager/modules/dal/src/test/resources/fixtures.xml 
b/backend/manager/modules/dal/src/test/resources/fixtures.xml
index 49356e0..50fe7cb 100644
--- a/backend/manager/modules/dal/src/test/resources/fixtures.xml
+++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml
@@ -1333,6 +1333,79 @@
       </row>
     </table>
 
+    <table name="quota">
+        <column>id</column>
+        <column>storage_pool_id</column>
+        <column>quota_name</column>
+        <column>description</column>
+        <column>_create_date</column>
+        <column>_update_date</column>
+        <column>threshold_vds_group_percentage</column>
+        <column>threshold_storage_percentage</column>
+        <column>grace_vds_group_percentage</column>
+        <column>grace_storage_percentage</column>
+        <row>
+            <value>88296e00-0cad-4e5a-9291-008a7b7f4399</value>
+            <value>72b9e200-f48b-4687-83f2-62828f249a47</value>
+            <value>Quota General</value>
+            <value>General quota with general parameters</value>
+            <value>2010-10-12 03:38:36</value>
+            <value>2010-10-27 12:18:51</value>
+            <value>80</value>
+            <value>80</value>
+            <value>20</value>
+            <value>20</value>
+        </row>
+        <row>
+            <value>88296e00-0cad-4e5a-9291-008a7b7f4404</value>
+            <value>72b9e200-f48b-4687-83f2-62828f249a47</value>
+            <value>Default unlimited Quota General</value>
+            <value>Default unlimited quota for general quota</value>
+            <value>2010-10-12 03:38:36</value>
+            <value>2010-10-27 12:18:51</value>
+            <value>80</value>
+            <value>80</value>
+            <value>20</value>
+            <value>20</value>
+        </row>
+        <row>
+            <value>88296e00-0cad-4e5a-9291-008a7b7f4400</value>
+            <value>72b9e200-f48b-4687-83f2-62828f249a47</value>
+            <value>Quota Specific</value>
+            <value>Quota with specific limitations</value>
+            <value>2010-11-12 03:38:36</value>
+            <value>2010-11-27 12:18:51</value>
+            <value>80</value>
+            <value>80</value>
+            <value>20</value>
+            <value>20</value>
+        </row>
+        <row>
+            <value>88296e00-0cad-4e5a-9291-008a7b7f4401</value>
+            <value>72b9e200-f48b-4687-83f2-62828f249a47</value>
+            <value>Quota General and Specific</value>
+            <value>Quota with General and specific limitations</value>
+            <value>2010-12-12 03:38:36</value>
+            <value>2010-12-27 12:18:51</value>
+            <value>80</value>
+            <value>80</value>
+            <value>20</value>
+            <value>20</value>
+        </row>
+        <row>
+            <value>88296e00-0cad-4e5a-9291-008a7b7f4405</value>
+            <value>72b9e200-f48b-4687-83f2-62828f249a47</value>
+            <value>Quota Empty</value>
+            <value>Empty Quota with no limitations</value>
+            <value>2010-12-12 03:38:36</value>
+            <value>2010-12-27 12:18:51</value>
+            <value>80</value>
+            <value>80</value>
+            <value>20</value>
+            <value>20</value>
+        </row>
+    </table>
+
     <table name="vm_static">
         <column>vm_guid</column>
         <column>entity_type</column>
@@ -3829,79 +3902,6 @@
             <value>6d849ebf-755f-4552-ad09-9a090cda105d</value>
             <value>1</value>
             <value>afce7a39-8e8c-4819-ba9c-796d316592e7</value>
-        </row>
-    </table>
-
-    <table name="quota">
-        <column>id</column>
-        <column>storage_pool_id</column>
-        <column>quota_name</column>
-        <column>description</column>
-        <column>_create_date</column>
-        <column>_update_date</column>
-        <column>threshold_vds_group_percentage</column>
-        <column>threshold_storage_percentage</column>
-        <column>grace_vds_group_percentage</column>
-        <column>grace_storage_percentage</column>
-        <row>
-            <value>88296e00-0cad-4e5a-9291-008a7b7f4399</value>
-            <value>72b9e200-f48b-4687-83f2-62828f249a47</value>
-            <value>Quota General</value>
-            <value>General quota with general parameters</value>
-            <value>2010-10-12 03:38:36</value>
-            <value>2010-10-27 12:18:51</value>
-            <value>80</value>
-            <value>80</value>
-            <value>20</value>
-            <value>20</value>
-        </row>
-        <row>
-            <value>88296e00-0cad-4e5a-9291-008a7b7f4404</value>
-            <value>72b9e200-f48b-4687-83f2-62828f249a47</value>
-            <value>Default unlimited Quota General</value>
-            <value>Default unlimited quota for general quota</value>
-            <value>2010-10-12 03:38:36</value>
-            <value>2010-10-27 12:18:51</value>
-            <value>80</value>
-            <value>80</value>
-            <value>20</value>
-            <value>20</value>
-        </row>
-        <row>
-            <value>88296e00-0cad-4e5a-9291-008a7b7f4400</value>
-            <value>72b9e200-f48b-4687-83f2-62828f249a47</value>
-            <value>Quota Specific</value>
-            <value>Quota with specific limitations</value>
-            <value>2010-11-12 03:38:36</value>
-            <value>2010-11-27 12:18:51</value>
-            <value>80</value>
-            <value>80</value>
-            <value>20</value>
-            <value>20</value>
-        </row>
-        <row>
-            <value>88296e00-0cad-4e5a-9291-008a7b7f4401</value>
-            <value>72b9e200-f48b-4687-83f2-62828f249a47</value>
-            <value>Quota General and Specific</value>
-            <value>Quota with General and specific limitations</value>
-            <value>2010-12-12 03:38:36</value>
-            <value>2010-12-27 12:18:51</value>
-            <value>80</value>
-            <value>80</value>
-            <value>20</value>
-            <value>20</value>
-        </row>
-        <row>
-            <value>88296e00-0cad-4e5a-9291-008a7b7f4405</value>
-            <value>72b9e200-f48b-4687-83f2-62828f249a47</value>
-            <value>Quota Empty</value>
-            <value>Empty Quota with no limitations</value>
-            <value>2010-12-12 03:38:36</value>
-            <value>2010-12-27 12:18:51</value>
-            <value>80</value>
-            <value>80</value>
-            <value>20</value>
-            <value>20</value>
         </row>
     </table>
 


-- 
To view, visit http://gerrit.ovirt.org/19699
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia15cd17950c7b5aa082452a9014ec67ffa0da0da
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.3
Gerrit-Owner: Gilad Chaplik <[email protected]>
Gerrit-Reviewer: Ravi Nori <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to