fix(device-deploy): prove r46 rollback and version empty DNS fingerprints
This commit is contained in:
@@ -66,15 +66,30 @@ class CmsRunnerTests(unittest.TestCase):
|
||||
restore.assert_called_once();compose.assert_called_once();accept.assert_called_once_with(before,rollback=True)
|
||||
self.assertEqual(run.call_args.args[0],[str(r.DOCKER),'image','tag','old-id','dc-cms-cms-app'])
|
||||
|
||||
def test_existing_device_domain_unchanged(self):
|
||||
def test_unrelated_domains_unchanged_except_reviewed_r46_extension(self):
|
||||
old=subprocess.check_output(['git','show','27c155276a703dd4fd39385011fc5e3f86afcae4:infra/deploy-runner/nodedc-deploy'],cwd=ROOT,text=True)
|
||||
current=RUNNER.read_text()
|
||||
def domain(source):return source[source.index('# Device Core outbound automatic deployment.'):source.index('# END GENERATED DEVICE CORE AUTODEPLOY LIBRARY')]
|
||||
self.assertEqual(domain(old),domain(current))
|
||||
allowed={'allowed_payload_path','load_artifact','component_services','plan_artifact','apply_artifact','run_healthchecks','main'}
|
||||
# The separately reviewed r46 recovery now changes these Device entry
|
||||
# points. Its exact identity, v1/v2 compatibility and queue transitions
|
||||
# are tested in device-core-deploy/test_r46_reconciliation.py.
|
||||
allowed.update({'device_release_predecessor','validate_device_release_reconciliation_payload',
|
||||
'preflight_device_release_reconciliation','device_release_capture_field_digests',
|
||||
'device_release_runtime_drift_message','preflight_device_release','accept_device_release',
|
||||
'DeviceAutodeployInstaller','device_autodeploy_library'})
|
||||
old_functions={n.name:ast.dump(n,include_attributes=False) for n in ast.parse(old).body if isinstance(n,(ast.FunctionDef,ast.ClassDef))}
|
||||
current_functions={n.name:ast.dump(n,include_attributes=False) for n in ast.parse(current).body if isinstance(n,(ast.FunctionDef,ast.ClassDef))}
|
||||
for name,node in old_functions.items():
|
||||
if name not in allowed:self.assertEqual(current_functions[name],node,name)
|
||||
def methods(source):
|
||||
cls=next(n for n in ast.parse(source).body if isinstance(n,ast.ClassDef) and n.name=='DeviceAutodeployInstaller')
|
||||
return {n.name:ast.dump(n,include_attributes=False) for n in cls.body if isinstance(n,ast.FunctionDef)}
|
||||
before,after=methods(old),methods(current)
|
||||
for name,node in before.items():
|
||||
if name!='receipt':self.assertEqual(after[name],node,name)
|
||||
# None of the CMS runtime changes as part of Device recovery.
|
||||
baseline=subprocess.check_output(['git','show','6cf7a91:infra/deploy-runner/nodedc-deploy'],cwd=ROOT,text=True)
|
||||
def cms(source):return source.split('# BEGIN GENERATED CMS DEPLOYMENT\n',1)[1].split('# END GENERATED CMS DEPLOYMENT\n',1)[0]
|
||||
self.assertEqual(cms(baseline),cms(current))
|
||||
|
||||
if __name__=='__main__':unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user