Skip to content

[deckhouse-cli] test: cover clean stdout during command startup - #477

Open
fuldaxxx wants to merge 2 commits into
mainfrom
chore/add-stdout-test
Open

[deckhouse-cli] test: cover clean stdout during command startup#477
fuldaxxx wants to merge 2 commits into
mainfrom
chore/add-stdout-test

Conversation

@fuldaxxx

@fuldaxxx fuldaxxx commented Sep 9, 2026

Copy link
Copy Markdown
Member

Description

Adds regression coverage for the invariant that d8 writes nothing to stdout while building its command tree. Two layers, no production code changes:

  • cmd/d8/root_test.go — in-process unit test: swaps os.Stdout for a pipe, points DECKHOUSE_CLI_PATH at a path that can be neither created nor read (its parent is a regular file, so ENOTDIR holds for root too), and requires the capture to stay empty after NewRootCommand(). A second test asserts the capture actually sees a log line written the way the CLI logger writes one, so the first cannot pass vacuously.
  • testing/e2e/auth/exec_credential_e2e_test.go — same invariant on the built binary: runs d8 --version as a subprocess under the same unreadable plugins path and requires stdout to hold exactly one line, the version output. This is the only layer that covers file descriptor 1 as a whole — build tags, linked-in libraries, anything writing outside this repository's logger. The binary is taken from D8_BIN, then bin/d8, then build/<goos>-<goarch>/bin/d8; with none present the test skips, since a clean checkout has no artifact to check and the unit test is what gates CI.

Both tests pin LOG_LEVEL explicitly so an ambient LOG_LEVEL=debug cannot turn them red for an unrelated, still-open defect (see below).

Signed-off-by: Ruslan Gorbunov <ruslan.gorbunov@flant.com>
@fuldaxxx fuldaxxx self-assigned this Sep 9, 2026
@fuldaxxx fuldaxxx added the bug Something isn't working label Sep 9, 2026
@fuldaxxx fuldaxxx changed the title [dmt] test: cover clean stdout during command startup [deckhouse-cli] test: cover clean stdout during command startup Sep 9, 2026
Signed-off-by: Ruslan Gorbunov <ruslan.gorbunov@flant.com>
@fuldaxxx
fuldaxxx marked this pull request as ready for review September 9, 2026 10:41
@fuldaxxx
fuldaxxx requested a review from ldmonster as a code owner September 9, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant