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

Test config files

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: None
    • Story Points:
      2
    • Sprint:
      TSSW Sprint - Feb 17 - Mar 2
    • Team:
      Telescope and Site
    • Urgent?:
      No

      Description

      Add unit tests to config packages to test the config files.

      Add a base class for such tests to ts_salobj and a unit test to exercise it.

        Attachments

          Issue Links

            Activity

            Hide
            rowen Russell Owen added a comment - - edited

            I added a class BaseConfigTestCase to ts_salobj, plus a unit test for it. I then added tests to all ts_config_x packages that have CSC subdirectories for config files (a few don't, yet).

            I am not thrilled with the code in BaseConfigTestCase because the methods have a lot of arguments in order to handle special cases (and we may eventually need to add a few more). But it's all in the interest of making each test method succinct, avoiding boilerplate in the tests. I think I have succeeded in that area. It was helpful to write tests for so many CSCs as I found some special cases that helped me refine the code. Any suggestions for improving the API would be welcome.

            Note that BaseConfigTestCase.test_standard_configs offers two different ways to find the the CSC package root, which is needed to find the config schema file:

            • Import the module and use the __file__ attribute. This is preferred for Python packages that are easily imported (e.g. that only depend on packages available in our standard environment).
            • Use the environment variable <PACKAGE_NAME>_DIR, e.g. TS_ATDOME_DIR. This is potentially useful for configurable CSCs that are not written in Python, as well as CSCs with extra dependencies.

            Also note that the tests will be skipped if the CSC package cannot be found. I felt this was better than failing since the tests may often be run in a situation where you are modifying configuration files for one particular CSC and don't have some of the other CSCs.

            I debated whether to put the tests in the ts_config_x package or the CSC package. I chose to put the tests in the ts_config_x packages because that keeps the tests with the files being tested. Feel free to push back or contact me to discuss the pros and cons if you would prefer that the tests run in the CSC packages.

            Pull requests:

            Show
            rowen Russell Owen added a comment - - edited I added a class BaseConfigTestCase to ts_salobj, plus a unit test for it. I then added tests to all ts_config_x packages that have CSC subdirectories for config files (a few don't, yet). I am not thrilled with the code in BaseConfigTestCase because the methods have a lot of arguments in order to handle special cases (and we may eventually need to add a few more). But it's all in the interest of making each test method succinct, avoiding boilerplate in the tests. I think I have succeeded in that area. It was helpful to write tests for so many CSCs as I found some special cases that helped me refine the code. Any suggestions for improving the API would be welcome. Note that BaseConfigTestCase.test_standard_configs offers two different ways to find the the CSC package root, which is needed to find the config schema file: Import the module and use the __file__ attribute. This is preferred for Python packages that are easily imported (e.g. that only depend on packages available in our standard environment). Use the environment variable <PACKAGE_NAME>_DIR, e.g. TS_ATDOME_DIR. This is potentially useful for configurable CSCs that are not written in Python, as well as CSCs with extra dependencies. Also note that the tests will be skipped if the CSC package cannot be found. I felt this was better than failing since the tests may often be run in a situation where you are modifying configuration files for one particular CSC and don't have some of the other CSCs. I debated whether to put the tests in the ts_config_x package or the CSC package. I chose to put the tests in the ts_config_x packages because that keeps the tests with the files being tested. Feel free to push back or contact me to discuss the pros and cons if you would prefer that the tests run in the CSC packages. Pull requests: https://github.com/lsst-ts/ts_salobj/pull/88 https://github.com/lsst-ts/ts_config_attcs/pull/10 https://github.com/lsst-ts/ts_config_atcalsys/pull/3 https://github.com/lsst-ts/ts_config_latiss/pull/4 https://github.com/lsst-ts/ts_config_mttcs/pull/2 https://github.com/lsst-ts/ts_config_ocs/pull/11
            Hide
            wvreeven Wouter van Reeven added a comment -

             I reviewed the code changes and approved all pull requests.

            Show
            wvreeven Wouter van Reeven added a comment -  I reviewed the code changes and approved all pull requests.
            Hide
            rowen Russell Owen added a comment -

            All pull requests merged to develop and master and released as:

            • ts_salobj v5.6.0
            • ts_config_atcalsys v0.1.0
            • ts_config_attcs v0.4.0
            • ts_config_latiss v0.3.0
            • ts_config_mttcs v0.1.0
            • ts_config_ocs v0.5.0
            Show
            rowen Russell Owen added a comment - All pull requests merged to develop and master and released as: ts_salobj v5.6.0 ts_config_atcalsys v0.1.0 ts_config_attcs v0.4.0 ts_config_latiss v0.3.0 ts_config_mttcs v0.1.0 ts_config_ocs v0.5.0

              People

              Assignee:
              rowen Russell Owen
              Reporter:
              rowen Russell Owen
              Reviewers:
              Wouter van Reeven
              Watchers:
              Russell Owen, Wouter van Reeven
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Jenkins

                  No builds found.