Fix/pilot stdout and test isolation#299
Merged
Merged
Conversation
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>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.