Uploaded image for project: 'mod-source-record-storage'
  1. mod-source-record-storage
  2. MODSOURCE-469

Fix handling of liquibase fails

    XMLWordPrintable

Details

    • Folijet Sprint 137
    • 2
    • Folijet
    • Lotus R1 2022
    • Requirements change

    Description

      In the class ModTenantAPI method "loadData" doesn't pay attention on error messages from liquibase (it gives back "successfully" in any case)

      Future<Integer> loadData(TenantAttributes attributes, String tenantId,
      Map<String, String> headers, Context context) {
      
      return super.loadData(attributes, tenantId, headers, context)....
      

       

      Steps to reproduce:

      1. rebuild SRS with folio-liquibase-util-1.5.0-SNAPSHOT
      2. vagrant up
      3. change the value in the "md5sum" field in the "diku_mod_source_record_storage.databasechangelog" table to any value
      4. run POST request to SRS:
        for example:
        curl "http://localhost:9177/_/tenant" -H "X-Okapi-Tenant: diku" -H "X-Okapi-URL: http://localhost:9177" -H "Content-type: application/json" -XPOST -d' 
        {
          "module_to": "mod-source-record-storage-5.4.0-SNAPSHOT",
          "parameters": [{
          "key": "loadSample",
          "value": "true"
          },{
          "key": "loadReference",
          "value": "true"
          }]
        }'
        
      1. check response
        {
          "id" : "e1b4d15b-8c8b-4eb8-89c2-0bb7675f39c7",
          "tenant" : "diku",
          "tenantAttributes" : {
            "module_to" : "mod-source-record-storage-5.4.0-SNAPSHOT",
            "parameters" : [ {
              "key" : "loadSample",
              "value" : "true"
            }, {
              "key" : "loadReference",
              "value" : "true"
            } ]
          },
          "complete" : false,
          "messages" : [ ]
        }
        

       

      Expected result (see "error message"):

      {
        "id" : "95e95b9f-ce3f-4a4f-b453-11b70752c27d",
        "tenant" : "diku",
        "tenantAttributes" : {
          "module_to" : "mod-source-record-storage-5.4.0-SNAPSHOT",
          "parameters" : [ {
            "key" : "loadSample",
            "value" : "true"
          }, {
            "key" : "loadReference",
            "value" : "true"
          } ]
        },
        "complete" : true,
        "error" : "liquibase.exception.ValidationFailedException: Validation Failed:\n     1 change sets check sum\n          liquibase/tenant/scripts/v-5.0.6-5.1.3-5.2.0/2021-08-04--16-00-rename-instance-id.xml::2021-08-04--16-00-rename-instance-id-index.xml::psmahin was: 8:836da301debccfd991c718a04b84ad5e but is now: 8:a7514ad06dbcbe7969a047daf17891dd\n",
        "messages" : [ ]
      }
      

      Additional info: RMB-895
      We can call the /_/tenant/$id API (again) with a wait parameter until "complete" is true, see description above.
      Example: /_/tenant/458b6397-c4d2-46b2-a771-ace8a310bcea?wait=30000

       

      A.I.: Added Wiki page to include in Release notes for module upgrades (not to miss the errors).
      https://wiki.folio.org/display/FOLIJET/Module+upgrade+via+Tenant+API 

      TestRail: Results

        Attachments

          Issue Links

            Activity

              People

                Aivar Iusupov Aivar Iusupov
                afedasiuk Aliaksandr Fedasiuk
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  TestRail: Runs

                    TestRail: Cases