fix relation -
This commit is contained in:
@@ -221,6 +221,34 @@ class ProfileSuggestionTests(unittest.TestCase):
|
||||
self.assertIn("*_status", shared)
|
||||
self.assertIn("*_name", shared)
|
||||
|
||||
def test_heuristic_profile_recommends_behavior_relationships(self):
|
||||
events = [
|
||||
parse_log_line(
|
||||
f"fgai_stream_id=windows fgai_stream=Windows username=user{index % 3} srcip=10.0.0.{index % 5} hostname=host{index % 4} action=success eventid=4624"
|
||||
)
|
||||
for index in range(1, 40)
|
||||
]
|
||||
|
||||
suggestion = suggest_stream_profiles(events)[0]
|
||||
relationships = {(item["left"], item["right"]) for item in suggestion["relationship_fields"]}
|
||||
|
||||
self.assertIn(("username", "srcip"), relationships)
|
||||
self.assertIn("username->srcip", suggestion["discovery"]["selected_fields"]["relationships"])
|
||||
self.assertEqual(suggestion["profile"]["relationship_fields"], suggestion["relationship_fields"])
|
||||
|
||||
def test_heuristic_profile_recommends_generic_entity_behavior_relationships(self):
|
||||
events = [
|
||||
parse_log_line(
|
||||
f"fgai_stream_id=app fgai_stream=App entry_context_clientipaddress=10.0.0.{index % 5} entry_context_type={'login' if index % 2 else 'update'} houston_category=cat{index % 3}"
|
||||
)
|
||||
for index in range(1, 40)
|
||||
]
|
||||
|
||||
suggestion = suggest_stream_profiles(events)[0]
|
||||
relationships = {(item["left"], item["right"]) for item in suggestion["relationship_fields"]}
|
||||
|
||||
self.assertIn(("entry_context_clientipaddress", "entry_context_type"), relationships)
|
||||
|
||||
def test_applies_valid_llm_advice_and_rejects_unknown_fields(self):
|
||||
suggestion = suggest_stream_profiles([
|
||||
parse_log_line("fgai_stream_id=windows fgai_stream=Windows username=alice hostname=host01 eventid=4625 action=failure")
|
||||
|
||||
Reference in New Issue
Block a user