mirror of
https://gitlab.com/TECHNOFAB/nixtest.git
synced 2025-12-12 02:00:18 +01:00
feat: run script tests in temp dirs for slightly better sandboxing
This commit is contained in:
parent
c9298b91f4
commit
5741109cc9
3 changed files with 15 additions and 16 deletions
|
|
@ -70,21 +70,21 @@
|
|||
in
|
||||
# sh
|
||||
''
|
||||
${ntlib.helpers.path [pkgs.gnugrep pkgs.mktemp]}
|
||||
${ntlib.helpers.path [pkgs.gnugrep pkgs.mktemp pkgs.coreutils]}
|
||||
${ntlib.helpers.scriptHelpers}
|
||||
cp -r ${./../snapshots} snapshots
|
||||
|
||||
TMPDIR=$(tmpdir)
|
||||
# start without nix & env binaries to expect errors
|
||||
run "${binary} --junit=$TMPDIR/junit.xml"
|
||||
run "${binary} --junit=junit.xml"
|
||||
assert "$exit_code -eq 2" "should exit 2"
|
||||
assert "-f $TMPDIR/junit.xml" "should create junit.xml"
|
||||
assert "-f junit.xml" "should create junit.xml"
|
||||
assert_contains "$output" "executable file not found" "nix should not be found in pure mode"
|
||||
|
||||
# now add required deps
|
||||
${ntlib.helpers.pathAdd [pkgs.nix pkgs.coreutils]}
|
||||
run "${binary} --junit=$TMPDIR/junit2.xml"
|
||||
run "${binary} --junit=junit2.xml"
|
||||
assert "$exit_code -eq 2" "should exit 2"
|
||||
assert "-f $TMPDIR/junit2.xml" "should create junit2.xml"
|
||||
assert "-f junit2.xml" "should create junit2.xml"
|
||||
assert_not_contains "$output" "executable file not found" "nix should now exist"
|
||||
assert_contains "$output" "suite-one" "should contain suite-one"
|
||||
assert_contains "$output" "8/11 (1 SKIPPED)" "should be 8/11 total"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue