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

Merge branch 'L2SS-747-fix-master' into 'master'

L2SS-747: Fix integration tests

Closes L2SS-747

See merge request !303
parents c807b7e5 6f2752f2
No related branches found
No related tags found
1 merge request!303L2SS-747: Fix integration tests
......@@ -474,6 +474,7 @@ integration_test_docker:
fi
- apk add --update make bash docker-compose
- apk add --update bind-tools
- apk add --update postgresql14-client gzip
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- touch /root/.Xauthority
......@@ -498,6 +499,7 @@ integration_test_docker:
echo "Saving log for container $container"
docker logs "${container}" >& "log/${container}.log"
done
PGPASSWORD=password pg_dump --host=docker --username=postgres hdb 2>log/archiver-timescale-dump.log | gzip > log/archiver-timescale-dump.txt.gz
wheel_packaging:
stage: packaging
artifacts:
......
......@@ -61,8 +61,10 @@ class TestArchiver(BaseIntegrationTestCase):
self.archiver.remove_attributes_in_error()
time.sleep(3)
"""
polling_period=1000
archive_event_period=3000
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)
# Test if the attribute has been correctly added to event subscriber
self.assertTrue(self.archiver.is_attribute_archived(attribute_fqdn(attr_fullname)))
......@@ -70,7 +72,7 @@ class TestArchiver(BaseIntegrationTestCase):
# Retrieve data from DB views
self.retriever = RetrieverTimescale()
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)
item = records[-1] # last table record
self.assertEqual('stat/recv/1',item.device) # column device
......@@ -105,8 +107,10 @@ class TestArchiver(BaseIntegrationTestCase):
self.archiver.remove_attributes_in_error()
time.sleep(3)
"""
polling_period=1000
archive_event_period=3000
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)
# Test if the attribute has been correctly added to event subscriber
self.assertTrue(self.archiver.is_attribute_archived(attribute_fqdn(attr_fullname)))
......@@ -114,7 +118,7 @@ class TestArchiver(BaseIntegrationTestCase):
# Retrieve data from DB views
self.retriever = RetrieverTimescale()
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)
item = records[-1] # last table record
self.assertEqual('stat/sdp/1',item.device) # column device
......@@ -151,3 +155,12 @@ class TestArchiver(BaseIntegrationTestCase):
time.sleep(3)
max_load = self.archiver.get_maximum_device_load(device_name)
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment