Allon Mureinik has uploaded a new change for review.

Change subject: core: ActionGroupDAOTest#testRemoveActionVersionMap
......................................................................

core: ActionGroupDAOTest#testRemoveActionVersionMap

The old implementation of this test removes existingActionMap from the
database. Since there is no rollback performed between tests, and since
other tests in this class assume this object will be present in the
database, this implementation caused sporadic failures on various
environments [1], depending on the order the tests were executed.

This patch rewrites the test to be safer. It now creates a dummy record
in the table, inserts it (and asserts it was indeed inserted), and then
removes it (again, asserting it was properly removed).

[1] Details of the system where a failure was spotted:
Apache Maven 3.0.4 (r1232337; 2012-01-17 10:44:56+0200)
Maven home: /usr/local/apache-maven-3.0.4
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.51.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-431.11.2.el6.x86_64", arch: "amd64", family: 
"unix"

Change-Id: Icba824009bec7763c38b3040eb9b1be88558f037
Signed-off-by: Allon Mureinik <amure...@redhat.com>
---
M 
backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/ActionGroupDAOTest.java
1 file changed, 10 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/78/27778/1

diff --git 
a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/ActionGroupDAOTest.java
 
b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/ActionGroupDAOTest.java
index d32b930..fb455dc 100644
--- 
a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/ActionGroupDAOTest.java
+++ 
b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/ActionGroupDAOTest.java
@@ -70,10 +70,18 @@
 
     @Test
     public void testRemoveActionVersionMap() {
-        dao.removeActionVersionMap(existingActionMap.getaction_type());
+        ActionVersionMap dummy = new ActionVersionMap();
+        dummy.setaction_type(VdcActionType.RebootVm);
+        dummy.setcluster_minimal_version("3.0");
+        dummy.setstorage_pool_minimal_version("3.0");
+        dao.addActionVersionMap(dummy);
 
-        ActionVersionMap result = 
dao.getActionVersionMapByActionType(existingActionMap.getaction_type());
+        ActionVersionMap result = 
dao.getActionVersionMapByActionType(dummy.getaction_type());
+        assertNotNull(result);
 
+        dao.removeActionVersionMap(dummy.getaction_type());
+
+        result = dao.getActionVersionMapByActionType(dummy.getaction_type());
         assertNull(result);
     }
 }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icba824009bec7763c38b3040eb9b1be88558f037
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <amure...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to