Merge pull request #1246 from dbungert/faster-curtin-replay-tests

Faster curtin replay tests
This commit is contained in:
Dan Bungert 2022-03-24 13:37:59 -06:00 committed by GitHub
commit 3fb16487cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -27,11 +27,12 @@ class LoggedCommandRunner:
def __init__(self, ident,
*, use_systemd_user: Optional[bool] = None) -> None:
self.ident = ident
self.env_whitelist = [
self.env_allowlist = [
"PATH", "PYTHONPATH",
"PYTHON",
"TARGET_MOUNT_POINT",
"SNAP",
"SUBIQUITY_REPLAY_TIMESCALE",
]
if use_systemd_user is not None:
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
# child process behave differently if it reads from stdin.
prefix.append("--pipe")
for key in self.env_whitelist:
for key in self.env_allowlist:
with suppress(KeyError):
prefix.extend(("--setenv", f"{key}={os.environ[key]}"))

View File

@ -53,7 +53,7 @@ class TestLoggedCommandRunner(SubiTestCase):
"DUMMY": "should-not-be-exported",
}
with patch.dict(os.environ, environ):
with patch.dict(os.environ, environ, clear=True):
cmd = runner._forge_systemd_cmd(
["/bin/ls", "/root"],
private_mounts=True, capture=False)