mirror of
https://github.com/rustfs/rustfs.git
synced 2026-09-06 03:59:14 +00:00
test(scanner): reject unobserved enumeration budget evidence
Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com>
This commit is contained in:
@@ -33,6 +33,8 @@ def validate_report(report, *, round_number, pid, objects, budget):
|
||||
"versions_retained", "bytes_retained", "objects_processed"):
|
||||
if type(report.get(key)) is not int or not 0 <= report[key] <= 1048576:
|
||||
raise ValueError(f"invalid bounded counter: {key}")
|
||||
if report["raw_entries"] == 0:
|
||||
raise ValueError("nonempty fixture must observe raw entries; budget hook may not have run")
|
||||
if report["raw_entries"] > budget:
|
||||
raise ValueError("raw-entry budget exceeded; no unbudgeted tail is permitted")
|
||||
if type(report.get("snapshot_complete")) is not bool:
|
||||
|
||||
@@ -42,6 +42,12 @@ class ReportTests(unittest.TestCase):
|
||||
with self.assertRaises(ValueError):
|
||||
self.validate(report)
|
||||
|
||||
def test_complete_coverage_without_entry_observation_rejected(self):
|
||||
report = self.report()
|
||||
report["raw_entries"] = 0
|
||||
with self.assertRaises(ValueError):
|
||||
self.validate(report)
|
||||
|
||||
def test_missing_wrong_type_and_negative_counter_rejected(self):
|
||||
for value in (None, True, -1, "8", 1048577):
|
||||
with self.subTest(value=value):
|
||||
|
||||
Reference in New Issue
Block a user