Skip to content
Snippets Groups Projects
Commit 893da117 authored by Jan David Mol's avatar Jan David Mol
Browse files

Merge branch 'fix-archive-test-sleep' into 'master'

Fix sleep when waiting for archive period

See merge request !546
parents 596464a2 1407a131
Branches
Tags
1 merge request!546Fix sleep when waiting for archive period
...@@ -110,6 +110,7 @@ Next change the version in the following places: ...@@ -110,6 +110,7 @@ Next change the version in the following places:
# Release Notes # Release Notes
* 0.11.2 Fix sleep duration in archiver test
* 0.11.1 Fix event unsubscription in TemperatureManager * 0.11.1 Fix event unsubscription in TemperatureManager
* 0.11.0 Added StationManager device * 0.11.0 Added StationManager device
* 0.10.0 Add `AntennaToSdpMapper` and fpga_sdp_info_* mapped attributes in `Antennafield` device * 0.10.0 Add `AntennaToSdpMapper` and fpga_sdp_info_* mapped attributes in `Antennafield` device
......
0.11.1 0.11.2
...@@ -70,7 +70,9 @@ class TestArchiver(BaseIntegrationTestCase): ...@@ -70,7 +70,9 @@ 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._wait_for_archiving(attr_fullname, archive_event_period) records = self._wait_for_archiving(
attr_fullname, archive_event_period * 2
) # wait for >1 period to avoid race conditions
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
...@@ -231,12 +233,12 @@ class TestArchiver(BaseIntegrationTestCase): ...@@ -231,12 +233,12 @@ class TestArchiver(BaseIntegrationTestCase):
self.assertEqual(9, len(sdp_archived_attrs)) self.assertEqual(9, len(sdp_archived_attrs))
def _wait_for_archiving( def _wait_for_archiving(
self, attr_fullname: str, archive_event_period: int, max_wait: int = 10 self, attr_fullname: str, archive_event_period_ms: int, max_wait: int = 10
): ):
wait = 0 wait = 0
records = self.retriever.get_lofar_attribute(attr_fullname) records = self.retriever.get_lofar_attribute(attr_fullname)
while not (len(records) > 0) and wait < max_wait: while not (len(records) > 0) and wait < max_wait:
time.sleep(archive_event_period) time.sleep(archive_event_period_ms / 1000.0)
records = self.retriever.get_lofar_attribute(attr_fullname) records = self.retriever.get_lofar_attribute(attr_fullname)
wait += 1 wait += 1
return records return records
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment