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

Establish consistent pattern for establishing sample data for unit tests




      Our unit tests are all over the map in terms of how they build up sample data for testing queries and such.

      Some of them have tons of raw SQL inserts.

      Some of them have clojure data structures that are inlined with the tests and passed through the command processing channels, and simply copied and pasted around to other tests that need the same data structures.

      Others rely on data structures that are `def`d in the `examples` namespace, which seems to allow the most re-use of the data across tests, but is starting to feel fragile as new tests come online that require the data to be just slightly different than the original examples, so you either have to add more examples (which may become unsustainable over time) or you have to modify the existing examples to suit your needs (which is likely to break existing tests).

      I'm not sure which of these is best; I'm pretty sure it's not the raw SQL, but the other two both seem to have pros and cons. In any case, it'd be nice if we had a consistent pattern to follow so that the test code was easier to maintain and more approachable for new devs.




            Unassigned Unassigned
            chris Chris Price
            Kurt Wall Kurt Wall
            0 Vote for this issue
            1 Start watching this issue



              Zendesk Support