add baseline and sqlite
This commit is contained in:
16
tests/test_baseline.py
Normal file
16
tests/test_baseline.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from fgai.baseline import BaselineStore
|
||||
from fgai.logs import parse_log_line
|
||||
|
||||
|
||||
class BaselineTests(unittest.TestCase):
|
||||
def test_creates_profile_after_twelve_completed_windows(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
store = BaselineStore(str(Path(directory) / "baseline.sqlite3"))
|
||||
for index in range(13):
|
||||
store.ingest([parse_log_line(f"srcip=10.0.0.1 dstport={1000 + index} hitcount=2 sentbyte=5")], observed_at=1_700_000_000 + index * 300)
|
||||
profiles = store.profiles({"10.0.0.1"})
|
||||
self.assertEqual(profiles["10.0.0.1"]["samples"], 12)
|
||||
Reference in New Issue
Block a user