test-install: Run lxc-attach with --clear-env.

The host environment variables (especially PATH) should not be allowed
to pollute the test and could interfere with it.

This allows test-install to run on a NixOS host.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2019-12-17 15:49:09 -08:00 committed by Tim Abbott
parent ab211c7acf
commit 9b5f9858fb
3 changed files with 4 additions and 4 deletions

View File

@ -45,7 +45,7 @@ done
message="$(cat <<EOF
Container:
sudo lxc-attach -n $CONTAINER_NAME
sudo lxc-attach --clear-env -n $CONTAINER_NAME
Unpacked tree:
sudo ls $shared_dir/mnt/zulip-server
@ -73,7 +73,7 @@ lxc-copy --ephemeral --keepdata -n "$BASE_CONTAINER_NAME" -N "$CONTAINER_NAME" \
"$THIS_DIR"/lxc-wait -n "$CONTAINER_NAME"
run() {
lxc-attach -n "$CONTAINER_NAME" -- "$@"
lxc-attach --clear-env -n "$CONTAINER_NAME" -- "$@"
}
run eatmydata -- /mnt/src/zulip-server/scripts/setup/install --self-signed-cert "${INSTALLER_ARGS[@]}"

View File

@ -29,7 +29,7 @@ fi
# We poll.
for _ in {1..60}; do
echo "lxc-wait: $CONTAINER_NAME: polling for boot..." >&2
runlevel="$(lxc-attach -n "$CONTAINER_NAME" -- runlevel 2>/dev/null)" \
runlevel="$(lxc-attach --clear-env -n "$CONTAINER_NAME" -- runlevel 2>/dev/null)" \
|| { sleep 1; continue; }
if [ "$runlevel" != "${0%[0-9]}" ]; then
echo "lxc-wait: $CONTAINER_NAME: booted!" >&2

View File

@ -34,7 +34,7 @@ lxc-start -n "$CONTAINER_NAME"
"$THIS_DIR"/lxc-wait -n "$CONTAINER_NAME"
run() {
lxc-attach -n "$CONTAINER_NAME" -- "$@"
lxc-attach --clear-env -n "$CONTAINER_NAME" -- "$@"
}
run passwd -d root