Uploaded image for project: 'PuppetDB'
  1. PuppetDB
  2. PDB-2061

Decrease the PostgreSQL unit test time

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PDB 4.0.0
    • Component/s: None
    • Labels:
      None
    • Template:
    • Story Points:
      5

      Description

      It looks like the postgres unit test time can be improved by one or more of the following:

      • not running migrations for tests that don't need them
      • removing redundant migrations (unnecessary with-fixtures, etc.)
      • creating a template database once and then using that with copy database

      In order for templates to work, we'll need to stop nesting with-test-db (which we do now in some cases) because you have to be outside a transaction (see our vacuum analyze migration) in order to be able to execute the copy.

      Converting command-test in accordance with the above took the test time here on an ext4 filesystem from about 5m to 1.5.

      Assuming the copy database approach pans out (cf. schema dump/restore), then the tests will require a more privileged user. Consider only using that user for the privileged steps, i.e. copy database and drop database, and not the rest of the test process (principle of least privilege).

        Attachments

          Activity

            People

            Assignee:
            rob.browning Rob Browning
            Reporter:
            rob.browning Rob Browning
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support