SIENTIAPDE-1314

Refactor IngestorManager and OpcManager for improved server management

- Introduced a new method `remove_server` in IngestorManager to encapsulate server removal logic, enhancing code clarity and reusability.
- Updated `update_opc_servers` to utilize the new `remove_server` method for better maintainability.
- Refactored security settings in OpcManager to use direct attribute assignments instead of method calls, streamlining the code.
- Adjusted unit tests to reflect changes in the IngestorManager and OpcManager, ensuring proper asynchronous behavior and mocking.
This commit is contained in:
vitor-aignosi
2025-10-23 15:11:32 -03:00
parent cc0fde664b
commit 56023dfdf4
4 changed files with 54 additions and 38 deletions

View File

@@ -105,7 +105,7 @@ async def test_shutdown_error(opc_manager):
async def test_set_security_success(opc_manager):
await opc_manager.set_security()
opc_manager.client.set_application_uri.assert_called_once_with(opc_manager.server_uri)
assert opc_manager.client.application_uri == opc_manager.server_uri
opc_manager.client.set_security.assert_called_once_with(
SecurityPolicyBasic256,
@@ -114,8 +114,8 @@ async def test_set_security_success(opc_manager):
server_certificate=opc_manager.server_cert_path,
)
opc_manager.client.set_secure_channel_timeout.assert_called_once_with(10000000)
opc_manager.client.set_session_timeout.assert_called_once_with(10000000)
assert opc_manager.client.secure_channel_timeout == 10000000
assert opc_manager.client.session_timeout == 10000000
@mark.asyncio