-
Notifications
You must be signed in to change notification settings - Fork 888
fix: Run expect tests on Windows with conpty pseudo-terminal #276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## main #276 +/- ##
==========================================
- Coverage 68.22% 67.96% -0.27%
==========================================
Files 126 130 +4
Lines 6898 7079 +181
Branches 69 69
==========================================
+ Hits 4706 4811 +105
- Misses 1714 1779 +65
- Partials 478 489 +11
Continue to review full report at Codecov.
|
0ef4f42
to
03ea70c
Compare
bryphe-coder
commented
Feb 12, 2022
95c891f
to
a73476d
Compare
bryphe-coder
commented
Feb 12, 2022
bryphe-coder
commented
Feb 12, 2022
bryphe-coder
commented
Feb 12, 2022
bryphe-coder
commented
Feb 12, 2022
bryphe-coder
commented
Feb 12, 2022
kylecarbs
approved these changes
Feb 14, 2022
kylecarbs
reviewed
Feb 14, 2022
Thanks for reviewing @kylecarbs ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This brings together a bunch of random, partially implemented packages for support of the new(ish) Windows
conpty
API - such that we can leverage theexpect
style of CLI tests, but in a way that works in Linux/OSXpty
s and Windowsconpty
.These include:
go-expect
library from Netflix w/ some tweaks to work cross-platformpty
cross-platform implementation from waypoint-plugin-sdkconpty
Windows-specific implementation from waypoint-plugin-sdkpty
interface to work withgo-expect
+ the cross-plat versionThere were several limitations with the current packages:
go-expect
requires the sameos.File
(TTY) for input / output, butconhost
requires separate file handlesconpty
does not handle input, only outputpty
didn't expose the full set of primitives needed forconsole
Therefore, the following changes were made:
stdin
was added to theconpty
interfacego-expect
interface, so some portions were removed (ie, exec'ing a process) to simplify our implementation and make it easier to extend cross-platformconsole
exposing just aTty
, it exposes anInTty
andOutTty
, to help encapsulate the difference on Windows (on Linux, these point to the same pipe)Future improvements:
isatty
implementation doesn't support accurate detection ofconhost
pty's without an associated process. In lieu of a more robust check, I've added a--force-tty
flag intended for test case use - that forces the CLI to run in tty mode.After the all-hands + meetings this afternoon - I'll get my Win environment set up to iterate to get the tests working there.
Fixes #241