Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tango
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
tango
Commits
578556c2
Commit
578556c2
authored
3 years ago
by
Stefano Di Frischia
Browse files
Options
Downloads
Patches
Plain Diff
L2SS-747
: introduce wait_function in archiver integration_test
parent
8ef54c02
No related branches found
No related tags found
1 merge request
!303
L2SS-747: Fix integration tests
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tangostationcontrol/tangostationcontrol/integration_test/default/toolkit/test_archiver.py
+22
-4
22 additions, 4 deletions
...control/integration_test/default/toolkit/test_archiver.py
with
22 additions
and
4 deletions
tangostationcontrol/tangostationcontrol/integration_test/default/toolkit/test_archiver.py
+
22
−
4
View file @
578556c2
...
...
@@ -14,6 +14,7 @@ from tangostationcontrol.toolkit.archiver_util import attribute_fqdn
from
tangostationcontrol.integration_test.device_proxy
import
TestDeviceProxy
import
time
from
tango
import
DeviceProxy
from
datetime
import
datetime
...
...
@@ -23,6 +24,10 @@ class TestArchiver(BaseIntegrationTestCase):
super
().
setUp
()
self
.
archiver
=
Archiver
()
self
.
assertIsNotNone
(
self
.
archiver
)
# Safety cleanup
self
.
archiver
.
cm
.
delete_property
(
'
__SubDevices
'
)
DeviceProxy
(
self
.
archiver
.
get_subscribers
()[
0
]).
delete_property
(
'
AttributeList
'
)
DeviceProxy
(
self
.
archiver
.
get_subscribers
()[
0
]).
delete_property
(
'
__SubDevices
'
)
def
test_archiver_initialisation
(
self
):
"""
Test archiver main attributes
"""
...
...
@@ -61,8 +66,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 +77,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 +112,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 +123,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 +160,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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment