Uploaded image for project: 'mod-data-export'
  1. mod-data-export
  2. MDEXP-402

Migration Script does not handle all cases

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • P3
    • Resolution: Done
    • None
    • 4.2.0
    • None
    • Concorde - Sprint 117, Concorde - Sprint 118
    • 2
    • Concorde

    Description

      Overview:
      The migration script to convert the string value of progress.total into an int value does not handle the cases where the progress object is not null but empty or is missing the "total" and "failed" properties. This leads to a SQL error when executing the script.

      Steps to Reproduce:
      Run this script

      UPDATE <tenatnId>_mod_data_export.job_executions SET jsonb = jsonb_set(jsonb #- '

      {progress, total}', '{progress, total}

      ', to_jsonb((jsonb -> 'progress' ->> 'total')::int))
      WHERE jsonb -> 'progress' IS NOT NULL

      with records having
      "progress":

      { "exported": 451 }

      or
      "progress": {},

      Expected Results:

      • Gracefully skipping over these records

      Actual Results:
      Script throws error

      Interested parties:
      sduvvuri magdaz

      TestRail: Results

        Attachments

          1. 0000-string total AFTER script.PNG
            50 kB
            Illia Daliek
          2. 0000-string total BEFORE script.PNG
            41 kB
            Illia Daliek
          3. 1000-empty postgres AFTER script.PNG
            46 kB
            Illia Daliek
          4. 1000-empty postgres BEFORE script.PNG
            43 kB
            Illia Daliek
          5. 2000- absent progres (null) AFTER script.PNG
            47 kB
            Illia Daliek
          6. 2000- absent progres (null) BEFORE script.PNG
            50 kB
            Illia Daliek
          7. 3000- only exported field AFTER script.PNG
            50 kB
            Illia Daliek
          8. 3000- only exported field BEFORE script.PNG
            45 kB
            Illia Daliek
          9. 4000 - all fields and total string AFTER script.PNG
            48 kB
            Illia Daliek
          10. 4000 - all fields and total string BEFORE script.PNG
            50 kB
            Illia Daliek
          11. script result final.PNG
            70 kB
            Illia Daliek

          Issue Links

            Activity

              People

                TotoroDev Illia Daliek
                mtraneis Martin Tran
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  TestRail: Runs

                    TestRail: Cases