Qualify the standalone Core runtime lock used by Docker
Device Core qualification / qualify (push) Successful in 5m54s

This commit is contained in:
DCCONSTRUCTIONS
2026-09-30 17:51:38 +03:00
parent f4f63bccf3
commit 341d1f87e6
3 changed files with 61 additions and 1 deletions
+32
View File
@@ -119,6 +119,38 @@ class QualificationTests(unittest.TestCase):
self.assertEqual(execute.call_args.args[0], ["npm", "ci", "--ignore-scripts", "--no-audit", "--no-fund"])
pause.assert_called_once_with(5)
def test_core_runtime_uses_its_own_lock_outside_the_workspace(self):
source = self.root / "services/device-control-core"
source.mkdir(parents=True)
for name, value in (("package.json", '{"name":"core"}'),
("package-lock.json", '{"name":"standalone-lock"}')):
(source / name).write_text(value)
(self.root / "package-lock.json").write_text('{"name":"workspace-lock"}')
temporary_paths = []
def inspect_install(path, *, production):
self.assertTrue(production)
self.assertFalse(path.is_relative_to(self.root))
self.assertEqual((path / "package-lock.json").read_text(), '{"name":"standalone-lock"}')
self.assertEqual(sorted(p.name for p in path.iterdir()), ["package-lock.json", "package.json"])
temporary_paths.append(path)
with mock.patch.object(CI, "install_dependencies", side_effect=inspect_install), \
mock.patch.object(CI, "run") as execute:
CI.qualify_core_runtime(self.root)
self.assertIn("await import('oauth4webapi')", execute.call_args.args[0][-1])
self.assertFalse(temporary_paths[0].exists())
def test_core_runtime_lock_failure_stops_before_imports(self):
source = self.root / "services/device-control-core"
source.mkdir(parents=True)
for name in ("package.json", "package-lock.json"):
(source / name).write_text('{}')
failure = subprocess.CalledProcessError(1, "npm", output="npm error code EUSAGE\n")
with mock.patch.object(CI, "install_dependencies", side_effect=failure), \
mock.patch.object(CI, "run") as execute:
with self.assertRaises(subprocess.CalledProcessError):
CI.qualify_core_runtime(self.root)
execute.assert_not_called()
def test_permanent_mixed_and_unclassified_install_failures_never_retry(self):
for output in ("npm error code EINTEGRITY\n", "npm error code E401\n",
"npm error code EUSAGE\n", "download ECONNRESET in explanatory text\n",