Commit c892f7f
authored
test(auth): deprecated InputBox usage causes flakiness #6596
## Problem
#6594
The `getMfaCodeFromUser` currently uses a deprecated version of
`createInputBox` and the following `promptUser` function:
https://github.com/aws/aws-toolkit-vscode/blob/0fa1b5b47ab642458df934192832a4ffcb6c9d1e/packages/core/src/shared/ui/input.ts#L72-L135
Based on the stack trace, there is a race condition here that can lead
to a type error, but unsure how?
Stack trace:
```
TypeError: inputBox.hide is not a function
at promptUser (/Users/runner/work/aws-toolkit-vscode/aws-toolkit-vscode/packages/core/src/shared/ui/input.ts:133:18)
at async getMfaTokenFromUser (/Users/runner/work/aws-toolkit-vscode/aws-toolkit-vscode/packages/core/src/auth/credentials/utils.ts:124:19)
at async /Users/runner/work/aws-toolkit-vscode/aws-toolkit-vscode/packages/core/src/auth/providers/sharedCredentialsProvider.ts:422:38
```
### Investigation Notes:
- The error only happens when running the test suite as a whole.
- The error only happens in CI (unable to reproduce locally).
## Solution
- avoid use of deprecated `createInputBox`
[function](https://github.com/aws/aws-toolkit-vscode/blob/0fa1b5b47ab642458df934192832a4ffcb6c9d1e/packages/core/src/shared/ui/input.ts#L31-L58),
prefer new version instead.
- Ran the tests 4x with 1000x on the test, and did not see a failure.
## Future Work
- Migrate existing cases away from this deprecated `createInputBox` if
there is evidence it leads to flaky tests or unreliable behavior.1 parent 06b3725 commit c892f7f
1 file changed
+8
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
| 18 | + | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
122 | 121 | | |
123 | 122 | | |
124 | | - | |
| 123 | + | |
125 | 124 | | |
126 | 125 | | |
127 | | - | |
| 126 | + | |
128 | 127 | | |
129 | 128 | | |
130 | 129 | | |
| |||
0 commit comments