From 49f3429556a1cd4afc96c448db42b98764c3f868 Mon Sep 17 00:00:00 2001 From: vitor-aignosi Date: Wed, 24 Sep 2025 10:57:38 -0300 Subject: [PATCH] SIENTIAPDE-1222 SIENTIAPDE-1222 Refactor server configuration handling in orchestrator_functions.py and update related tests - Removed the security_spec field from server configuration in build_tag_config to streamline the configuration process. - Updated test cases in test_formatters.py and test_orchestrator_functions.py to reflect the removal of security_spec, ensuring alignment with the new configuration structure and improving test accuracy. --- orchestrator/utils/orchestrator_functions.py | 2 -- .../activities/test_formatters.py | 32 +++++++------------ .../utils/test_orchestrator_functions.py | 8 ++--- 3 files changed, 13 insertions(+), 29 deletions(-) diff --git a/orchestrator/utils/orchestrator_functions.py b/orchestrator/utils/orchestrator_functions.py index 79f1070..64499b0 100644 --- a/orchestrator/utils/orchestrator_functions.py +++ b/orchestrator/utils/orchestrator_functions.py @@ -287,8 +287,6 @@ def build_tag_config(tag: dict[str, Any], slot_config: dict[str, Any], "server_cert_path": opc_servers[server_id].get('server_cert_path', None), "tags": {} } - for name, spec in opc_servers[server_id].get('security_spec', {}).items(): - slot_config[f"{i}"][server_name][name] = spec slot_config[f"{i}"][server_name]["tags"][tag['tag_address']] = { **tag, diff --git a/tests/orchestrator/activities/test_formatters.py b/tests/orchestrator/activities/test_formatters.py index cf2e17a..aec0e12 100644 --- a/tests/orchestrator/activities/test_formatters.py +++ b/tests/orchestrator/activities/test_formatters.py @@ -121,10 +121,7 @@ async def test_process_slots(mock_build_tag_config, mock_gather_read_tags, forma "id": "1", "server_name": "test_server_name", "url": "test_url", - "uri": "test_uri", - "security_spec": { - "test_name": "test_spec" - } + "uri": "test_uri" }, { "id": "2", @@ -157,10 +154,7 @@ async def test_process_slots(mock_build_tag_config, mock_gather_read_tags, forma "id": "1", "server_name": "test_server_name", "url": "test_url", - "uri": "test_uri", - "security_spec": { - "test_name": "test_spec" - } + "uri": "test_uri" }, "2": { "id": "2", @@ -186,10 +180,7 @@ async def test_process_slots(mock_build_tag_config, mock_gather_read_tags, forma "id": "1", "server_name": "test_server_name", "url": "test_url", - "uri": "test_uri", - "security_spec": { - "test_name": "test_spec" - } + "uri": "test_uri" }, "2": { "id": "2", @@ -215,10 +206,7 @@ async def test_process_slots(mock_build_tag_config, mock_gather_read_tags, forma "id": "1", "server_name": "test_server_name", "url": "test_url", - "uri": "test_uri", - "security_spec": { - "test_name": "test_spec" - } + "uri": "test_uri" }, "2": { "id": "2", @@ -238,7 +226,6 @@ async def test_process_slots(mock_build_tag_config, mock_gather_read_tags, forma "name": "test_server_name", "url": "test_url", "server_uri": "test_uri", - "test_name": "test_spec", "cert_path": None, "private_key_path": None, "server_cert_path": None, @@ -317,15 +304,18 @@ async def test_process_slots_exception(mock_build_tag_config, mock_gather_read_t "server_name": "test_server_name", "url": "test_url", "uri": "test_uri", - "security_spec": { - "test_name": "test_spec" - } + "cert_path": 'test_cert_path', + "private_key_path": 'test_private_key_path', + "server_cert_path": 'test_server_cert_path' }, { "id": "2", "server_name": "test_server_name2", "url": "test_url2", - "uri": "test_uri2" + "uri": "test_uri2", + "cert_path": 'test_cert_path2', + "private_key_path": 'test_private_key_path2', + "server_cert_path": 'test_server_cert_path2' } ], "active_ingestors": [ diff --git a/tests/orchestrator/utils/test_orchestrator_functions.py b/tests/orchestrator/utils/test_orchestrator_functions.py index 78cfe1b..28edc73 100644 --- a/tests/orchestrator/utils/test_orchestrator_functions.py +++ b/tests/orchestrator/utils/test_orchestrator_functions.py @@ -368,10 +368,7 @@ def test_build_tag_config(): "1": { "server_name": "test_server_name", "url": "test_url", - "uri": "test_uri", - "security_spec": { - "test_name": "test_spec" - } + "uri": "test_uri" } } slot_config = { @@ -395,8 +392,7 @@ def test_build_tag_config(): "server_name": "test_server_name", "tag_address": "test_tag_address" } - }, - "test_name": "test_spec" + } } } }