✅ test(pacman): sandbox the region for every boundary test
- ✅ The channel and update boundary tests copied the real render and dev-region guard, so on a China install they read the host's `/etc/omarchy/region` and failed before reaching their checks - ♻️ The shared fixture now points both lookups at a sandbox target that starts global, and the regional test only writes `cn` there Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SdXqTwm63rRMwotZ1xqLC8
This commit is contained in:
1 parent
a1bdc46119
commit
3e00a48c00
2 files changed
+9
-10
No files matched your search
@@ -9,7 +9,11 @@ export SUDO_TEST_LOG="$boundary_tmp/events"
|
||||
export SUDO_TEST_CACHE="$boundary_tmp/cache"
|
||||
export OMARCHY_PATH="$SUDO_TEST_ROOT"
|
||||
export SUDO_TEST_HOME="$boundary_tmp/home"
|
||||
mkdir -p "$SUDO_TEST_HOME"
|
||||
# The machine the render reads its region marker from. It starts global; a test
|
||||
# writes etc/omarchy/region here to model a regional install, never the host's.
|
||||
export SUDO_TEST_TARGET="$boundary_tmp/target"
|
||||
export OMARCHY_REGION_FILE="$SUDO_TEST_TARGET/etc/omarchy/region"
|
||||
mkdir -p "$SUDO_TEST_HOME" "$SUDO_TEST_TARGET/etc"
|
||||
mkdir -p "$SUDO_TEST_ROOT/bin" "$SUDO_TEST_ROOT/mock" "$SUDO_TEST_ROOT/default/omarchy/sudo-no-update"
|
||||
: >"$SUDO_TEST_LOG"
|
||||
|
||||
@@ -24,6 +28,10 @@ s=(source/name).read_text().replace('$HOME', '$SUDO_TEST_HOME')
|
||||
for command in ['sudo','pkexec','pacman','omarchy-pkg-missing','systemd-inhibit','setpriv','snapper']:
|
||||
s=s.replace('/usr/bin/'+command, str(target/'mock'/command))
|
||||
s=s.replace('PATH=/usr/bin:/usr/sbin:/bin:/sbin', 'PATH="'+str(target/'bin')+':/usr/bin:/usr/sbin:/bin:/sbin"')
|
||||
if name.name == 'omarchy-apply-pacman':
|
||||
render_etc='etc="${4:-/}/etc"'
|
||||
assert s.count(render_etc)==1, 'render target lookup moved'
|
||||
s=s.replace(render_etc, 'etc="${4:-$SUDO_TEST_TARGET}/etc"')
|
||||
p.write_text(s)
|
||||
p.chmod((source/name).stat().st_mode & 0o777)
|
||||
PY
|
||||
|
||||
@@ -13,17 +13,8 @@ done
|
||||
|
||||
# A sandboxed China machine: the render reads this region marker, never the
|
||||
# host's /etc/omarchy/region.
|
||||
export SUDO_TEST_TARGET="$boundary_tmp/target"
|
||||
mkdir -p "$SUDO_TEST_TARGET/etc/omarchy"
|
||||
printf 'cn\n' >"$SUDO_TEST_TARGET/etc/omarchy/region"
|
||||
python3 - "$SUDO_TEST_ROOT/bin/omarchy-apply-pacman" <<'PY'
|
||||
import sys
|
||||
path = sys.argv[1]
|
||||
source = open(path).read()
|
||||
render_etc = 'etc="${4:-/}/etc"'
|
||||
assert source.count(render_etc) == 1, "render target lookup moved"
|
||||
open(path, 'w').write(source.replace(render_etc, 'etc="${4:-$SUDO_TEST_TARGET}/etc"'))
|
||||
PY
|
||||
|
||||
# cp still logs its step, but now really copies, so the rendered files exist.
|
||||
# Root's copies into /etc land in a capture directory instead of the host.
|
||||
|
||||
Reference in new issue
Block a user