Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-6028

Add Ability to run Integration Tests on MySQL and PostgreSQL Using TestContainers

    XMLWordPrintable

Details

    • Enhancement
    • Status: Closed
    • Should
    • Resolution: Fixed
    • None
    • Core 2.6.0
    • None
    • Medium

    Description

      Our existing tests run on an in memory h2 database. Which is good because it is simple to set up and the tests run fast.

       We need to integrate these exact same tests with MySQL and PostgreSQL (the databases that we currently support) to expose failures that H2 would not ,since H2 doesnt give 100%  compatibility with MySQL or PostgreSQL .

      One Approach would be to use TestContainers ,a Java library that provides and manages lightweight docker instances of common databases.

      This will require adding configuration for MySQL and PostgreSQL here 

      we can set a System Property ie 

      testDb=mysql/postgresql

      to be able to switch between the different databases when running the test. 

      we can provide the default as `testDb=mysql `  but this can be overriden  via the commandline when running tests  ie

      mvn test -DtestDb=mysql

      or 

      mvn test -DtestDb=postgresql

       see more on the talk thread 

      FWIW, the ThoughtWorks Technology Radar recommends that we adopt this: https://www.thoughtworks.com/radar/languages-and-frameworks/testcontainers

      Gliffy Diagrams

        Balsamiq Wireframes

          Attachments

            Issue Links

              Activity

                People

                  dkayiwa Daniel Kayiwa
                  mozzy Moses Mutesasira
                  Daniel Kayiwa Daniel Kayiwa
                  Votes:
                  1 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                    Created:
                    Updated:
                    Resolved: