From 7ebbdfc0311622049312acdcaf761be6d1d080e1 Mon Sep 17 00:00:00 2001 From: "programmer@kl.netlib.re" Date: Thu, 20 Oct 2022 01:53:03 +0200 Subject: [PATCH] Pure nix environment for tests + add missing deps for "local" test runner --- tests/runners/local.sh | 2 +- tests/runners/nix.sh | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/runners/local.sh b/tests/runners/local.sh index ec7787e..52d6921 100755 --- a/tests/runners/local.sh +++ b/tests/runners/local.sh @@ -1,6 +1,6 @@ #! /usr/bin/bash -DEPENDENCIES=("qbittorrent-nox" "bats" "curl" "grep" "cat" "sed") +DEPENDENCIES=("qbittorrent-nox" "bats" "curl" "grep" "cat" "sed" "ps" "netstat" "envsubst") if [[ "${QBTNOX_DIR:-plz}" = "plz" ]]; then export QBTNOX_DIR="$(mktemp -d)" diff --git a/tests/runners/nix.sh b/tests/runners/nix.sh index 7f1765a..72d9e86 100755 --- a/tests/runners/nix.sh +++ b/tests/runners/nix.sh @@ -1,8 +1,7 @@ #! /usr/bin/env bash DEPENDENCIES=("nix" "nix-shell") -# TODO: find grep package name for --pure environment -NIX_DEPENDENCIES=("bats" "curl" "qbittorrent-nox") +NIX_DEPENDENCIES=("bats" "curl" "qbittorrent-nox" "gnugrep" "unixtools.netstat" "envsubst" "ps") if [[ "${QBTNOX_DIR:-plz}" = "plz" ]]; then export QBTNOX_DIR="$(mktemp -d)" @@ -22,8 +21,7 @@ if [[ "$SUBCOMMAND" = "test" ]] && [[ "${IN_NIX_SHELL:-plz}" = "plz" ]]; then depsCheck fi # Are we in nix-shell already? - # TODO: redo --pure when grep dep is found - IN_NIX_SHELL=1 nix-shell -p ${NIX_DEPENDENCIES[@]} --run "\"$ORIGDIR\"/\"$0\" "$@"" + IN_NIX_SHELL=1 nix-shell --pure -p ${NIX_DEPENDENCIES[@]} --keep CFGFILE --keep BIN_PATH --keep FREEPORT --run "\"$ORIGDIR\"/\"$0\" "$@"" exit $? fi