Pure nix environment for tests

+ add missing deps for "local" test runner
This commit is contained in:
programmer programmer 2022-10-20 01:53:03 +02:00
parent be6e2a9540
commit 7ebbdfc031
2 changed files with 3 additions and 5 deletions

View File

@ -1,6 +1,6 @@
#! /usr/bin/bash #! /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 if [[ "${QBTNOX_DIR:-plz}" = "plz" ]]; then
export QBTNOX_DIR="$(mktemp -d)" export QBTNOX_DIR="$(mktemp -d)"

View File

@ -1,8 +1,7 @@
#! /usr/bin/env bash #! /usr/bin/env bash
DEPENDENCIES=("nix" "nix-shell") DEPENDENCIES=("nix" "nix-shell")
# TODO: find grep package name for --pure environment NIX_DEPENDENCIES=("bats" "curl" "qbittorrent-nox" "gnugrep" "unixtools.netstat" "envsubst" "ps")
NIX_DEPENDENCIES=("bats" "curl" "qbittorrent-nox")
if [[ "${QBTNOX_DIR:-plz}" = "plz" ]]; then if [[ "${QBTNOX_DIR:-plz}" = "plz" ]]; then
export QBTNOX_DIR="$(mktemp -d)" export QBTNOX_DIR="$(mktemp -d)"
@ -22,8 +21,7 @@ if [[ "$SUBCOMMAND" = "test" ]] && [[ "${IN_NIX_SHELL:-plz}" = "plz" ]]; then
depsCheck depsCheck
fi fi
# Are we in nix-shell already? # Are we in nix-shell already?
# TODO: redo --pure when grep dep is found IN_NIX_SHELL=1 nix-shell --pure -p ${NIX_DEPENDENCIES[@]} --keep CFGFILE --keep BIN_PATH --keep FREEPORT --run "\"$ORIGDIR\"/\"$0\" "$@""
IN_NIX_SHELL=1 nix-shell -p ${NIX_DEPENDENCIES[@]} --run "\"$ORIGDIR\"/\"$0\" "$@""
exit $? exit $?
fi fi