From 81cef7f7322004ba230a978c748a0a9bfb2df39b Mon Sep 17 00:00:00 2001 From: Amirhossein Khalili Date: Sun, 20 Sep 2026 10:40:58 +0330 Subject: [PATCH] test(storage): pin the identity-bearing sort key --- tests/test_bootstrap.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/test_bootstrap.py b/tests/test_bootstrap.py index f3daa85..ed40751 100644 --- a/tests/test_bootstrap.py +++ b/tests/test_bootstrap.py @@ -1,7 +1,7 @@ import unittest from unittest.mock import Mock -from app.common.bootstrap import identifier, verify_table +from app.common.bootstrap import SORT_KEY, identifier, verify_table class TestBootstrap(unittest.TestCase): @@ -11,9 +11,18 @@ class TestBootstrap(unittest.TestCase): with self.subTest(value=value), self.assertRaises(ValueError): identifier(value) - def test_old_sorting_key_fails_without_mutating_data(self): + def test_sorting_key_includes_deterministic_record_identity(self): + self.assertEqual( + SORT_KEY, + "service_type, radio_access_type, cell_id, session_start_time, msisdn, cdr_id", + ) + + def test_sorting_key_without_record_identity_fails_without_mutating_data(self): client = Mock() - client.query.return_value.result_rows = [("ReplacingMergeTree", "service_type, radio_access_type, cell_id, session_start_time, msisdn")] + client.query.return_value.result_rows = [( + "ReplacingMergeTree", + "service_type, radio_access_type, cell_id, session_start_time, msisdn", + )] with self.assertRaisesRegex(RuntimeError, "reset"): verify_table(client, "telecom", "cdr_records") client.command.assert_not_called()