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.
This commit is contained in:
vitor-aignosi
2025-09-24 10:57:38 -03:00
parent dacbcbf56a
commit 49f3429556
3 changed files with 13 additions and 29 deletions

View File

@@ -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), "server_cert_path": opc_servers[server_id].get('server_cert_path', None),
"tags": {} "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']] = { slot_config[f"{i}"][server_name]["tags"][tag['tag_address']] = {
**tag, **tag,

View File

@@ -121,10 +121,7 @@ async def test_process_slots(mock_build_tag_config, mock_gather_read_tags, forma
"id": "1", "id": "1",
"server_name": "test_server_name", "server_name": "test_server_name",
"url": "test_url", "url": "test_url",
"uri": "test_uri", "uri": "test_uri"
"security_spec": {
"test_name": "test_spec"
}
}, },
{ {
"id": "2", "id": "2",
@@ -157,10 +154,7 @@ async def test_process_slots(mock_build_tag_config, mock_gather_read_tags, forma
"id": "1", "id": "1",
"server_name": "test_server_name", "server_name": "test_server_name",
"url": "test_url", "url": "test_url",
"uri": "test_uri", "uri": "test_uri"
"security_spec": {
"test_name": "test_spec"
}
}, },
"2": { "2": {
"id": "2", "id": "2",
@@ -186,10 +180,7 @@ async def test_process_slots(mock_build_tag_config, mock_gather_read_tags, forma
"id": "1", "id": "1",
"server_name": "test_server_name", "server_name": "test_server_name",
"url": "test_url", "url": "test_url",
"uri": "test_uri", "uri": "test_uri"
"security_spec": {
"test_name": "test_spec"
}
}, },
"2": { "2": {
"id": "2", "id": "2",
@@ -215,10 +206,7 @@ async def test_process_slots(mock_build_tag_config, mock_gather_read_tags, forma
"id": "1", "id": "1",
"server_name": "test_server_name", "server_name": "test_server_name",
"url": "test_url", "url": "test_url",
"uri": "test_uri", "uri": "test_uri"
"security_spec": {
"test_name": "test_spec"
}
}, },
"2": { "2": {
"id": "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", "name": "test_server_name",
"url": "test_url", "url": "test_url",
"server_uri": "test_uri", "server_uri": "test_uri",
"test_name": "test_spec",
"cert_path": None, "cert_path": None,
"private_key_path": None, "private_key_path": None,
"server_cert_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", "server_name": "test_server_name",
"url": "test_url", "url": "test_url",
"uri": "test_uri", "uri": "test_uri",
"security_spec": { "cert_path": 'test_cert_path',
"test_name": "test_spec" "private_key_path": 'test_private_key_path',
} "server_cert_path": 'test_server_cert_path'
}, },
{ {
"id": "2", "id": "2",
"server_name": "test_server_name2", "server_name": "test_server_name2",
"url": "test_url2", "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": [ "active_ingestors": [

View File

@@ -368,10 +368,7 @@ def test_build_tag_config():
"1": { "1": {
"server_name": "test_server_name", "server_name": "test_server_name",
"url": "test_url", "url": "test_url",
"uri": "test_uri", "uri": "test_uri"
"security_spec": {
"test_name": "test_spec"
}
} }
} }
slot_config = { slot_config = {
@@ -395,8 +392,7 @@ def test_build_tag_config():
"server_name": "test_server_name", "server_name": "test_server_name",
"tag_address": "test_tag_address" "tag_address": "test_tag_address"
} }
}, }
"test_name": "test_spec"
} }
} }
} }