Merge pull request #1246 from dbungert/faster-curtin-replay-tests
Faster curtin replay tests
This commit is contained in:
commit
3fb16487cf
|
@ -27,11 +27,12 @@ class LoggedCommandRunner:
|
||||||
def __init__(self, ident,
|
def __init__(self, ident,
|
||||||
*, use_systemd_user: Optional[bool] = None) -> None:
|
*, use_systemd_user: Optional[bool] = None) -> None:
|
||||||
self.ident = ident
|
self.ident = ident
|
||||||
self.env_whitelist = [
|
self.env_allowlist = [
|
||||||
"PATH", "PYTHONPATH",
|
"PATH", "PYTHONPATH",
|
||||||
"PYTHON",
|
"PYTHON",
|
||||||
"TARGET_MOUNT_POINT",
|
"TARGET_MOUNT_POINT",
|
||||||
"SNAP",
|
"SNAP",
|
||||||
|
"SUBIQUITY_REPLAY_TIMESCALE",
|
||||||
]
|
]
|
||||||
if use_systemd_user is not None:
|
if use_systemd_user is not None:
|
||||||
self.use_systemd_user = use_systemd_user
|
self.use_systemd_user = use_systemd_user
|
||||||
|
@ -57,7 +58,7 @@ class LoggedCommandRunner:
|
||||||
# --pipe also opens a pipe on stdin. This will effectively make the
|
# --pipe also opens a pipe on stdin. This will effectively make the
|
||||||
# child process behave differently if it reads from stdin.
|
# child process behave differently if it reads from stdin.
|
||||||
prefix.append("--pipe")
|
prefix.append("--pipe")
|
||||||
for key in self.env_whitelist:
|
for key in self.env_allowlist:
|
||||||
with suppress(KeyError):
|
with suppress(KeyError):
|
||||||
prefix.extend(("--setenv", f"{key}={os.environ[key]}"))
|
prefix.extend(("--setenv", f"{key}={os.environ[key]}"))
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ class TestLoggedCommandRunner(SubiTestCase):
|
||||||
"DUMMY": "should-not-be-exported",
|
"DUMMY": "should-not-be-exported",
|
||||||
}
|
}
|
||||||
|
|
||||||
with patch.dict(os.environ, environ):
|
with patch.dict(os.environ, environ, clear=True):
|
||||||
cmd = runner._forge_systemd_cmd(
|
cmd = runner._forge_systemd_cmd(
|
||||||
["/bin/ls", "/root"],
|
["/bin/ls", "/root"],
|
||||||
private_mounts=True, capture=False)
|
private_mounts=True, capture=False)
|
||||||
|
|
Loading…
Reference in New Issue