Uploaded image for project: 'GPII - Global Public Inclusive Infrastructure'
  1. GPII - Global Public Inclusive Infrastructure
  2. GPII-3086

GPII-2630 era PouchDB persistence tests do not clear up database between test runs

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not a Bug
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: GPII Framework
    • Labels:
      None

      Description

      After GPII-2630 has been implemented, the new PouchDB-enabled tests across the architecture (both acceptance and feature tests) leave the database dirty between runs, which leads to various problems.
      The new PouchManager features a "reset" endpoint but this is never called outside its own tests. This is apparently the only call to the "cleanup" method in the codebase - https://github.com/GPII/universal/blob/master/gpii/node_modules/pouchManager/src/pouchManager.js#L155
      As well as meaning that tests are improperly isolated from each other's effects, this makes for everyday problems in development - if the developer creates a new preference set within "testData", even if they remember to run the build script, the database will be filled with stale data and not reflect this. One can detect this situation by seeing a line

      "This database already has one or more records, no data will be loaded..."
      

      in the transcript.
      This line is emitted from the gpii-pouchdb library. Whilst it was apparently the intention to develop an in-memory implementation of "gpii.pouch.harness" to parallel the existing "gpii.pouch.harness.persistent", this seems to have been abandoned. In general it would make the work of cleanup much quicker and more reliable for all test cases to be coded against an in-memory pouch. The only use of a persistent pouch should be in "development" configurations intended for manual testing and the like. The requirement for an in-memory gpii-pouch-harness has been reported separately at GPII-3080.

      Separately we should do a better job of explaining to the user how to recover from this situation. We should document in the README where the persistent databases created by gpii-pouchdb are kept, how they are named and how to get rid of them.

        Attachments

          Activity

            People

            Assignee:
            cli@ocad.ca Cindy Qi Li
            Reporter:
            amb26 Antranig Basman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: