Uploaded image for project: 'Domain Models'
  1. Domain Models
  2. DMOD-158

Activation of a second module via the Tenant API does not execute the database script

    XMLWordPrintable

    Details

      Description

      When there are two raml-module-builder based modules (e.g. mod-users and inventory-storage) which declare support for the Tenant API. The activation of the second module for the same tenant fails with the following response (from a POST to /_/tenant on that module):

      HTTP/1.1 500 Internal Server Error
      Content-Type: text/plain
      Content-Length: 71
      
      Post to /tenant on users failed with Tenant already exists: demo_tenant
      

      This is due to a check for the existence of a PostgreSQL schema (https://github.com/folio-org/raml-module-builder/blob/d9100f6814e6223d54cfc720c02d2754976fbfd0/domain-models-runtime/src/main/java/org/folio/rest/impl/TenantAPI.java#L94) which is used to determine if a tenant has been initialised already. As modules currently share a schema named after the Tenant API only the first module's database script will be executed.

      I believe this has not manifested itself on the blackbox environment, as it uses separate databases (on the same server). It has been exacerbated when using embedded PostgreSQL, as although each modules tries to start it's own PostgreSQL server process, the second one fails (due to them using both using port 6000).

        TestRail: Results

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                shale99 shale99
                Reporter:
                marcjohnson Marc Johnson
                Watchers:
                Mike Taylor, shale99
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - 0 minutes
                    0m
                    Logged:
                    Time Spent - 3 days
                    3d

                      TestRail: Runs

                        TestRail: Cases