Allon Mureinik has submitted this change and it was merged.
Change subject: core: Config in DAO tests
......................................................................
core: Config in DAO tests
The DAO tests are supposed to be "unit tests" of a sort per specific
DAO, and should not rely on other external resources such as Config.
This patch mocks the configuration for the DAO tests that need it, and
removes it from the base test case, producing a few advantages:
1. Encapsulation: These tests are now stable and rely on their code
alone, removing the chance that changing a vds_options entry may
break them.
2. Ease of maintenance: It's now much easier to see what config
values each DAO [test] relies on.
3. Performance: DBConfigUtils only load the vdc_options table in the
appropriate DBConfigUtilsTest instead of loading it for all the
tests in BaseDaoTestCase. Before this patch BaseDaoTestCase loaded
the config in its static initialization and then DBConfigUtilsTest
loaded it again per test. Now, it's only loaded per
DBConfigUtilsTest test, reducing the total loads from 3 to 2.
Change-Id: I0ad2078115c2f9a8365a9b30b9aa1781a992a696
Signed-off-by: Allon Mureinik <amureini(a)redhat.com>
---
M backend/manager/modules/dal/pom.xml
M
backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dal/dbbroker/generic/DBConfigUtilsTest.java
M
backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/AuditLogDaoTest.java
M
backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/BaseDaoTestCase.java
M
backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/PermissionDaoTest.java
M backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/RoleDaoTest.java
M
backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmStaticDaoTest.java
7 files changed, 41 insertions(+), 4 deletions(-)
Approvals:
Tal Nisan: Looks good to me, approved
Allon Mureinik: Verified; Passed CI tests
--
To view, visit
https://gerrit.ovirt.org/65017
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0ad2078115c2f9a8365a9b30b9aa1781a992a696
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <amureini(a)redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini(a)redhat.com>
Gerrit-Reviewer: Eli Mesika <emesika(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Peřina <mperina(a)redhat.com>
Gerrit-Reviewer: Tal Nisan <tnisan(a)redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation(a)ovirt.org>