Commit 67c88f4
authored
Fix/pilot stdout and test isolation (#299)
* fix(pilot): route normal CLI output to stdout
Cobra's Print family writes to OutOrStderr, and the root command never
set an output writer, so every piece of normal output, secret values
included, went to stderr. Shell redirection silently misbehaved:
`spike secret get db/creds > creds.txt` produced an empty file while
the secret splashed onto the terminal, and piping data into another
tool required merging the streams first.
Set the root command's output writer to stdout; subcommands inherit it.
The PrintErr family keeps writing to stderr, so errors remain
separable from data, which is what shell users and scripts expect. The
bare-metal harness scripts already capture both streams (2>&1), so
their behavior does not change.
Spec: TBD
Signed-off-by: Volkan Özçelik <volkan.ozcelik@broadcom.com>
* test(nexus): isolate sqlite state tests from the real data directory
The sqlite-backed tests in state/base, state/persist, and
backend/sqlite/persist operated on the real ~/.spike/data/spike.db and
deleted it as part of their setup, which destroyed the database out
from under a live bare-metal dev environment whenever `make test` ran
alongside one. It bit three gate runs this week.
fs.NexusDataFolder memoizes its result with sync.Once, so a per-test
t.Setenv cannot redirect it once the first test has resolved the path.
Instead, each affected package now sets SPIKE_NEXUS_DATA_DIR to a
per-run temporary directory in TestMain, before anything resolves the
folder, and removes the directory afterward. A full run of the three
packages leaves ~/.spike untouched, and the temp-dir removal also
cleans up the spike_test_*.db files the suite used to leave behind.
TASKS.md: closes this task and the Pilot stdout task delivered by the
previous commit.
Spec: TBD
Signed-off-by: Volkan Özçelik <volkan.ozcelik@broadcom.com>
---------
Signed-off-by: Volkan Özçelik <volkan.ozcelik@broadcom.com>1 parent 6c36860 commit 67c88f4
5 files changed
Lines changed: 110 additions & 2 deletions
File tree
- .context
- app
- nexus/internal/state
- backend/sqlite/persist
- base
- persist
- spike/internal/cmd
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| |||
Lines changed: 39 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
311 | 313 | | |
312 | 314 | | |
313 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
314 | 335 | | |
315 | 336 | | |
316 | 337 | | |
317 | 338 | | |
318 | 339 | | |
319 | 340 | | |
320 | 341 | | |
| 342 | + | |
321 | 343 | | |
322 | 344 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
47 | 55 | | |
48 | 56 | | |
49 | 57 | | |
| |||
0 commit comments