Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cvillalon committed Nov 18, 2024
1 parent 563ac48 commit 66357a2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
3 changes: 1 addition & 2 deletions doc/news/DM-47223.feature.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
Update ``_wait_hard_point_test_ok`` method in ``MTCS`` to be compatible with
concurrent executions.
Update ``_wait_hard_point_test_ok`` method in ``MTCS`` to be compatible with concurrent executions.
14 changes: 10 additions & 4 deletions python/lsst/ts/observatory/control/maintel/mtcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ async def _wait_hard_point_test_ok(self, hp: int) -> None:
hp_test_state = MTM1M3.HardpointTest(
(
await self.rem.mtm1m3.evt_hardpointTestStatus.aget(
flush=False, timeout=self.timeout_hardpoint_test_status
timeout=self.timeout_hardpoint_test_status
)
).testState[hp - 1]
)
Expand All @@ -1331,9 +1331,15 @@ async def _wait_hard_point_test_ok(self, hp: int) -> None:
else:
self.log.info(f"Hard point {hp} test state: {hp_test_state!r}.")

await self.rem.mtm1m3.evt_heartbeat.next(
flush=True, timeout=self.timeout_hardpoint_test_status
)
try:
await self.rem.mtm1m3.evt_heartbeat.next(
flush=True, timeout=self.timeout_hardpoint_test_status
)
except asyncio.TimeoutError:
raise RuntimeError(
f"No heartbeat received from M1M3 in the last {self.timeout_hardpoint_test_status}s"
" while waiting for hard point data information. Check CSC liveliness."
)

async def _wait_bump_test_ok(
self, actuator_id: int, primary: bool, secondary: bool
Expand Down
15 changes: 13 additions & 2 deletions tests/maintel/test_mtcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1485,7 +1485,6 @@ async def test_run_m1m3_hard_point_test(self) -> None:
)
self.mtcs.rem.mtm1m3.evt_hardpointTestStatus.flush.assert_called()
self.mtcs.rem.mtm1m3.evt_hardpointTestStatus.aget.assert_awaited_with(
flush=False,
timeout=self.mtcs.timeout_hardpoint_test_status,
)

Expand All @@ -1501,10 +1500,22 @@ async def test_run_m1m3_hard_point_test_failed(self) -> None:
)
self.mtcs.rem.mtm1m3.evt_hardpointTestStatus.flush.assert_called()
self.mtcs.rem.mtm1m3.evt_hardpointTestStatus.aget.assert_awaited_with(
flush=False,
timeout=self.mtcs.timeout_hardpoint_test_status,
)

async def test_run_m1m3_hard_point_test_timeout(self) -> None:
message = (
f"No heartbeat received from M1M3 in the last {self.mtcs.timeout_hardpoint_test_status}s"
" while waiting for hard point data information. Check CSC liveliness."
)
with unittest.mock.patch.object(
self.mtcs.rem.mtm1m3.evt_heartbeat,
"next",
side_effect=asyncio.TimeoutError,
):
with pytest.raises(RuntimeError, match=message):
await self.mtcs.run_m1m3_hard_point_test(hp=1)

async def test_stop_m1m3_hard_point_test(self) -> None:
await self.mtcs.stop_m1m3_hard_point_test(hp=1)

Expand Down

0 comments on commit 66357a2

Please sign in to comment.