SIENTIAPDE-1169
SIENTIAPDE-1169 Update Redis and core scouter tests to include model_tags in data structures, enhancing data organization and consistency across test cases.
This commit is contained in:
@@ -219,7 +219,11 @@ async def test_group_and_hold_data_new_key(redis_activity):
|
||||
'name': ['sensor1', 'sensor2'],
|
||||
'value': [25.5, 30.0],
|
||||
'timestamp': ['2023-01-01 12:00:00'] * 2
|
||||
}).to_dict('records')
|
||||
}).to_dict('records'),
|
||||
'model_tags': {
|
||||
'sensor1': 'sensor1',
|
||||
'sensor2': 'sensor2'
|
||||
}
|
||||
}
|
||||
|
||||
# Mock get to return None for new key
|
||||
@@ -271,7 +275,12 @@ async def test_group_and_hold_data_update_existing(redis_activity):
|
||||
'name': ['sensor1', 'sensor3'],
|
||||
'value': [25.5, 42.0],
|
||||
'timestamp': ['2023-01-01 12:00:00'] * 2
|
||||
}).to_dict('records')
|
||||
}).to_dict('records'),
|
||||
'model_tags': {
|
||||
'sensor1': 'sensor1',
|
||||
'sensor2': 'sensor2',
|
||||
'sensor3': 'sensor3'
|
||||
}
|
||||
}
|
||||
|
||||
# Mock get to return existing data
|
||||
@@ -317,7 +326,11 @@ async def test_group_and_hold_data_with_none_values(redis_activity):
|
||||
'name': ['sensor1', 'sensor2'],
|
||||
'value': [None, 30.0],
|
||||
'timestamp': [datetime(2023, 1, 1, 12, 0, 0)] * 2
|
||||
}).to_dict('records')
|
||||
}).to_dict('records'),
|
||||
'model_tags': {
|
||||
'sensor1': 'sensor1',
|
||||
'sensor2': 'sensor2'
|
||||
}
|
||||
}
|
||||
|
||||
# Mock get to return None for new key
|
||||
@@ -341,7 +354,11 @@ async def test_group_and_hold_data_empty_dataframe(redis_activity):
|
||||
'workflow_name': 'test_workflow',
|
||||
'schedule_name': 'test_schedule',
|
||||
'retention_time': 3600,
|
||||
'data': DataFrame(columns=['name', 'value', 'timestamp']).to_dict('records')
|
||||
'data': DataFrame(columns=['name', 'value', 'timestamp']).to_dict('records'),
|
||||
'model_tags': {
|
||||
'sensor1': 'sensor1',
|
||||
'sensor2': 'sensor2'
|
||||
}
|
||||
}
|
||||
|
||||
redis_activity.get = MagicMock(return_value=None)
|
||||
@@ -361,7 +378,11 @@ async def test_group_and_hold_data_error_get(redis_activity):
|
||||
'schedule_name': 'test_schedule',
|
||||
'retention_time': 3600,
|
||||
'model_id': 1,
|
||||
'data': DataFrame(columns=['name', 'value', 'timestamp']).to_dict('records')
|
||||
'data': DataFrame(columns=['name', 'value', 'timestamp']).to_dict('records'),
|
||||
'model_tags': {
|
||||
'sensor1': 'sensor1',
|
||||
'sensor2': 'sensor2'
|
||||
}
|
||||
}
|
||||
|
||||
redis_activity.get = MagicMock(side_effect=Exception('test'))
|
||||
@@ -395,7 +416,11 @@ async def test_group_and_hold_data_error_set(redis_activity):
|
||||
'schedule_name': 'test_schedule',
|
||||
'retention_time': 3600,
|
||||
'model_id': 1,
|
||||
'data': DataFrame(columns=['name', 'value', 'timestamp']).to_dict('records')
|
||||
'data': DataFrame(columns=['name', 'value', 'timestamp']).to_dict('records'),
|
||||
'model_tags': {
|
||||
'sensor1': 'sensor1',
|
||||
'sensor2': 'sensor2'
|
||||
}
|
||||
}
|
||||
|
||||
existing_data = {
|
||||
@@ -434,7 +459,11 @@ async def test_store_data_package(redis_activity):
|
||||
'name': ['sensor1', 'sensor2'],
|
||||
'value': [25.5, 30.0],
|
||||
'timestamp': ['2023-01-01 12:00:00'] * 2
|
||||
}).to_dict()
|
||||
}).to_dict(),
|
||||
'model_tags': {
|
||||
'sensor1': 'sensor1',
|
||||
'sensor2': 'sensor2'
|
||||
}
|
||||
}
|
||||
|
||||
await redis_activity.store_data_package(test_data)
|
||||
@@ -467,7 +496,11 @@ async def test_store_data_package_error(redis_activity):
|
||||
'name': ['sensor1', 'sensor2'],
|
||||
'value': [25.5, 30.0],
|
||||
'timestamp': ['2023-01-01 12:00:00'] * 2
|
||||
}).to_dict()
|
||||
}).to_dict(),
|
||||
'model_tags': {
|
||||
'sensor1': 'sensor1',
|
||||
'sensor2': 'sensor2'
|
||||
}
|
||||
}
|
||||
|
||||
with pytest.raises(Exception):
|
||||
|
||||
Reference in New Issue
Block a user