SIENTIAPDE-1005
Enhance README and configuration files; add Redis authentication and update workflows
This commit is contained in:
@@ -14,20 +14,26 @@ def redis_activity(_mock_redis_client):
|
||||
logger = MagicMock()
|
||||
notification_handler = MagicMock(spec=NotificationHandler)
|
||||
return Redis(host='localhost', port=6379,
|
||||
logger=logger, notification_handler=notification_handler)
|
||||
logger=logger, notification_handler=notification_handler,
|
||||
username='test', password='test')
|
||||
|
||||
|
||||
@patch('scouter.activities.redis.redis.Redis')
|
||||
def test_redis_initialization(mock_redis_client):
|
||||
"""Test Redis activity initialization"""
|
||||
redis_activity = Redis(host='localhost', port=6379,
|
||||
logger=MagicMock(), notification_handler=MagicMock())
|
||||
logger=MagicMock(), notification_handler=MagicMock(),
|
||||
username='test', password='test')
|
||||
assert redis_activity.host == 'localhost'
|
||||
assert redis_activity.port == 6379
|
||||
assert redis_activity.username == 'test'
|
||||
assert redis_activity.password == 'test'
|
||||
mock_redis_client.assert_called_once_with(
|
||||
host='localhost',
|
||||
port=6379,
|
||||
decode_responses=True
|
||||
decode_responses=True,
|
||||
username='test',
|
||||
password='test'
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -90,7 +90,9 @@ def test_build_redis_config_defaults():
|
||||
|
||||
assert config == {
|
||||
'host': 'localhost',
|
||||
'port': 6379
|
||||
'port': 6379,
|
||||
'username': None,
|
||||
'password': None
|
||||
}
|
||||
|
||||
|
||||
@@ -99,11 +101,15 @@ def test_build_redis_config_with_env_vars():
|
||||
"""Test that build_redis_config uses env vars when set"""
|
||||
with patch.dict(os.environ, {
|
||||
'REDIS_HOST': 'redis.example.com',
|
||||
'REDIS_PORT': '6380'
|
||||
'REDIS_PORT': '6380',
|
||||
'REDIS_USERNAME': 'test',
|
||||
'REDIS_PASSWORD': 'test'
|
||||
}):
|
||||
config = build_redis_config()
|
||||
|
||||
assert config == {
|
||||
'host': 'redis.example.com',
|
||||
'port': 6380
|
||||
'port': 6380,
|
||||
'username': 'test',
|
||||
'password': 'test'
|
||||
}
|
||||
|
||||
@@ -16,7 +16,20 @@ async def test_scouter_workflow(mock_workflow, scouter):
|
||||
mock_workflow.execute_activity_method.return_value = 'test_data'
|
||||
await scouter.run(
|
||||
input_data={
|
||||
'topic': 'test_topic'
|
||||
'topic': 'test_topic',
|
||||
'schedule_name': 'test_schedule',
|
||||
'model_name': 'test_model',
|
||||
'model_id': 'test_model_id'
|
||||
}
|
||||
)
|
||||
|
||||
mock_workflow.execute_local_activity_method.assert_called_once_with(
|
||||
Activities.prepare_activity,
|
||||
{
|
||||
'workflow_name': 'scouter',
|
||||
'schedule_name': 'test_schedule',
|
||||
'model_name': 'test_model',
|
||||
'model_id': 'test_model_id'
|
||||
}
|
||||
)
|
||||
|
||||
@@ -33,7 +46,11 @@ async def test_scouter_workflow(mock_workflow, scouter):
|
||||
'core_scouter',
|
||||
{
|
||||
'topic': 'test_topic',
|
||||
'data': 'test_data'
|
||||
'data': 'test_data',
|
||||
'workflow_name': 'scouter',
|
||||
'schedule_name': 'test_schedule',
|
||||
'model_name': 'test_model',
|
||||
'model_id': 'test_model_id'
|
||||
}
|
||||
)
|
||||
|
||||
@@ -44,7 +61,20 @@ async def test_scouter_workflow_empty(mock_workflow, scouter):
|
||||
mock_workflow.execute_activity_method.return_value = {}
|
||||
await scouter.run(
|
||||
input_data={
|
||||
'topic': 'test_topic'
|
||||
'topic': 'test_topic',
|
||||
'schedule_name': 'test_schedule',
|
||||
'model_name': 'test_model',
|
||||
'model_id': 'test_model_id'
|
||||
}
|
||||
)
|
||||
|
||||
mock_workflow.execute_local_activity_method.assert_called_once_with(
|
||||
Activities.prepare_activity,
|
||||
{
|
||||
'workflow_name': 'scouter',
|
||||
'schedule_name': 'test_schedule',
|
||||
'model_name': 'test_model',
|
||||
'model_id': 'test_model_id'
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user