You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Michael Brohl (Jira)" <ji...@apache.org> on 2022/07/11 14:44:00 UTC

[jira] [Commented] (OFBIZ-12666) Integration tests fail with Postgres DB

    [ https://issues.apache.org/jira/browse/OFBIZ-12666?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17565037#comment-17565037 ] 

Michael Brohl commented on OFBIZ-12666:
---------------------------------------

Hi Johannes,

the integration tests are used together with build targets which also try to do a clean/remove of all test/demo data in the database and reload all data to get a consistent starting dataset for the tests. This only works with the derby database whose files/logs are simply deleted so it is empty when starting OFBiz again.

For Postgres or any other production grade SQL database, this fails/will not be done so you'll have manipulated data from previous tests in your database, wich might be the cause of some of the errors you noticed (I did not check in detail).

I won't classify this as a bug, it works as exspected.

> Integration tests fail with Postgres DB
> ---------------------------------------
>
>                 Key: OFBIZ-12666
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-12666
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework/entity
>    Affects Versions: 22.01.01
>         Environment: Have been testing this in a vm running Debian 11 and in Docker using openjdk:11-jdk-slim as the base image.
>            Reporter: Johannes Schreiber
>            Priority: Critical
>         Attachments: test_results_assetmaint_entity_invoice.jpg, test_results_facilitytests.jpg, test_results_overview.jpg
>
>
> When using Postgres as the main database for OFBiz a couple of integration tests consistently fail (see below). This does not happen when using derby as the database. This is really unfortunate when trying to integrate OFBiz using CI/CD.
> Steps to test:
>  # clone [https://github.com/apache/ofbiz-framework.git] and checkout release22.01
>  # run ./gradlew pullAllPluginsSource
>  # make adjustments to build.gradle and entityengine.xml (see below)
>  # run ./gradlew cleanAll loadAll "ofbiz --test"
> I did not make any changes to OFBiz other then those made to the two file mentioned before.
> build.gradle diff:
> {code:java}
> diff --git a/build.gradle b/build.gradle
> index 6f2d644c43..5bb96902c1 100644
> --- a/build.gradle
> +++ b/build.gradle
> @@ -193,6 +193,7 @@ configurations {
>  }
>  
>  dependencies {
> +
>      implementation 'xerces:xercesImpl:2.12.2'
>      implementation 'com.google.zxing:core:3.4.1'
>      implementation 'com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4.2'
> @@ -267,6 +268,7 @@ dependencies {
>      runtimeOnly 'org.apache.logging.log4j:log4j-web:2.17.2' //???
>      runtimeOnly 'org.apache.logging.log4j:log4j-jcl:2.17.2' // need to constrain to version to avoid classpath conflict (ReflectionUtil)
>      runtimeOnly 'org.codeartisans.thirdparties.swing:batik-all:1.8pre-r1084380'
> +    runtimeOnly 'org.postgresql:postgresql:42.2.5'
>  
>      // Dependencies defined by the plugins
>      subprojects.each { subProject -> {code}
> entityengine.xml diff:
> {code:java}
> diff --git a/framework/entity/config/entityengine.xml b/framework/entity/config/entityengine.xml
> index e9abf07632..7b36749061 100644
> --- a/framework/entity/config/entityengine.xml
> +++ b/framework/entity/config/entityengine.xml
> @@ -52,20 +52,20 @@ access. For a detailed description see the core/docs/entityconfig.html file.
>      <debug-xa-resources value="false" />  <!-- see https://issues.apache.org/jira/browse/OFBIZ-4282 for more -->
>      
>      <delegator name="default" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" distributed-cache-clear-enabled="false">
> -        <group-map group-name="org.apache.ofbiz" datasource-name="localderby"/>
> +        <group-map group-name="org.apache.ofbiz" datasource-name="localpostgres"/>
>          <group-map group-name="org.apache.ofbiz.olap" datasource-name="localderbyolap"/>
>          <group-map group-name="org.apache.ofbiz.tenant" datasource-name="localderbytenant"/>
>      </delegator>
>      <!-- May be used when you create a service that manages many data for massive imports, this for performance reason or to escape functional cases --> 
>      <delegator name="default-no-eca" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" entity-eca-enabled="false" distributed-cache-clear-enabled="false">
> -        <group-map group-name="org.apache.ofbiz" datasource-name="localderby"/>
> +        <group-map group-name="org.apache.ofbiz" datasource-name="localpostgres"/>
>          <group-map group-name="org.apache.ofbiz.olap" datasource-name="localderbyolap"/>
>          <group-map group-name="org.apache.ofbiz.tenant" datasource-name="localderbytenant"/>
>      </delegator>
>  
>      <!-- Be sure that your default delegator (or the one you use) uses the same datasource for test. You must run "gradlew loadAll" before running "gradlew testIntegration" -->
>      <delegator name="test" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main">
> -        <group-map group-name="org.apache.ofbiz" datasource-name="localderby"/>
> +        <group-map group-name="org.apache.ofbiz" datasource-name="localpostgres"/>
>          <group-map group-name="org.apache.ofbiz.olap" datasource-name="localderbyolap"/>
>          <group-map group-name="org.apache.ofbiz.tenant" datasource-name="localderbytenant"/>
>      </delegator> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)