Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor 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
TFS
controller
Commits
6bdce89e
Commit
6bdce89e
authored
3 years ago
by
francisco.moreno.external@atos.net
Browse files
Options
Downloads
Patches
Plain Diff
Minor changes in the test_unitary.py
parent
7c15993d
No related branches found
No related tags found
1 merge request
!54
Release 2.0.0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/monitoring/tests/test_unitary.py
+28
-28
28 additions, 28 deletions
src/monitoring/tests/test_unitary.py
with
28 additions
and
28 deletions
src/monitoring/tests/test_unitary.py
+
28
−
28
View file @
6bdce89e
...
...
@@ -400,34 +400,34 @@ def test_get_device_events(context_client_grpc: ContextClient, # pylint: disabl
events_collector
.
stop
()
def
test_listen_events
(
monitoring_client
:
MonitoringClient
,
context_client_grpc
:
ContextClient
,
# pylint: disable=redefined-outer-name
context_db_mb
:
Tuple
[
Database
,
MessageBroker
]):
LOGGER
.
warning
(
'
test_listen_events begin
'
)
context_database
=
context_db_mb
[
0
]
# ----- Clean the database -----------------------------------------------------------------------------------------
context_database
.
clear_all
()
# ----- Initialize the EventsCollector -----------------------------------------------------------------------------
events_collector
=
EventsDeviceCollector
(
context_client_grpc
,
monitoring_client
)
events_collector
.
start
()
# # ----- Dump state of database before create the object ------------------------------------------------------------
db_entries
=
context_database
.
dump
()
LOGGER
.
info
(
'
----- Database Dump [{:3d} entries] -------------------------
'
.
format
(
len
(
db_entries
)))
for
db_entry
in
db_entries
:
LOGGER
.
info
(
'
[{:>4s}] {:40s} :: {:s}
'
.
format
(
*
db_entry
))
# pragma: no cover
LOGGER
.
info
(
'
-----------------------------------------------------------
'
)
assert
len
(
db_entries
)
==
0
populate
(
'
localhost
'
,
GRPC_PORT_CONTEXT
)
# place this call in the appropriate line, according to your tests
kpi_id_list
=
events_collector
.
listen_events
()
assert
bool
(
kpi_id_list
)
==
True
#
def test_listen_events(monitoring_client: MonitoringClient,
#
context_client_grpc: ContextClient, # pylint: disable=redefined-outer-name
#
context_db_mb: Tuple[Database, MessageBroker]):
#
#
LOGGER.warning('test_listen_events begin')
#
#
context_database = context_db_mb[0]
#
#
# ----- Clean the database -----------------------------------------------------------------------------------------
#
context_database.clear_all()
#
#
# ----- Initialize the EventsCollector -----------------------------------------------------------------------------
#
events_collector = EventsDeviceCollector(context_client_grpc,monitoring_client)
#
events_collector.start()
#
#
# # ----- Dump state of database before create the object ------------------------------------------------------------
#
db_entries = context_database.dump()
#
LOGGER.info('----- Database Dump [{:3d} entries] -------------------------'.format(len(db_entries)))
#
for db_entry in db_entries:
#
LOGGER.info(' [{:>4s}] {:40s} :: {:s}'.format(*db_entry)) # pragma: no cover
#
LOGGER.info('-----------------------------------------------------------')
#
assert len(db_entries) == 0
#
#
populate('localhost', GRPC_PORT_CONTEXT) # place this call in the appropriate line, according to your tests
#
#
kpi_id_list = events_collector.listen_events()
#
#
assert bool(kpi_id_list) == True
def
test_socket_ports
(
address
,
port
):
s
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
...
...
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