pulumi/tests
Abhinav Gupta b51caa6ab4
cmdutil.ReadConsole[NoEcho]: Use bubbletea (#13815)
Switch the cmdutil.ReadConsole and cmdutil.ReadConsoleNoEcho functions
to use the bubbletea library to render the prompt,
using the textinput widget provided by the accompanying bubbles library.
The resulting input widgets support arrow keys, back space,
and some basic readline-style bindings including Ctrl-A, Alt-B, etc.

I went through all uses of ReadConsole or ReadConsoleNoEcho.
Only the one in new.go had a non-compliant prompt that I had to adjust.

Note: One divergence in behavior I opted for was that
password prompts will echo '*' characters as the user is typing
and then no echo once they've accepted or canceled the value.
Previously, the prompt did not echo anything in either case.

<details>

  <summary>
  Introduction if you're unfamiliar with bubbletea
  </summary>

  bubbletea operates by modeling the widget state as
  an immutable data structure that receives messages for events.
  On receiving a message (key press, e.g.) the model's Update method
  returns a new model instance representing its new state.
  Update may also optionally return additional commands for the program,
  e.g. stop running, or print something and move on.
  The model's View method returns what should be drawn in the terminal
  based on the model's current state.
This programming model makes it reasonably straightforward to unit test
  some of the core functionality of independent widgets
  as demonstrated in this PR.

</details>

Resolves #1565

---

Demos:

<details>
  <summary>Plain text</summary>
  

![prompt-plain](https://github.com/pulumi/pulumi/assets/41730/66258fc8-f772-4d01-bc7c-1f7b116aebaa)
</details>

<details>
  <summary>Secret</summary>


![prompt-secret](https://github.com/pulumi/pulumi/assets/41730/372f862e-9186-4d47-ba7d-0107c47f52f6)
</details>

<details>
  <summary>Secret prompt with padding</summary>


![prompt-secret-2](https://github.com/pulumi/pulumi/assets/41730/e9b7c253-4c9d-4235-9fa6-197aa0522033)
</details>
2023-08-30 17:08:44 +00:00
..
benchmarks/go-alias-norm deps: Upgrade google.golang.org/{genproto, grpc} 2023-07-27 16:24:33 -07:00
examples PR feedback 2023-07-06 20:40:23 -07:00
integration cmdutil.ReadConsole[NoEcho]: Use bubbletea (#13815) 2023-08-30 17:08:44 +00:00
testdata Add a simple yaml convert smoke test 2023-08-09 17:48:41 +01:00
testprovider all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
.gitignore ci: Use reduced smoke testing on Windows & macOS targets 2022-09-21 09:55:06 -07:00
README.md Rename "Smoke" test to "Acceptance" tests 2023-01-30 15:38:37 -05:00
about_test.go test: fix regex used to test Go version output in about command. (#10499) 2022-08-29 11:53:03 -07:00
config_test.go filestate: Re-add project support 2023-03-31 13:21:36 -07:00
go.mod cmdutil.ReadConsole[NoEcho]: Use bubbletea (#13815) 2023-08-30 17:08:44 +00:00
go.sum cmdutil.ReadConsole[NoEcho]: Use bubbletea (#13815) 2023-08-30 17:08:44 +00:00
history_test.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
login_test.go ci: radical idea - what if slow tests & no stdout makes GH consider runner dead? 2022-03-06 14:52:13 -08:00
main_test.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
remote_test.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
roundtrip_test.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
smoke_test.go Add a simple yaml convert smoke test 2023-08-09 17:48:41 +01:00
stack_test.go `pulumi new -s 'org/project/stack'` checks the proper organization for project existence rather than backend.currentUser()'s org. 2023-07-03 09:28:52 -07:00

README.md

Integration Tests

This module provides integration tests for the Pulumi CLI.

The tests can be run via:

make test_all

Usage of Go build tags

In order to speed up integration tests in GitHub actions, Go build tags are used to conditionally compile the desired test cases.

// integration_nodejs_test.go
//go:build (nodejs || all) && !xplatform-acceptance

// integration_nodejs_acceptance_test.go
//go:build nodejs || all