SIENTIAPDE-988

Enhance IngestorManager and related tests with notification handling integration

- Added notification_handler parameter to IngestorManager and OpcManager initialization for improved event handling.
- Updated unit tests to include notification_handler in the Ingestor and IngestorManager instantiation, ensuring proper coverage of new functionality.
- Refactored test cases to validate the integration of notification handling across components.
This commit is contained in:
vitor-aignosi
2025-05-05 10:06:05 -03:00
parent d00078d323
commit 5f95b6309e
3 changed files with 6 additions and 5 deletions

View File

@@ -54,7 +54,7 @@ class IngestorManager():
f"Initializing OpcManager at {server_config['url']}") f"Initializing OpcManager at {server_config['url']}")
manager = OpcManager( manager = OpcManager(
server_config['name'], server_config['url'], data_manager, logger, server_config['server_uri'], server_config['name'], server_config['url'], data_manager, logger, server_config['server_uri'],
server_config.get('cert_path'), server_config.get( self.notification_handler, server_config.get('cert_path'), server_config.get(
'private_key_path'), server_config.get('server_cert_path') 'private_key_path'), server_config.get('server_cert_path')
) )

View File

@@ -41,7 +41,7 @@ def test___init__(notification_handler_mock, resource_manager_mock, data_manager
opc_manager_mock.assert_not_called() opc_manager_mock.assert_not_called()
data_manager_mock.assert_called_once_with( data_manager_mock.assert_called_once_with(
"localhost:9092", ingestor.logger) "localhost:9092", ingestor.logger, ingestor.notification_handler)
resource_manager_mock.assert_called_once_with( resource_manager_mock.assert_called_once_with(
"localhost", 6379, 60, 60, "test_pod", None, None) "localhost", 6379, 60, 60, "test_pod", None, None)
@@ -70,7 +70,8 @@ def test_initialize_opc_from_config(opc_manager, ingestor_manager):
opc_manager.assert_called_once_with( opc_manager.assert_called_once_with(
server_config['name'], server_config['url'], ingestor_manager.data_manager, ingestor_manager.logger, server_config['name'], server_config['url'], ingestor_manager.data_manager, ingestor_manager.logger,
server_config['server_uri'], server_config['cert_path'], server_config['private_key_path'], server_config['server_uri'], ingestor_manager.notification_handler,
server_config['cert_path'], server_config['private_key_path'],
server_config['server_cert_path'] server_config['server_cert_path']
) )

View File

@@ -123,9 +123,9 @@ def test_prepare_ingestor(ingestor_manager_mock, ingestor):
ingestor.pod_id, ingestor.pod_id,
ingestor.poll_interval, ingestor.poll_interval,
ingestor.logger, ingestor.logger,
ingestor.notification_handler,
ingestor.redis_username, ingestor.redis_username,
ingestor.redis_password, ingestor.redis_password
ingestor.notification_handler
) )
ingestor_manager.declare_active.assert_called_once() ingestor_manager.declare_active.assert_called_once()
ingestor_manager.get_slot_leases.assert_called_once() ingestor_manager.get_slot_leases.assert_called_once()