Mathias Fredriksson
9520da338e
fix: conform to stricter printf usage in Go 1.24 ( #16330 )
2025-01-29 18:06:22 +02:00
Cian Johnston
7b88776403
chore(testutil): add testutil.GoleakOptions ( #16070 )
...
- Adds `testutil.GoleakOptions` and consolidates existing options to
this location
- Pre-emptively adds required ignore for this Dependabot PR to pass CI
https://github.com/coder/coder/pull/16066
2025-01-08 15:38:37 +00:00
Spike Curtis
cee6b1ebde
fix: wait for prompt on rich param CLI test ( #15406 )
...
Fixes a race in TestUpdateValidateRichParameters where the parameter is sent prior to the prompt.
Causes errors like: https://github.com/coder/coder/actions/runs/11681622439/job/32527173007
```
ptytest.go:132: 2024-11-05 10:02:18.819: cmd: "bool_parameter"
ptytest.go:167: 2024-11-05 10:02:18.819: cmd: matched "bool_parameter" = "bool_parameter"
update_test.go:440: 2024-11-05 10:02:18.819: cmd: stdin: "cat\r\n"
ptytest.go:132: 2024-11-05 10:02:18.819: cmd: "> Enter a value (default: \"\"): can't validate build parameter \"bool_parameter\": boolean value can be either \"true\" or \"false\""
ptytest.go:167: 2024-11-05 10:02:18.819: cmd: matched "boolean value can be either" = "\n> Enter a value (default: \"\"): can't validate build parameter \"bool_parameter\": boolean value can be either"
update_test.go:440: 2024-11-05 10:02:18.819: cmd: stdin: "\r\n"
ptytest.go:167: 2024-11-05 10:02:18.819: cmd: matched "Enter a value" = " \"true\" or \"false\"\n> Enter a value"
update_test.go:440: 2024-11-05 10:02:18.819: cmd: stdin: "false\r\n"
ptytest.go:132: 2024-11-05 10:02:18.821: cmd: "> Enter a value (default: \"\"): can't validate build parameter \"bool_parameter\": boolean value can be either \"true\" or \"false\""
```
2024-11-07 16:47:15 +04:00
Dean Sheather
d426569d4a
fix: make terminal raw in ssh command on windows ( #12990 )
2024-04-17 18:01:20 +00:00
Danny Kopping
93933d7905
feat(cli): show queue position during workspace builds ( #12606 )
2024-03-18 12:05:05 +02:00
Ammar Bandukwala
b4c0fa80d8
chore(cli): rename Cmd to Command ( #12616 )
...
I think Command is cleaner and my original decision to use "Cmd"
a mistake.
Plus this creates better parity with cobra.
2024-03-17 09:45:26 -05:00
Ammar Bandukwala
496232446d
chore(cli): replace clibase with external coder/serpent ( #12252 )
2024-03-15 11:24:38 -05:00
Mathias Fredriksson
2c6e0f7d0a
feat(agent/agentssh): handle session signals ( #10842 )
2023-11-23 19:55:36 +02:00
Cian Johnston
98a076fb46
chore(pty/ptytest): add sync.Once to close ( #10220 )
2023-10-11 16:47:02 +01:00
Cian Johnston
fad02081fc
fix: avoid logging env in unit tests ( #9885 )
2023-09-27 13:34:40 +01:00
Spike Curtis
70e481e7a5
fix: use terminal emulator that keeps state in ReconnectingPTY tests ( #9765 )
...
* Add more pty diagnostics for terminal parsing
Signed-off-by: Spike Curtis <spike@coder.com >
* print escaped strings
Signed-off-by: Spike Curtis <spike@coder.com >
* Only log on failure - heisenbug?
Signed-off-by: Spike Curtis <spike@coder.com >
* use the terminal across matches to keep cursor & contents state
Signed-off-by: Spike Curtis <spike@coder.com >
* Only log bytes if we're not expecting EOF
Signed-off-by: Spike Curtis <spike@coder.com >
---------
Signed-off-by: Spike Curtis <spike@coder.com >
2023-09-19 17:57:30 +00:00
Kyle Carberry
22e781eced
chore: add /v2 to import module path ( #9072 )
...
* chore: add /v2 to import module path
go mod requires semantic versioning with versions greater than 1.x
This was a mechanical update by running:
```
go install github.com/marwan-at-work/mod/cmd/mod@latest
mod upgrade
```
Migrate generated files to import /v2
* Fix gen
2023-08-18 18:55:43 +00:00
Asher
02ee724d9f
fix: do terminal emulation in reconnecting pty tests ( #9114 )
...
It looks like it is possible for screen to use control sequences instead
of literal newlines which fails the tests.
This reuses the existing readUntil function used in other pty tests.
2023-08-16 13:02:03 -08:00
Mathias Fredriksson
4a13c58077
test(pty/ptytest): fix error message on deadline exceeded ( #8337 )
2023-07-06 16:18:03 +03:00
Mathias Fredriksson
88c35d3f04
fix(pty): close output writer before reader on Windows to unblock close ( #8299 )
2023-07-05 15:25:07 +03:00
Colin Adler
adf14f1917
chore(cli): warn on template push or create when no lockfile present ( #8059 )
2023-06-20 15:02:44 +00:00
Spike Curtis
9c030a8888
fix: pty.Start respects context on Windows too ( #7373 )
...
* fix: pty.Start respects context on Windows too
Signed-off-by: Spike Curtis <spike@coder.com >
* Fix windows imports; rename ToExec -> AsExec
Signed-off-by: Spike Curtis <spike@coder.com >
* Fix import in windows test
Signed-off-by: Spike Curtis <spike@coder.com >
---------
Signed-off-by: Spike Curtis <spike@coder.com >
2023-05-03 11:43:05 +04:00
Spike Curtis
6e8ff2d95c
Fix macOS pty race with dropped output ( #7278 )
...
Signed-off-by: Spike Curtis <spike@coder.com >
2023-04-25 12:32:28 +04:00
Spike Curtis
daee91c6dc
refactor: PTY & SSH ( #7100 )
...
* Add ssh tests for longoutput, orphan
Signed-off-by: Spike Curtis <spike@coder.com >
* PTY/SSH tests & improvements
Signed-off-by: Spike Curtis <spike@coder.com >
* Fix some tests
Signed-off-by: Spike Curtis <spike@coder.com >
* Fix linting
Signed-off-by: Spike Curtis <spike@coder.com >
* fmt
Signed-off-by: Spike Curtis <spike@coder.com >
* Fix windows test
Signed-off-by: Spike Curtis <spike@coder.com >
* Windows copy test
Signed-off-by: Spike Curtis <spike@coder.com >
* WIP Windows pty handling
Signed-off-by: Spike Curtis <spike@coder.com >
* Fix truncation tests
Signed-off-by: Spike Curtis <spike@coder.com >
* Appease linter/fmt
Signed-off-by: Spike Curtis <spike@coder.com >
* Fix typo
Signed-off-by: Spike Curtis <spike@coder.com >
* Rework truncation test to not assume OS buffers
Signed-off-by: Spike Curtis <spike@coder.com >
* Disable orphan test on Windows --- uses sh
Signed-off-by: Spike Curtis <spike@coder.com >
* agent_test running SSH in pty use ptytest.Start
Signed-off-by: Spike Curtis <spike@coder.com >
* More detail about closing pseudoconsole on windows
Signed-off-by: Spike Curtis <spike@coder.com >
* Code review fixes
Signed-off-by: Spike Curtis <spike@coder.com >
* Rearrange ptytest method order
Signed-off-by: Spike Curtis <spike@coder.com >
* Protect pty.Resize on windows from races
Signed-off-by: Spike Curtis <spike@coder.com >
* Fix windows bugs
Signed-off-by: Spike Curtis <spike@coder.com >
* PTY doesn't extend PTYCmd
Signed-off-by: Spike Curtis <spike@coder.com >
* Fix windows types
Signed-off-by: Spike Curtis <spike@coder.com >
---------
Signed-off-by: Spike Curtis <spike@coder.com >
2023-04-24 14:53:57 +04:00
Mathias Fredriksson
90d18dd2e5
fix(agent): Close stdin and stdout separately to fix pty output loss ( #6862 )
...
Fixes #6656
Closes #6840
2023-03-29 21:58:38 +03:00
Ammar Bandukwala
2bd6d2908e
feat: convert entire CLI to clibase ( #6491 )
...
I'm sorry.
2023-03-23 17:42:20 -05:00
Ammar Bandukwala
3b73321a6c
feat: refactor deployment config ( #6347 )
2023-03-07 15:10:01 -06:00
Mathias Fredriksson
145d101512
test: Refactor ptytest to use contexts and less duplication ( #5740 )
2023-01-17 16:02:38 +02:00
Mathias Fredriksson
77e71f3ca4
test: Improve TestSSH/ForwardGPG stability on macOS via pty.ReadRune ( #5739 )
...
Writing to stdin for `coder ssh` too early could result in the input
being discarded. To work around this we add a new `ptytest` method
called `ReadRune` that lets us read one character of output. This will
indicate the command is ready to accept input.
It could be one character of the prompt, or of the loading message
waiting for connection to be established.
2023-01-17 15:30:47 +02:00
Dean Sheather
f1fe2b5c06
feat: add GPG forwarding to coder ssh ( #5482 )
2023-01-06 07:52:19 +00:00
Dean Sheather
31d38d4246
feat: allow http and https listening simultaneously ( #5365 )
2022-12-15 20:09:19 +00:00
Mathias Fredriksson
f7467cac50
fix: Improve ptytest closure on expect match timeout ( #5337 )
...
To ensure ptytest closure always happens the same way, we now define a
new `Close` function on `PTY` and always call the close function instead
of manually closing read/writers.
A few additional log messages have been added as well, to better
understand the shutdown process in case of errors.
2022-12-07 15:20:06 +00:00
Marcin Tojek
2f3ff6ced8
fix: improve pty and ptytest ( #5327 )
...
* Fix: improve ptytest
* Disable skip
* WIP
* WIP
* WIP
* WIP
* WIP
* WIP
* WIP
* WIP
* Fix
* WIP
* Fix
* fix: pty close on Windows
* Revert changes around workflow
* fix
2022-12-07 14:18:09 +01:00
Mathias Fredriksson
81c3948792
fix: Close tty first in ptytest cleanup ( #5252 )
2022-12-02 12:32:50 +00:00
Mathias Fredriksson
6ed12ade54
fix: Improve debuggability of ptytest cleanup ( #5170 )
...
There are sporadic flakes in some tests on Windows related to the use of
`ptytest`. Since it's not clear why they fail, this commit adds some
more logging and timeouts to the cleanup methods.
2022-11-24 15:20:17 +00:00
Mathias Fredriksson
09da3858ce
fix: Terminal emulation used by SSH sessions ( #3473 )
...
Fixes #3371
2022-09-12 19:27:51 +03:00
Ammar Bandukwala
a09ffd6c0d
feat: show better error on invalid template upload ( #3847 )
...
* feat: show better error on invalid template upload
* Fix tests
2022-09-02 22:48:40 +00:00
Mathias Fredriksson
e44f7adb7e
feat: Set SSH env vars: SSH_CLIENT, SSH_CONNECTION and SSH_TTY ( #3622 )
...
Fixes #2339
2022-08-23 21:19:57 +03:00
Ammar Bandukwala
d7b96f7d58
Correct spelling of macOS ( #3478 )
...
* Correct spelling of macOS
* fixup! Correct spelling of macOS
* fixup! Correct spelling of macOS
2022-08-11 21:22:06 -04:00
Mathias Fredriksson
b10a1b84e5
fix: Fix close in pty and ptytest ( #3392 )
2022-08-05 21:31:54 +03:00
Mathias Fredriksson
46d64c624a
fix: Add ps.Kill/Wait to test cleanup in ptytest.Start ( #3387 )
2022-08-05 13:35:33 +03:00
Mathias Fredriksson
1d6283bdac
fix: Improve debuggability of ptytest failures ( #3367 )
...
Since we were not failing tests with `require` the error output was
somewhat hidden in the stream of log messages. This change standardizes
`ptytest` logging and failing to improve visibility.
2022-08-03 13:27:20 +03:00
Mathias Fredriksson
4730c589fe
chore: Use standardized test timeouts and delays ( #3291 )
2022-08-01 15:45:05 +03:00
Mathias Fredriksson
29d44b6283
fix: Guard pty window resize after close ( #3270 )
...
Could help alleviate #3236 .
2022-07-28 19:07:11 +00:00
Spike Curtis
043768076f
Explain pty Process abstraction ( #3254 )
...
Signed-off-by: Spike Curtis <spike@coder.com >
2022-07-27 17:03:55 -07:00
Spike Curtis
36ffdce065
Return proper exit code on ssh with TTY ( #3192 )
...
* Return proper exit code on ssh with TTY
Signed-off-by: Spike Curtis <spike@coder.com >
* Fix revive lint
Signed-off-by: Spike Curtis <spike@coder.com >
* Fix Windows exit code for missing command
Signed-off-by: Spike Curtis <spike@coder.com >
* Fix close error handling on agent TTY
Signed-off-by: Spike Curtis <spike@coder.com >
2022-07-27 14:23:28 -05:00
Mathias Fredriksson
92a95fbd5f
fix: Rewrite ptytest to buffer stdout ( #3170 )
...
Fixes #2122
2022-07-25 20:02:34 +03:00
Mathias Fredriksson
2c67a2f30b
fix: Close bug in pty ( #3166 )
2022-07-25 16:31:30 +03:00
Spike Curtis
22febc749a
provisionerd sends failed or complete last ( #2732 )
...
* provisionerd sends failed or complete last
Signed-off-by: Spike Curtis <spike@coder.com >
* Move runner into package
Signed-off-by: Spike Curtis <spike@coder.com >
* Remove jobRunner interface
Signed-off-by: Spike Curtis <spike@coder.com >
* renames and slight reworking from code review
Signed-off-by: Spike Curtis <spike@coder.com >
* Reword comment about okToSend
Signed-off-by: Spike Curtis <spike@coder.com >
2022-07-01 09:55:46 -07:00
Mathias Fredriksson
6da4810a5e
chore: Add (skipped) ptytest test that hangs on Intel Mac (and Windows) ( #1629 )
...
Co-authored-by: Steven Masley <stevenmasley@coder.com >
2022-06-07 17:08:11 +03:00
David Wahler
5f21a145d1
bug: Don't try to handle SIGINT when prompting for passwords ( #1498 )
2022-05-18 15:26:38 +00:00
Kyle Carberry
81577f120a
feat: Add web terminal with reconnecting TTYs ( #1186 )
...
* feat: Add web terminal with reconnecting TTYs
This adds a web terminal that can reconnect to resume sessions!
No more disconnects, and no more bad bufferring!
* Add xstate service
* Add the webpage for accessing a web terminal
* Add terminal page tests
* Use Ticker instead of Timer
* Active Windows mode on Windows
2022-04-29 17:30:10 -05:00
Kyle Carberry
587cbac498
fix: Swap height and width for TTY size ( #1161 )
...
This was causing the TTY to be real wonky on Windows.
It didn't seem to have an effect on Linux, but I suspect
that's because of escape codes.
2022-04-25 15:30:02 -05:00
Kyle Carberry
fccd4fab96
fix: Windows resize syscall using incorrect pointer ( #1152 )
...
Resizing of PTYs weren't working on Windows before,
but they are now!
2022-04-25 14:30:57 -05:00
Kyle Carberry
185d97a65b
fix: Increase ptytest buffer to resolve flake ( #1141 )
...
From investigating the following run:
https://github.com/coder/coder/runs/6156348454?check_suite_focus=true
It's believed that the cause is data being discarded due to the buffer
filling up. This _might_ fix it, but not entirely sure.
2022-04-25 12:14:16 -05:00