Add report generation timing stats
This commit is contained in:
parent
8800f73661
commit
669b51e03c
3 changed files with 33 additions and 17 deletions
|
@ -148,20 +148,19 @@ def test_generate_interval_domain_filter(tmp_path, sample_reports, monkeypatch):
|
|||
gr._generate_interval("hourly", "example.com")
|
||||
|
||||
hits = json.loads(
|
||||
(tmp_path / "output" / "domains" / "example.com" / "hourly" / "hits.json").read_text()
|
||||
(
|
||||
tmp_path / "output" / "domains" / "example.com" / "hourly" / "hits.json"
|
||||
).read_text()
|
||||
)
|
||||
assert hits[0]["value"] == 2
|
||||
reports = json.loads(
|
||||
(tmp_path / "output" / "domains" / "example.com" / "hourly" / "reports.json").read_text()
|
||||
(
|
||||
tmp_path / "output" / "domains" / "example.com" / "hourly" / "reports.json"
|
||||
).read_text()
|
||||
)
|
||||
assert {r["name"] for r in reports} == {"hits", "error_rate"}
|
||||
assert not (
|
||||
tmp_path
|
||||
/ "output"
|
||||
/ "domains"
|
||||
/ "example.com"
|
||||
/ "hourly"
|
||||
/ "skip_report.json"
|
||||
tmp_path / "output" / "domains" / "example.com" / "hourly" / "skip_report.json"
|
||||
).exists()
|
||||
|
||||
|
||||
|
@ -245,9 +244,12 @@ def test_global_stats_file(tmp_path, sample_reports, monkeypatch):
|
|||
"start_date",
|
||||
"end_date",
|
||||
"unique_domains",
|
||||
"generated_at",
|
||||
"generation_seconds",
|
||||
}
|
||||
assert stats["total_logs"] == 2
|
||||
assert stats["start_date"] == "2024-01-01 10:00:00"
|
||||
assert stats["end_date"] == "2024-01-01 10:05:00"
|
||||
assert stats["unique_domains"] == 1
|
||||
|
||||
assert isinstance(stats["generated_at"], str)
|
||||
assert stats["generation_seconds"] >= 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue