Skip to content

test: Enable assertions about prompt text shown to users#38212

Merged
SarahFrench merged 3 commits intomainfrom
sarah/enable-assertions-about-prompt-text
Feb 26, 2026
Merged

test: Enable assertions about prompt text shown to users#38212
SarahFrench merged 3 commits intomainfrom
sarah/enable-assertions-about-prompt-text

Conversation

@SarahFrench
Copy link
Member

Context

The testInputMap allows engineers to define a list of responses to be returned to prompts with matching Ids. When used in the context of a test this Input method would return values early based on the contents of testInputResponseMap.

This PR

This PR is part of breaking down #38205. In that PR we're implementing a security feature that prompts users to review downloaded providers. This includes presenting the user with hash data, so testing that feature should include making some assertions about the prompts users see.

In this PR I update the testInputMap helper to return a buffer containing the prompt text that a user would see, which can optionally be used for assertions in tests. To enable filling that buffer with the prompt text I have moved the point in func (i *UIInput) Input where testInputResponseMap is used to below where the prompt is written to the input io.Writer.

I've updated a test showing how this can be used.

Also, I've updated the testInputMap helper to queue cleanup internally, so calling code doesn't need to handle the returned close function.

Target Release

N/A

Rollback Plan

  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

CHANGELOG entry

  • This change is user-facing and I added a changelog entry.
  • This change is not user-facing.

…sertions about what prompts a user has been shown. Make cleanup happen inside the helper.
@SarahFrench SarahFrench added the no-changelog-needed Add this to your PR if the change does not require a changelog entry label Feb 25, 2026
@SarahFrench SarahFrench marked this pull request as ready for review February 25, 2026 19:26
@SarahFrench SarahFrench requested a review from a team as a code owner February 25, 2026 19:26
@SarahFrench SarahFrench merged commit c37cf1c into main Feb 26, 2026
7 checks passed
@SarahFrench SarahFrench deleted the sarah/enable-assertions-about-prompt-text branch February 26, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog-needed Add this to your PR if the change does not require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants