tests/config: Fix config test configuration
First, "XDG_CONFIG_HOME" shouldn't be named "home", as it may be confusing compared with `$HOME`, which an upcoming test will be using. Then, using a fixed location for the test is problematic. Use `$TEST_ROOT` instead.
This commit is contained in:
parent
8a5203d3b8
commit
1765711b68
|
@ -1,15 +1,15 @@
|
||||||
source common.sh
|
source common.sh
|
||||||
|
|
||||||
# Test that files are loaded from XDG by default
|
# Test that files are loaded from XDG by default
|
||||||
export XDG_CONFIG_HOME=/tmp/home
|
export XDG_CONFIG_HOME=$TEST_ROOT/confighome
|
||||||
export XDG_CONFIG_DIRS=/tmp/dir1:/tmp/dir2
|
export XDG_CONFIG_DIRS=$TEST_ROOT/dir1:$TEST_ROOT/dir2
|
||||||
files=$(nix-build --verbose --version | grep "User config" | cut -d ':' -f2- | xargs)
|
files=$(nix-build --verbose --version | grep "User config" | cut -d ':' -f2- | xargs)
|
||||||
[[ $files == "/tmp/home/nix/nix.conf:/tmp/dir1/nix/nix.conf:/tmp/dir2/nix/nix.conf" ]]
|
[[ $files == "$TEST_ROOT/confighome/nix/nix.conf:$TEST_ROOT/dir1/nix/nix.conf:$TEST_ROOT/dir2/nix/nix.conf" ]]
|
||||||
|
|
||||||
# Test that setting NIX_USER_CONF_FILES overrides all the default user config files
|
# Test that setting NIX_USER_CONF_FILES overrides all the default user config files
|
||||||
export NIX_USER_CONF_FILES=/tmp/file1.conf:/tmp/file2.conf
|
export NIX_USER_CONF_FILES=$TEST_ROOT/file1.conf:$TEST_ROOT/file2.conf
|
||||||
files=$(nix-build --verbose --version | grep "User config" | cut -d ':' -f2- | xargs)
|
files=$(nix-build --verbose --version | grep "User config" | cut -d ':' -f2- | xargs)
|
||||||
[[ $files == "/tmp/file1.conf:/tmp/file2.conf" ]]
|
[[ $files == "$TEST_ROOT/file1.conf:$TEST_ROOT/file2.conf" ]]
|
||||||
|
|
||||||
# Test that it's possible to load the config from a custom location
|
# Test that it's possible to load the config from a custom location
|
||||||
here=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")
|
here=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")
|
||||||
|
@ -24,4 +24,4 @@ exp_cores=$(nix show-config | grep '^cores' | cut -d '=' -f 2 | xargs)
|
||||||
exp_features=$(nix show-config | grep '^experimental-features' | cut -d '=' -f 2 | xargs)
|
exp_features=$(nix show-config | grep '^experimental-features' | cut -d '=' -f 2 | xargs)
|
||||||
[[ $prev != $exp_cores ]]
|
[[ $prev != $exp_cores ]]
|
||||||
[[ $exp_cores == "4242" ]]
|
[[ $exp_cores == "4242" ]]
|
||||||
[[ $exp_features == "nix-command flakes" ]]
|
[[ $exp_features == "nix-command flakes" ]]
|
||||||
|
|
Loading…
Reference in a new issue