tests: expect the shared-identity step at the end of rootless update

#79 made update.sh stop Darling again after the overlays and run
configure-darling-platform.py --replace-known-defaults --write. The
rootless update test still expected the old call list and failed. Stub the
identity tool, expect the stop + identity calls last, and check a failed
install never reaches them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
lucannez64andClaude Opus 5.5 committed 2026-10-19 00:58:45 +02:00
1 parent 8184a0b2b4
commit d6829e8201
1 file changed
+7 -1
+7 -1
View File
@@ -491,6 +491,9 @@ class SessionTests(unittest.TestCase):
path.chmod(0o755)
(scripts / 'nix-state.py').write_text('import os, sys\nwith open(os.environ["TEST_LOG"], "a") as f: f.write(sys.argv[1]+"\\n")\n')
(tools / 'stop-darling-runtime.py').write_text('import os\nwith open(os.environ["TEST_LOG"], "a") as f: f.write("stop\\n")\n')
(root / 'tools').mkdir()
(root / 'tools/configure-darling-platform.py').write_text(
'import os, sys\nwith open(os.environ["TEST_LOG"], "a") as f: f.write("identity " + " ".join(sys.argv[1:]) + "\\n")\n')
for name in ['cmake', 'sudo', 'nix-store']:
path = bin_dir / name
path.write_text('#!/bin/sh\necho ' + name + ' >> "$TEST_LOG"\n' +
@@ -502,12 +505,15 @@ class SessionTests(unittest.TestCase):
result = run('sh', str(scripts / 'update.sh'), env=env)
self.assertEqual(result.returncode, 0, result.stderr)
self.assertEqual(log.read_text().splitlines(),
['nix-store', 'invalidate-base', 'build', 'stop', 'cmake', 'stamp-base', 'overlays'])
['nix-store', 'invalidate-base', 'build', 'stop', 'cmake', 'stamp-base', 'overlays',
# The shared serial/UUID replacement writes the prefix, so Darling is stopped first.
'stop', 'identity --replace-known-defaults --write'])
log.write_text('')
env['INSTALL_EXIT'] = '23'
self.assertEqual(run('sh', str(scripts / 'update.sh'), env=env).returncode, 23)
self.assertNotIn('stamp-base', log.read_text())
self.assertNotIn('overlays', log.read_text())
self.assertNotIn('identity', log.read_text())
self.assertNotIn('sudo', log.read_text())
def test_rootless_update_never_uses_sudo_and_stamps_only_after_success(self):