fix(release): scope missing-column guard and allow exact schema repair
This commit is contained in:
1 parent
688a0e4de5
commit
c69a779ecc
3 files changed
+74
-6
No files matched your search
@@ -32,6 +32,9 @@ class SchemaGate(unittest.TestCase):
|
||||
with patch.object(m.subprocess,'check_output',side_effect=responses) as run:
|
||||
result = m.schema_gate('canina-production-backend_prod:'+'a'*40)
|
||||
self.assertEqual(result['target_image'], image)
|
||||
self.assertEqual(result['scope'], 'missing-columns-only')
|
||||
self.assertFalse(result['native_types_checked'])
|
||||
self.assertFalse(result['constraints_checked'])
|
||||
calls = [c.args[0] for c in run.call_args_list]
|
||||
self.assertIn(image, calls[2])
|
||||
self.assertIn('--network', calls[2])
|
||||
@@ -40,6 +43,17 @@ class SchemaGate(unittest.TestCase):
|
||||
script = Path(__file__).parents[1].joinpath('rollout-production.sh').read_text()
|
||||
self.assertLess(script.index('production-release.py schema-check'), script.index('started=true'))
|
||||
|
||||
def test_wrong_native_type_is_outside_missing_column_guard(self):
|
||||
# Deliberately document the boundary: this must not imply compatibility.
|
||||
models = [{'name': 'User', 'dbName': 'users', 'fields': [
|
||||
{'name': 'id', 'kind': 'scalar', 'type': 'String', 'isList': False}]}]
|
||||
m.validate_catalog(models, [{'table': 'users', 'column': 'id', 'type': 'int4'}])
|
||||
with self.assertRaisesRegex(ValueError, 'typed catalog'):
|
||||
m.validate_receipt(dict(accepted=True, scope='reliability-only',
|
||||
sha='a'*40, baseline='b'*40, reviewer='reviewer',
|
||||
stage_run_url='https://git.parsaaghayi.ir/parsa/canina/actions/runs/123',
|
||||
paths=['nginx.conf']), 'a'*40, 'b'*40, ['nginx.conf'])
|
||||
|
||||
def test_catalog_failure_never_falls_back_to_source_diff(self):
|
||||
from unittest.mock import patch
|
||||
import subprocess
|
||||
|
||||
Reference in new issue
Block a user