test: cover persistence failover and graceful draining

Add API integration checks, migration compatibility, rolling restart scenarios and a report verification collector.
This commit is contained in:
2026-10-29 11:47:46 +03:00
parent 676b38c18b
commit 5c8bcf0f80
37 changed files with 5538 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
import importlib.util
from pathlib import Path
import unittest
spec = importlib.util.spec_from_file_location('saturation', Path(__file__).resolve().parents[1]/'scripts/run-saturation.py')
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
class ClassificationTest(unittest.TestCase):
def classify(self, attempted=1000, dropped=0, errors=0, p95=500):
return module.classify({'measurement': {'scheduled_slots': 1000,
'client_dropped_slots': dropped, 'all': {'attempted': attempted, 'errors': errors}},
'all_latency_ms': {'p95': p95}})['classification']
def test_delivered_healthy_workload_passes(self):
self.assertEqual(self.classify(), 'pass')
def test_latency_or_errors_break_service_criterion(self):
self.assertEqual(self.classify(p95=1500), 'slo_fail')
self.assertEqual(self.classify(errors=20), 'slo_fail')
def test_underfed_workload_is_not_a_server_capacity_measurement(self):
self.assertEqual(self.classify(attempted=800, dropped=200), 'generator_limited')
self.assertEqual(self.classify(attempted=800, dropped=200, p95=3000), 'generator_limited')
if __name__ == '__main__':
unittest.main()