test: add coverage for terminal yes/no prompt parsing#49346
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA new test file was added to ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
|
Tested with stress, tests are stable. |
Summary
libbeat/common/terminal/terminal_test.go.ReadInput()newline trimming.PromptYesNo()behavior for default answers, mixed-caseyes, and whitespace-paddedno.User scenarios covered
libbeat/cmd/keystore.go), pressing Enter now has explicit tests proving default handling.yesin different capitalization, tests verify the command treats it as confirmation.nowith accidental surrounding spaces, tests verify the command still rejects as expected.Why this matters
Tests run
go test ./libbeat/common/terminal -count=5(pass)go test ./libbeat/common/terminal -count=1(pass)Removed or merged tests
What is this? | From workflow: Test Improver
Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.