-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_cli_summarize.py
More file actions
29 lines (24 loc) · 862 Bytes
/
Copy pathtest_cli_summarize.py
File metadata and controls
29 lines (24 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from __future__ import annotations
from telemetry_lab.cli import main
def test_summarize_honors_configured_timestamp_column(tmp_path, capsys) -> None:
input_path = tmp_path / "events.csv"
input_path.write_text(
"event_time,event_type,source,target,status,severity\n"
"2026-03-10T10:00:10Z,login_success,user_a,auth,ok,low\n"
"2026-03-10T10:00:00Z,login_fail,user_b,auth,fail,high\n",
encoding="utf-8",
)
main(
[
"summarize",
"--input",
str(input_path),
"--timestamp-col",
"event_time",
]
)
stdout = capsys.readouterr().out
assert "events: 2" in stdout
assert "time_range: 2026-03-10T10:00:00Z -> 2026-03-10T10:00:10Z" in stdout
assert "unique_sources: 2" in stdout
assert "overall_error_rate: 0.50" in stdout