Skip to content

fix: stabilize flaky command tests and get suite passing#8

Open
kusutori wants to merge 1 commit into
mainfrom
codex/fix-failing-test-cases-and-add-coverage
Open

fix: stabilize flaky command tests and get suite passing#8
kusutori wants to merge 1 commit into
mainfrom
codex/fix-failing-test-cases-and-add-coverage

Conversation

@kusutori

@kusutori kusutori commented May 6, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Recent test rewrites caused multiple flaky failures due to shared Cobra flag state and brittle assertions against colored/formatted help output.
  • Tests also failed to build because of an unused import in internal/download/download_test.go.

Description

  • Reset Cobra flags recursively before each command test case and restore SilenceUsage/SilenceErrors after running to avoid cross-test state leakage (cmd/command_exec_test.go).
  • Improve output capture by piping os.Stdout/os.Stderr in the test harness while preserving RootCmd.SetOut/SetErr buffers (cmd/command_exec_test.go).
  • Add wantErrText to the test harness and update add, remove, and completion tests to assert canonical error text from returned error instead of relying on colored/help-formatted output (cmd/add_cmd_test.go, cmd/remove_cmd_test.go, cmd/completion_cmd_test.go).
  • Remove an unused strings import that caused a test build failure (internal/download/download_test.go).

Testing

  • Ran go test ./... and the entire test suite passed successfully.
  • Ran go test ./... -cover to confirm coverage reporting and it completed successfully.

Codex Task

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac6d6108a1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cmd/command_exec_test.go
@kusutori

kusutori commented May 6, 2026

Copy link
Copy Markdown
Owner Author

@copilot fix the CI failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant