test(storage): pin the identity-bearing sort key
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user