Liran Zelkha has uploaded a new change for review.

Change subject: engine: Add dao_unit_test to DeleteCompletedJobsOlderThanDate
......................................................................

engine: Add dao_unit_test to DeleteCompletedJobsOlderThanDate

Added a unit test to check that DeleteCompletedJobsOlderThanDate deletes
jobs and steps that have no async-tasks

Change-Id: Iba883b90fc8fc89096a98beec796d4600714eb15
Signed-off-by: lzel...@redhat.com <lzel...@redhat.com>
---
M 
backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/JobDaoTest.java
M 
backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StepDaoTest.java
M backend/manager/modules/dal/src/test/resources/fixtures.xml
3 files changed, 34 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/71/23171/1

diff --git 
a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/JobDaoTest.java
 
b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/JobDaoTest.java
index 0e1e2d8..b7a70b1 100644
--- 
a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/JobDaoTest.java
+++ 
b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/JobDaoTest.java
@@ -24,7 +24,7 @@
     private static final Guid NO_VDSM_TASKS_JOB_ID = new 
Guid("54947df8-0e9e-4471-a2f9-9af509fb5333");
     private static final String EXISTING_CORRELATION_ID = "54947df8-job1";
     private static final int NUMBER_OF_JOBS_FOR_EXISTING_CORRELATION_ID = 1;
-    private static final int TOTAL_JOBS = 5;
+    private static final int TOTAL_JOBS = 6;
 
     @Override
     @Before
@@ -133,6 +133,8 @@
         Date dateToDelete = df.parse("2013-02-9 10:11:00");
         dao.deleteCompletedJobs(dateToDelete, dateToDelete);
         int sizeAfterDelete = dao.getAll().size();
+        assertTrue("Check job with step and no async task deleted",
+                dao.get(new Guid("54947df8-0e9e-4471-a2f9-9af509fb0002")) == 
null);
         assertTrue("Check an entry was deleted", sizeBeforeDelete > 
sizeAfterDelete);
     }
 
diff --git 
a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StepDaoTest.java
 
b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StepDaoTest.java
index 37c96b2..ce0e7b5 100644
--- 
a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StepDaoTest.java
+++ 
b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StepDaoTest.java
@@ -21,7 +21,7 @@
     private static final int TOTAL_STEPS_OF_MULTI_STEP_JOB = 8;
     private static final Guid EXISTING_JOB_ID = new 
Guid("54947df8-0e9e-4471-a2f9-9af509fb5111");
     private static final Guid EXISTING_STEP_ID = new 
Guid("54947df8-0e9e-4471-a2f9-9af509111111");
-    private static final int TOTAL_STEPS = 12;
+    private static final int TOTAL_STEPS = 13;
     private static final Guid EXISTING_STEP_WITH_SUB_STEPS = new 
Guid("54947df8-0e9e-4471-a2f9-9af509fb5223");
     private static final int TOTAL_STEPS_OF_PARENT_STEP = 3;
     private static final Guid IN_PROGRESS_JOB_ID = new 
Guid("54947df8-0e9e-4471-a2f9-9af509fb5333");
diff --git a/backend/manager/modules/dal/src/test/resources/fixtures.xml 
b/backend/manager/modules/dal/src/test/resources/fixtures.xml
index 11f685b..f12bd36 100644
--- a/backend/manager/modules/dal/src/test/resources/fixtures.xml
+++ b/backend/manager/modules/dal/src/test/resources/fixtures.xml
@@ -4688,6 +4688,20 @@
             <value>false</value>
             <value>true</value>
        </row>
+       <row>
+            <value>54947df8-0e9e-4471-a2f9-9af509fb0002</value>
+            <value>STARTED</value>
+            <value>9bf7c640-b620-456f-a550-0348f3665333</value>
+            <value>StartRebalanceGlusterVolume</value>
+            <value>A job with step and no async task</value>
+            <value>true</value>
+            <value>2012-02-08 10:00:00</value>
+            <value>2012-02-08 10:11:00</value>
+            <null/>
+            <value>54947df8-job5</value>
+            <value>false</value>
+            <value>true</value>
+       </row>
     </table>
 
     <table name="job_subject_entity">
@@ -4921,6 +4935,22 @@
             <value>GLUSTER</value>
             <value>false</value>
         </row>
+        <!-- Steps for Job 54947df8-0e9e-4471-a2f9-9af509fb0002 (no async 
tasks) -->
+        <row>
+            <value>cd75984e-1fd4-48fb-baf8-e45800a61a67</value>
+            <null/>
+            <value>54947df8-0e9e-4471-a2f9-9af509fb0002</value>
+            <value>UNKNOWN</value>
+            <value>Rebalancing V2 volume of Default.( STARTED  )</value>
+            <value>0</value>
+            <value>STARTED</value>
+            <value>2012-02-08 10:11:00</value>
+            <null/>
+            <value>54947df8-job6</value>
+             <null/>
+            <null/>
+            <value>false</value>
+        </row>
     </table>
 
     <table name="gluster_volumes">


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iba883b90fc8fc89096a98beec796d4600714eb15
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.3
Gerrit-Owner: Liran Zelkha <lzel...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to