Skip to content
Snippets Groups Projects
Commit 4f2502b1 authored by Stefano Di Frischia's avatar Stefano Di Frischia
Browse files

L2SS-846: fix integration test

parent 6e667c75
Branches
Tags
2 merge requests!384Draft: Resolve L2SS-847 "Tango host in stats writer",!374Resolve L2SS-846: add disable_hardware to devices
...@@ -21,8 +21,12 @@ class TestDeviceTemperatureManager(AbstractTestBases.TestDeviceBase): ...@@ -21,8 +21,12 @@ class TestDeviceTemperatureManager(AbstractTestBases.TestDeviceBase):
def setUp(self): def setUp(self):
"""Intentionally recreate the device object in each test""" """Intentionally recreate the device object in each test"""
self.recv_proxy = self.setup_recv_proxy() self.recv_proxy = self.setup_recv_proxy()
self.sdp_proxy = self.setup_sdp_proxy()
self.unb2_proxy = self.setup_unb2_proxy()
self.apsct_proxy = self.setup_apsct_proxy()
self.apspu_proxy = self.setup_apspu_proxy()
super().setUp("STAT/TemperatureManager/1") super().setUp("STAT/TemperatureManager/1")
self.proxy.put_property({"Shutdown_Device_List": ["STAT/SDP/1", "STAT/UNB2/1", "STAT/RECV/1", "STAT/APSCT/1", "STAT/APSPU/1"]})
def tearDown(self): def tearDown(self):
self.recv_proxy.stop_poll_attribute("HBAT_LED_on_RW") self.recv_proxy.stop_poll_attribute("HBAT_LED_on_RW")
...@@ -37,6 +41,34 @@ class TestDeviceTemperatureManager(AbstractTestBases.TestDeviceBase): ...@@ -37,6 +41,34 @@ class TestDeviceTemperatureManager(AbstractTestBases.TestDeviceBase):
self.assertTrue(recv_proxy.is_attribute_polled(f"HBAT_LED_on_RW")) self.assertTrue(recv_proxy.is_attribute_polled(f"HBAT_LED_on_RW"))
return recv_proxy return recv_proxy
def setup_sdp_proxy(self):
sdp_proxy = TestDeviceProxy("STAT/SDP/1")
sdp_proxy.off()
sdp_proxy.warm_boot()
sdp_proxy.set_defaults()
return sdp_proxy
def setup_unb2_proxy(self):
unb2_proxy = TestDeviceProxy("STAT/UNB2/1")
unb2_proxy.off()
unb2_proxy.warm_boot()
unb2_proxy.set_defaults()
return unb2_proxy
def setup_apsct_proxy(self):
apsct_proxy = TestDeviceProxy("STAT/APSCT/1")
apsct_proxy.off()
apsct_proxy.warm_boot()
apsct_proxy.set_defaults()
return apsct_proxy
def setup_apspu_proxy(self):
apspu_proxy = TestDeviceProxy("STAT/APSPU/1")
apspu_proxy.off()
apspu_proxy.warm_boot()
apspu_proxy.set_defaults()
return apspu_proxy
def test_alarm(self): def test_alarm(self):
self.proxy.off() self.proxy.off()
self.proxy.initialise() self.proxy.initialise()
...@@ -55,22 +87,28 @@ class TestDeviceTemperatureManager(AbstractTestBases.TestDeviceBase): ...@@ -55,22 +87,28 @@ class TestDeviceTemperatureManager(AbstractTestBases.TestDeviceBase):
self.assertTrue(self.proxy.is_alarming_R) self.assertTrue(self.proxy.is_alarming_R)
def test_shutdown(self): def test_shutdown(self):
self.setup_recv_proxy() recv_proxy = self.setup_recv_proxy()
sdp_proxy = self.setup_sdp_proxy()
unb2_proxy = self.setup_unb2_proxy()
apsct_proxy = self.setup_apsct_proxy()
apspu_proxy = self.setup_apspu_proxy()
self.proxy.off() self.proxy.off()
self.proxy.initialise() self.proxy.initialise()
self.proxy.on() self.proxy.on()
devices = [DeviceProxy("STAT/SDP/1"), DeviceProxy("STAT/UNB2/1"), DeviceProxy("STAT/RECV/1"), devices = [sdp_proxy, recv_proxy, unb2_proxy, apsct_proxy, apspu_proxy]
DeviceProxy("STAT/APSCT/1"), DeviceProxy("STAT/APSPU/1")]
# make sure none of the devices are in the OFF state. Any other state is fine # make sure none of the devices are in the OFF or FAULT state. Any other state is fine
for dev in devices: for dev in devices:
if dev.state() == DevState.OFF: if dev.state() == DevState.OFF:
dev.warm_boot() dev.warm_boot()
elif dev.state() == DevState.FAULT:
dev.off()
dev.warm_boot()
# toggle the attribute to make sure we get a change event to True # toggle the attribute to make sure we get a change event to True
self.recv_proxy.HBAT_LED_on_RW = [[False] * 32] * 96 recv_proxy.HBAT_LED_on_RW = [[False] * 32] * 96
self.recv_proxy.HBAT_LED_on_RW = [[True] * 32] * 96 recv_proxy.HBAT_LED_on_RW = [[True] * 32] * 96
# sleeping here to make sure we've dealt with the above events # sleeping here to make sure we've dealt with the above events
time.sleep(2) time.sleep(2)
...@@ -78,7 +116,6 @@ class TestDeviceTemperatureManager(AbstractTestBases.TestDeviceBase): ...@@ -78,7 +116,6 @@ class TestDeviceTemperatureManager(AbstractTestBases.TestDeviceBase):
# make sure all the devices are in the DISABLE state # make sure all the devices are in the DISABLE state
for dev in devices: for dev in devices:
if dev.name().lower() in ["stat/sdp/1","stat/apspu/1"]: if dev.name().lower() in ["stat/sdp/1","stat/apspu/1"]:
time.sleep(1)
self.assertEqual(DevState.DISABLE, dev.state()) self.assertEqual(DevState.DISABLE, dev.state())
else: else:
# Other device raise a TimeoutError since they wait for the attribute *_translator_busy_R to become False # Other device raise a TimeoutError since they wait for the attribute *_translator_busy_R to become False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment