SIENTIAPDE-1350: Configure cleanup test script and improve test isolation. This commit configures the cleanup test script to load environment variables from a .env file and use them for Temporal connection. It also adds a fixture to clean up temporary directories created by tests, ensuring better test isolation and preventing potential conflicts. Additionally, it adds the 'uri' property to the MongoDB config.

This commit is contained in:
Bruno Domingues
2025-11-25 00:44:55 -03:00
parent 463906073e
commit f3c88885ea
4 changed files with 79 additions and 13 deletions

View File

@@ -209,6 +209,7 @@ async def test_main_successful_startup(
mock_build_mongodb.return_value = {
'connection_string': 'mongodb://test',
'database_name': 'test_db',
'uri': 'localhost:27018',
}
mock_build_postgres.return_value = {}
mock_build_mlflow.return_value = {}
@@ -290,6 +291,7 @@ async def test_main_handles_exception(
mock_build_mongodb.return_value = {
'connection_string': 'mongodb://test',
'database_name': 'test_db',
'uri': 'localhost:27018',
}
mock_build_postgres.return_value = {}
mock_build_mlflow.return_value = {}
@@ -372,6 +374,7 @@ async def test_main_temporal_client_configuration(
mock_build_mongodb.return_value = {
'connection_string': 'mongodb://test',
'database_name': 'test_db',
'uri': 'localhost:27018',
}
mock_build_postgres.return_value = {}
mock_build_mlflow.return_value = {}
@@ -404,7 +407,10 @@ async def test_main_temporal_client_configuration(
# Verify Temporal client was configured with correct parameters
mock_client_class.connect.assert_called_once_with(
target_host='temporal.example.com:7233', namespace='production', runtime=mock_runtime
target_host='temporal.example.com:7233',
namespace='production',
runtime=mock_runtime,
tls=False,
)
@@ -445,6 +451,7 @@ async def test_main_worker_configuration(
mock_build_mongodb.return_value = {
'connection_string': 'mongodb://test',
'database_name': 'test_db',
'uri': 'localhost:27018',
}
mock_build_postgres.return_value = {}
mock_build_mlflow.return_value = {}