From e90ef1b48845e5de2800f53ba095d593b264c98b Mon Sep 17 00:00:00 2001 From: kfanning Date: Mon, 25 Nov 2024 17:37:41 -0300 Subject: [PATCH 1/2] DM-47795: M1M3 check actuators, added status check of other test to avoid prematurely raising a RuntimeError when testing both primary and secondary when the first one tested fails. --- .../lsst/ts/observatory/control/maintel/mtcs.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/python/lsst/ts/observatory/control/maintel/mtcs.py b/python/lsst/ts/observatory/control/maintel/mtcs.py index 98054079..5c1de560 100644 --- a/python/lsst/ts/observatory/control/maintel/mtcs.py +++ b/python/lsst/ts/observatory/control/maintel/mtcs.py @@ -1447,6 +1447,14 @@ async def _wait_bump_test_ok( done = (primary_status == MTM1M3.BumpTest.PASSED if primary else True) and ( secondary_status == MTM1M3.BumpTest.PASSED if secondary else True ) + primary_testing = ( + primary_status not in {MTM1M3.BumpTest.PASSED, MTM1M3.BumpTest.FAILED} + and primary + ) + secondary_testing = ( + secondary_status not in {MTM1M3.BumpTest.PASSED, MTM1M3.BumpTest.FAILED} + and secondary + ) if done: self.log.info( @@ -1454,11 +1462,15 @@ async def _wait_bump_test_ok( f"{primary_status!r}[{primary}], {secondary_status!r}[{secondary}]" ) return - elif primary and primary_status == MTM1M3.BumpTest.FAILED: + elif ( + primary and primary_status == MTM1M3.BumpTest.FAILED + ) and not secondary_testing: raise RuntimeError( f"Primary bump test failed for actuator {actuator_id}." ) - elif secondary and secondary_status == MTM1M3.BumpTest.FAILED: + elif ( + secondary and secondary_status == MTM1M3.BumpTest.FAILED + ) and not primary_testing: raise RuntimeError( f"Secondary bump test failed for actuator {actuator_id}." ) From 1d096887924eec321b259cc272374c018630dbea Mon Sep 17 00:00:00 2001 From: kfanning Date: Mon, 25 Nov 2024 19:16:30 -0300 Subject: [PATCH 2/2] DM-47795: adjusting test case for the new wait, adding news fragment. --- doc/news/DM-47795.bugfix.rst | 1 + tests/maintel/test_mtcs.py | 13 ------------- 2 files changed, 1 insertion(+), 13 deletions(-) create mode 100644 doc/news/DM-47795.bugfix.rst diff --git a/doc/news/DM-47795.bugfix.rst b/doc/news/DM-47795.bugfix.rst new file mode 100644 index 00000000..630c476e --- /dev/null +++ b/doc/news/DM-47795.bugfix.rst @@ -0,0 +1 @@ +IN ``mtcs.py``, wait for both primary and secondary bump tests to finish to avoid a race condition where the last actuator has its test cancelled due to exiting engineering mode on M1M3. \ No newline at end of file diff --git a/tests/maintel/test_mtcs.py b/tests/maintel/test_mtcs.py index 1f448bd7..c2a1b3f0 100644 --- a/tests/maintel/test_mtcs.py +++ b/tests/maintel/test_mtcs.py @@ -1707,19 +1707,6 @@ async def test_run_m1m3_actuator_bump_test_both_fail(self) -> None: secondary_status, ) = await self.mtcs.get_m1m3_bump_test_status(actuator_id=actuator_id) - assert primary_status == idl.enums.MTM1M3.BumpTest.FAILED - assert secondary_status != idl.enums.MTM1M3.BumpTest.FAILED - - with pytest.raises(RuntimeError): - await self.mtcs._wait_bump_test_ok( - actuator_id=actuator_id, primary=False, secondary=True - ) - - ( - primary_status, - secondary_status, - ) = await self.mtcs.get_m1m3_bump_test_status(actuator_id=actuator_id) - assert primary_status == idl.enums.MTM1M3.BumpTest.FAILED assert secondary_status == idl.enums.MTM1M3.BumpTest.FAILED