Skip to content
Snippets Groups Projects

L2SS-747: Fix integration tests

Merged Jan David Mol requested to merge L2SS-747-fix-master into master
Files
2
@@ -61,8 +61,10 @@ class TestArchiver(BaseIntegrationTestCase):
@@ -61,8 +61,10 @@ class TestArchiver(BaseIntegrationTestCase):
self.archiver.remove_attributes_in_error()
self.archiver.remove_attributes_in_error()
time.sleep(3)
time.sleep(3)
"""
"""
 
polling_period=1000
 
archive_event_period=3000
attr_fullname = 'stat/recv/1/recvtr_translator_busy_r' # boolean
attr_fullname = 'stat/recv/1/recvtr_translator_busy_r' # boolean
self.archiver.add_attribute_to_archiver(attr_fullname, polling_period=1000, archive_event_period=3000)
self.archiver.add_attribute_to_archiver(attr_fullname, polling_period, archive_event_period)
time.sleep(3)
time.sleep(3)
# Test if the attribute has been correctly added to event subscriber
# Test if the attribute has been correctly added to event subscriber
self.assertTrue(self.archiver.is_attribute_archived(attribute_fqdn(attr_fullname)))
self.assertTrue(self.archiver.is_attribute_archived(attribute_fqdn(attr_fullname)))
@@ -70,7 +72,7 @@ class TestArchiver(BaseIntegrationTestCase):
@@ -70,7 +72,7 @@ class TestArchiver(BaseIntegrationTestCase):
# Retrieve data from DB views
# Retrieve data from DB views
self.retriever = RetrieverTimescale()
self.retriever = RetrieverTimescale()
self.assertIsNotNone(self.retriever)
self.assertIsNotNone(self.retriever)
records = self.retriever.get_lofar_attribute(attr_fullname)
records = self._wait_for_archiving(attr_fullname, archive_event_period)
self.assertTrue(len(records)>0)
self.assertTrue(len(records)>0)
item = records[-1] # last table record
item = records[-1] # last table record
self.assertEqual('stat/recv/1',item.device) # column device
self.assertEqual('stat/recv/1',item.device) # column device
@@ -105,8 +107,10 @@ class TestArchiver(BaseIntegrationTestCase):
@@ -105,8 +107,10 @@ class TestArchiver(BaseIntegrationTestCase):
self.archiver.remove_attributes_in_error()
self.archiver.remove_attributes_in_error()
time.sleep(3)
time.sleep(3)
"""
"""
 
polling_period=1000
 
archive_event_period=3000
attr_fullname = 'stat/sdp/1/fpga_temp_r' # double
attr_fullname = 'stat/sdp/1/fpga_temp_r' # double
self.archiver.add_attribute_to_archiver(attr_fullname, polling_period=1000, archive_event_period=3000)
self.archiver.add_attribute_to_archiver(attr_fullname, polling_period, archive_event_period)
time.sleep(3)
time.sleep(3)
# Test if the attribute has been correctly added to event subscriber
# Test if the attribute has been correctly added to event subscriber
self.assertTrue(self.archiver.is_attribute_archived(attribute_fqdn(attr_fullname)))
self.assertTrue(self.archiver.is_attribute_archived(attribute_fqdn(attr_fullname)))
@@ -114,7 +118,7 @@ class TestArchiver(BaseIntegrationTestCase):
@@ -114,7 +118,7 @@ class TestArchiver(BaseIntegrationTestCase):
# Retrieve data from DB views
# Retrieve data from DB views
self.retriever = RetrieverTimescale()
self.retriever = RetrieverTimescale()
self.assertIsNotNone(self.retriever)
self.assertIsNotNone(self.retriever)
records = self.retriever.get_lofar_attribute(attr_fullname)
records = self._wait_for_archiving(attr_fullname, archive_event_period)
self.assertTrue(len(records)>0)
self.assertTrue(len(records)>0)
item = records[-1] # last table record
item = records[-1] # last table record
self.assertEqual('stat/sdp/1',item.device) # column device
self.assertEqual('stat/sdp/1',item.device) # column device
@@ -151,3 +155,12 @@ class TestArchiver(BaseIntegrationTestCase):
@@ -151,3 +155,12 @@ class TestArchiver(BaseIntegrationTestCase):
time.sleep(3)
time.sleep(3)
max_load = self.archiver.get_maximum_device_load(device_name)
max_load = self.archiver.get_maximum_device_load(device_name)
self.assertGreater(max_load,0)
self.assertGreater(max_load,0)
 
 
def _wait_for_archiving(self, attr_fullname: str, archive_event_period: int, max_wait: int = 10):
 
wait = 0
 
records = self.retriever.get_lofar_attribute(attr_fullname)
 
while (not(len(records)>0) and wait<max_wait):
 
time.sleep(archive_event_period)
 
records = self.retriever.get_lofar_attribute(attr_fullname)
 
wait+=1
 
return records
Loading