QTZPOC-20

QTZPOC-20: Enhance OPC repository client configuration and secure connection validation; refine MLflow test error handling and async test execution; add SonarQube suppressions.
This commit is contained in:
2026-09-09 08:26:59 -03:00
parent eb89917c5a
commit abfd474e4d
6 changed files with 18 additions and 15 deletions

View File

@@ -519,7 +519,7 @@ async def test_retrain_model_data_error_no_minio_repository(mlflow):
}
)
assert str(e.value) == 'Minio repository not initialized'
assert str(e.value) == 'Minio repository not initialized'
@mark.asyncio
@@ -641,12 +641,12 @@ async def test_get_reference_data_exception(mlflow):
'model_name': 'test_model',
}
mlflow.model_monitoring_repository.load_artifact_dataframe.side_effect = Exception(
mlflow.model_monitoring_repository.load_artifact_dataframe.side_effect = RuntimeError(
'Error loading artifact'
)
# Act & Assert
with raises(Exception) as e:
with raises(RuntimeError) as e:
await mlflow.get_reference_data(input_data)
assert str(e.value) == 'Error loading artifact'

View File

@@ -206,7 +206,6 @@ async def test_create_client_builds_a_secured_client(opc_repository, mock_client
assert opc_repository.client is mock_client
assert mock_client.name == 'pod-1'
assert mock_client.application_name == 'pod-1'
assert mock_client.application_uri == 'pod:1'
assert mock_client.product_uri == 'pod:1'
opc_repository.set_security.assert_called_once()

View File

@@ -20,8 +20,9 @@ def test_main_exits_when_runtime_is_unset(mock_get_logger, mock_app_up, monkeypa
logger = MagicMock()
mock_get_logger.return_value = logger
coro = main()
with raises(SystemExit) as exc:
asyncio.run(main())
asyncio.run(coro)
assert exc.value.code == 1
logger.custom_critical.assert_called_once()
@@ -54,8 +55,9 @@ class TestMainHappyPath:
mock_prepare_worker.return_value = worker
mock_connect.return_value = MagicMock()
coro = main()
with raises(SystemExit) as exc:
asyncio.run(main())
asyncio.run(coro)
return exc.value.code
def test_runs_four_workers_without_the_import_flag( # noqa: PLR0913
@@ -195,8 +197,9 @@ class TestMainHappyPath:
worker.run = AsyncMock(side_effect=RuntimeError('boom'))
mock_prepare_worker.return_value = worker
coro = main()
with raises(SystemExit) as exc:
asyncio.run(main())
asyncio.run(coro)
assert exc.value.code == 1
logger.custom_error.assert_called_once_with(ANY, ANY)