Files
cozystack/hack
Aleksei Sviridkin 6cfeaddf78 test(hack): clean up the Talos diagnostics tests without an EXIT trap
Eight of the ten tests in this file removed their scratch directory from
a `trap ... EXIT`. Such a trap replaces the one the bats binary installs
for its own bookkeeping, so a test that fails prints no TAP line at all:
not `not ok`, nothing. The run ends with a warning that it executed nine
of ten tests, and anyone reading the tail of the output, or grepping it
for `not ok`, sees a suite with no failures in it.

Break one assertion in this file and the difference is the whole point.
Before: `1..10` followed by `# bats warning: Executed 9 instead of
expected 10 tests`, with no line naming the test that failed. After:
`not ok 2 reader Certificate is short-lived and never embeds credential
data`.

Remove the directory at the end of each body instead. Both runners set
-e, so on failure the removal is unreachable and the directory survives
for inspection, which is what a failed test wants anyway. The one test
that runs the orchestrator from inside its scratch directory returns to
where it started first -- not because rm would refuse, since BSD,
busybox and GNU rm all remove a directory from inside it and return 0,
but because the runner's own bookkeeping still runs in that subshell
after the body returns, and would be doing so on an unlinked cwd.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-08-07 23:53:40 +03:00
..
2026-02-17 22:54:12 +01:00