From d6829e8201480a00354cb1b48b28a1278fbefae2 Mon Sep 17 00:00:00 2001 From: lucannez64 <58551020+lucannez64@users.noreply.github.com> Date: Mon, 19 Oct 2026 00:58:45 +0200 Subject: [PATCH] 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 --- tests/test_nix_repairs.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_nix_repairs.py b/tests/test_nix_repairs.py index 1a6e8c4..df02a09 100644 --- a/tests/test_nix_repairs.py +++ b/tests/test_nix_repairs.py @@ -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):