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
8ec6cbc9
Commit
8ec6cbc9
authored
2 years ago
by
Stefano Di Frischia
Browse files
Options
Downloads
Patches
Plain Diff
L2SS-780
: add archiverpolicy integration test
parent
fdc07228
No related branches found
No related tags found
1 merge request
!393
Resolve L2SS-780 "Prometheus exporter test"
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tangostationcontrol/tangostationcontrol/integration_test/default/prometheus/test_tango_prometheus_client.py
+33
-2
33 additions, 2 deletions
...n_test/default/prometheus/test_tango_prometheus_client.py
with
33 additions
and
2 deletions
tangostationcontrol/tangostationcontrol/integration_test/default/prometheus/test_tango_prometheus_client.py
+
33
−
2
View file @
8ec6cbc9
...
@@ -8,6 +8,9 @@
...
@@ -8,6 +8,9 @@
# See LICENSE.txt for more info.
# See LICENSE.txt for more info.
from
tangostationcontrol.integration_test.base
import
BaseIntegrationTestCase
from
tangostationcontrol.integration_test.base
import
BaseIntegrationTestCase
from
tangostationcontrol.integration_test.device_proxy
import
TestDeviceProxy
from
tango
import
Database
import
importlib
import
importlib
import
sys
import
sys
sys
.
path
.
append
(
'
/opt/lofar/tango/docker-compose/tango-prometheus-exporter/code
'
)
sys
.
path
.
append
(
'
/opt/lofar/tango/docker-compose/tango-prometheus-exporter/code
'
)
...
@@ -15,7 +18,35 @@ tpc = importlib.import_module('tango-prometheus-client')
...
@@ -15,7 +18,35 @@ tpc = importlib.import_module('tango-prometheus-client')
class
TestPrometheusClient
(
BaseIntegrationTestCase
):
class
TestPrometheusClient
(
BaseIntegrationTestCase
):
CONFIG
=
tpc
.
ArchiverPolicy
.
load_config
(
'
/opt/lofar/tango/docker-compose/tango-prometheus-exporter/lofar2-policy.json
'
)
def
setUp
(
self
):
def
setUp
(
self
):
super
().
setUp
()
super
().
setUp
()
self
.
policy
=
tpc
.
ArchiverPolicy
()
db
=
Database
()
self
.
assertIsNotNone
(
self
.
policy
)
station
=
db
.
get_property
(
"
station
"
,
"
name
"
)[
"
name
"
][
0
]
custom_collector
=
tpc
.
CustomCollector
(
self
.
CONFIG
,
station
)
self
.
assertIsNotNone
(
custom_collector
)
return
custom_collector
def
setup_recv_proxy
(
self
,
device_name
=
'
stat/recv/1
'
):
# setup RECV
recv_proxy
=
TestDeviceProxy
(
device_name
)
recv_proxy
.
off
()
recv_proxy
.
warm_boot
()
recv_proxy
.
set_defaults
()
return
recv_proxy
def
test_archiver_policy_attribute_list
(
self
):
"""
Test if the full set of archiving policy for the given device is retrieved
"""
device_name
=
'
stat/recv/1
'
recv_proxy
=
self
.
setup_recv_proxy
(
device_name
)
policy
=
tpc
.
ArchiverPolicy
(
self
.
CONFIG
)
attribute_list
=
policy
.
policy
.
attribute_list
(
device_name
,
recv_proxy
.
get_attribute_list
())
include
=
policy
.
config
[
'
devices
'
][
'
stat/recv/1
'
][
'
include
'
]
# attribute that must be included
for
i
in
include
:
if
'
*
'
not
in
i
:
# exclude wildcard
self
.
assertIn
(
i
,
attribute_list
)
exclude
=
policy
.
config
[
'
devices
'
][
'
stat/recv/1
'
][
'
exclude
'
]
# attribute that must be excluded
for
e
in
exclude
:
if
'
*
'
not
in
e
:
# exclude wildcard
self
.
assertNotIn
(
e
,
attribute_list
)
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