Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-30729

Improve ts_observatory_control unit tests reliability and coverage.

    XMLWordPrintable

Details

    • Story
    • Status: Done
    • Resolution: Done
    • None
    • None
    • 1
    • TSSW Sprint - Jun 21 - Jul 05
    • Telescope and Site
    • No

    Description

      I have been thinking about ways to improve the unit tests reliability of ts_observatory_control for quite some time. One of the issues is that several of the unit tests have to launch both controllers and remotes for several components. This put a serious strain is the node running the tests as a single thread is responsible for a lot of DDS plus computation, which causes the unit tests to fails with timeouts from time to time.

      Nevertheless these are well separated in the code in the form of Mocks and the control classes themselves. One way to improve this is to run the mocks in a separate process. This will also help speed up the unit tests as it can be done once using the setUpClass/tearDownClass fixtures in unittest.

      Furthermore I also need to improve unit tests coverage. Some of the most critical parts of the classes are relatively well covered but we've had some issues with the prepare_for_* and shutdown method in the atcs class that could be prevented with better unit tests. 

      Attachments

        Activity

          PR: https://github.com/lsst-ts/ts_observatory_control/pull/41

          I ended up doing modifying my strategy entirely on how to develop the unit tests. Instead of relying in Remotes and Controller from SalObj (which are expensive and fail unit tests from time to time), I decided to use the standard Mock classes from python's unit test.

          The unit tests runs much faster and reliably this way, which means I can make a lot more of them. With this approach I managed to considerably increase test coverage in the ATCS and MTCS class and still got a 2x gain in speed. 

          tribeiro Tiago Ribeiro added a comment - PR: https://github.com/lsst-ts/ts_observatory_control/pull/41 I ended up doing modifying my strategy entirely on how to develop the unit tests. Instead of relying in Remotes and Controller from SalObj (which are expensive and fail unit tests from time to time), I decided to use the standard Mock classes from python's unit test. The unit tests runs much faster and reliably this way, which means I can make a lot more of them. With this approach I managed to considerably increase test coverage in the ATCS and MTCS class and still got a 2x gain in speed. 

          Reviewed on GitHub.

          wvreeven Wouter van Reeven added a comment - Reviewed on GitHub.

          People

            tribeiro Tiago Ribeiro
            tribeiro Tiago Ribeiro
            Wouter van Reeven
            Andy Clements, Michael Reuter, Tiago Ribeiro, Wouter van Reeven
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Jenkins

                No builds found.