Skip to content

Commit 7e71572

Browse files
authored
fix(nix): the test checks inherited doCheck=false and ran zero tests (#77)
commonArgs sets doCheck=false (correct for package builds); crane's cargoNextest/cargoTest default it to true only when unset, so nextest and lambda-tests have been compiling nothing and testing nothing since #53 — green, silent, and invisible because nix prints derivation logs only on failure. Locally the lane now runs 699 tests (699 passed). __darwinAllowLocalNetworking on both checks: the darwin sandbox denies even loopback binds, and the abcdn handler tests serve mock HTTP on 127.0.0.1; linux sandboxes allow loopback in their private netns. ci/nix-checks.sh now asserts a green test check's log shows a nonzero test count, so this class of no-op can never be green again.
1 parent 30eebef commit 7e71572

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

ci/nix-checks.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,20 @@ printf ' %s\n' "${attrs[@]}"
1919

2020
nix build --keep-going --no-link --log-format raw "${attrs[@]}" \
2121
|| nix build --keep-going --no-link --print-build-logs "${attrs[@]}"
22+
23+
# A test check that executed zero tests is a silent no-op (doCheck=false
24+
# reached the derivation once and nobody noticed for weeks) — make that
25+
# state red forever: the built check's log must show a nonzero test count.
26+
assert_ran_tests() {
27+
local attr="$1" pattern="$2"
28+
grep -qE "$pattern" <(nix log "$attr") \
29+
|| { echo "$attr built green but ran no tests ($pattern not in its log)" >&2; exit 1; }
30+
}
31+
while IFS= read -r name; do
32+
case "$name" in
33+
nextest) assert_ran_tests ".#checks.${system}.${name}" \
34+
'Summary \[.*\] +[1-9][0-9]* tests run' ;;
35+
lambda-tests) assert_ran_tests ".#checks.${system}.${name}" \
36+
'test result: ok\. [1-9]' ;;
37+
esac
38+
done <<<"$names"

nix/checks.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,16 @@ let
2626

2727
archDependent = {
2828
nextest = craneLib.cargoNextest (withArtifacts // {
29+
doCheck = true;
30+
__darwinAllowLocalNetworking = true;
2931
cargoExtraArgs = "--locked";
3032
cargoNextestExtraArgs = "--workspace";
3133
preCheck = abgenRoot;
3234
});
3335

3436
lambda-tests = craneLib.cargoTest (withArtifacts // {
37+
doCheck = true;
38+
__darwinAllowLocalNetworking = true;
3539
pname = "abgen-lambda-tests";
3640
cargoExtraArgs = "--locked";
3741
cargoTestExtraArgs = "-p abgen-lambda -p abgen-native --tests";

0 commit comments

Comments
 (0)