-
Notifications
You must be signed in to change notification settings - Fork 887
refactor: PTY & SSH #7100
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
Merged
refactor: PTY & SSH #7100
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
0075d7d
Add ssh tests for longoutput, orphan
spikecurtis a491d4f
PTY/SSH tests & improvements
spikecurtis 2cf357a
Fix some tests
spikecurtis 28c0646
Fix linting
spikecurtis 872e357
fmt
spikecurtis 3f21e30
Fix windows test
spikecurtis e83ff6e
Windows copy test
spikecurtis b610579
WIP Windows pty handling
spikecurtis 90bfe94
Fix truncation tests
spikecurtis d6e131c
Appease linter/fmt
spikecurtis 2c9c6ef
Fix typo
spikecurtis e39e885
Rework truncation test to not assume OS buffers
spikecurtis 8ec3d1f
Disable orphan test on Windows --- uses sh
spikecurtis df424e6
agent_test running SSH in pty use ptytest.Start
spikecurtis 50e3fec
More detail about closing pseudoconsole on windows
spikecurtis c09083e
Code review fixes
spikecurtis 439107d
Rearrange ptytest method order
spikecurtis c6a3229
Protect pty.Resize on windows from races
spikecurtis aa94546
Fix windows bugs
spikecurtis 0f07cb9
PTY doesn't extend PTYCmd
spikecurtis eaabb3a
merge branch 'main' of https://github.com/coder/coder into spike/pty-ssh
spikecurtis 50060d8
Fix windows types
spikecurtis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason you chose a stripped down interface vs using
ssh.Session
directly? I see the test but we also have a fake context there with all the methods so I'm not seeing the benefit per-se. I feel this creates a bit of needless indirection. Not critical to change now, I'll see if I make some changes down the line as I do some refactoring for the session handling anyway.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ssh.Session
is an even biggerinterface
!I couldn't see any way to directly instantiate any of the concrete implementations in like
gliderlabs
.My first stab at the test I wanted to do created the whole server like the other ssh tests do, but I found the even after calling
Close()
on the network connection, the session context in the handler wasn't closed quickly. So, this construction narrows down the bigssh.Session
interface into just what we need, and allows me to more precisely control when the context expires in tests.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit annoying that I have to mock out the context methods, but unfortunately,
ssh.Session
is defined to have a methodContext()
that returnsssh.Context
rather thancontext.Context
.Unfortunately the go type-checker isn't smart enough to understand that
Context() ssh.Context
must also satisfyContext() context.Context
sincecontext.Context
is a strict subset ofssh.Context
. Alas.