39 Commits
Author SHA1 Message Date
Mateusz Mikuła 1026152aa1 test,ssh: avoid leaking user config into testing ssh sessions (#8395) 2026-11-27 09:10:11 +01:00
Wez Furlong 9b919222ca wezterm-ssh: Skip e2e tests when sshd fixture cannot run properly
This uses the system ssh client to validate the sshd fixture. Real client
regressions will still fail the test rather than being skipped.
2026-10-10 08:39:11 +01:00
Wez Furlong 8e35f94d7c wezterm-ssh: fix leaking ssh-agent children in tests
This has been bothering me for a long time; ensure that we kill
the ssh-agent processes spawned by the tests.
2025-05-17 09:21:11 -07:00
Wez Furlong 3b994de290 deps: remove once_cell in favor of std functionality 2025-02-12 10:00:31 -07:00
Wez Furlong 8953b211e8 wezterm-ssh: self-skip tests if sshd not installed 2025-02-08 12:52:12 -07:00
Wez Furlong 5b0642d2dc fix unused mut warning 2024-07-14 07:45:54 -07:00
Wez Furlong 44c1335856 wezterm-ssh: avoid configuration default config files in tests 2024-07-13 06:39:11 -07:00
Wez Furlong 6ad0da98d8 deps: remove smol-potat, update futures-lite
smol-potat hasn't had updates in 4 years and was bifurcating some
big deps.  It wasn't necessary; it was trivially easy to replace
with smol::block_on with no meaningful increase in boilerplate,
and the result is much more understandable in purpose and effect.
2024-05-13 11:43:10 -07:00
Riatre 9b811c7a16 Wire up agent forward for libssh backend (#5345)
* Wire up agent forward for libssh backend

TSIA.

There's a drive-by change in sftpwrap.rs for bumping to new libssh-rs.
2024-05-08 08:09:07 -07:00
Wez Furlong 9e36775acf ssh: improve host key verification error messaging
See screenshots attached to #3941 to see how it renders
2023-07-06 10:42:58 -07:00
Wez Furlong a9baa45157 wezterm-ssh: tidy up test output
and fixup some imports, which obscure the heart of this change!

The key thing is: we no longer unconditionally write directly to stderr;
use eprintln so that the test harness can capture stderr.
2023-03-23 12:59:02 -07:00
Jalil David Salamé Messina d541e2e13d fix(clippy): Remove closures where possible
- Removes closures and function calls for types that implement default:

  ```rust
  // Change
  let _my_str = get_str().unwrap_or(String::new);
  // To
  let _my_str = get_str().unwrap_or_default();
  ```

- Uses the `.cloned()/.copied()` methods where possible
- Use function pointer instead of simple closure

May improve performace, as closures generate more code, and this might
unlock some inlining opportunities.
2023-03-19 08:41:38 -07:00
Wez Furlong 5c4a84726e wezterm-ssh: fix leaky tests, as described in https://nexte.st/book/leaky-tests.html 2023-03-12 20:34:37 -07:00
Wez Furlong b35e3b2aad deps: remove pretty_env_loggger
Go directly to the underlying env_logger crate, as pretty_env_logger
hasn't been updated in some time, and I'd like to be able to redirect
the log output to a file more directly, and that feature is in a newer
version of the env logger than pretty_env_logger was pulling in.
2022-04-07 08:24:07 -07:00
Wez Furlong e4ed2c93e2 encoding my preferred import grouping in the rustfmt config
This uses an unstable option in rustfmt, you `cargo +nightly fmt`
needs to be used to format the code correctly.
2022-01-17 13:50:51 -07:00
Chip Senkbeil 1f17416e60 Support gating libssh-rs and ssh2 behind features of same name 2022-01-09 19:36:56 -08:00
Wez Furlong 6367e55117 ssh: tidy up sshd logging in tests 2021-12-15 23:19:27 -07:00
Wez Furlong de13e17723 ssh: explicitly allow ssh-rsa keys in tests
It looks like the debian 9 test failures with libssh are the
same underlying issue as https://github.com/wez/wezterm/issues/1262

Poking around in the debug output, and then spelunking through the code,
we can use the `pubkeyacceptedtypes` ssh config option to add the key
type to the list of keys.  This doesn't appear to be a documented
option in the current versions of openssh.

I'm not 100% sure that this is right, but it's worth a shot.
2021-12-15 22:05:24 -07:00
Wez Furlong 9db09f5e98 ssh: enable logging in tests 2021-12-15 20:40:15 -07:00
Wez Furlong 5c0a2dab26 ssh: log diagnostics to stderr in tests 2021-12-15 20:13:18 -07:00
Wez Furlong a745c2edc8 ssh: fixup test for centos8
```
thread 'e2e::sftp::canonicalize_should_either_return_resolved_path_or_error_if_missing' panicked at 'Unexpected result from canonicalize: Err(LibSsh(Sftp(SftpError(2))))', wezterm-ssh/tests/e2e/sftp.rs:615:14
```

We can't currently match that error because the LibSsh SftError(x) error
code is private.
2021-12-15 11:48:13 -07:00
Wez Furlong 9822e80adb wezterm-ssh: ask kernel to allocate port number for tests
The ssh tests are the main flakey failure in CI, so let's see if
we can make them less flakey.
2021-11-23 06:16:31 -07:00
Chip Senkbeil 2415a44d74 Switch to camino::{Utf8PathBuf, Utf8Path} 2021-10-10 14:54:45 -07:00
Chip Senkbeil d15789d2c0 Finish refactoring names of methods based on wez feedback 2021-10-10 14:54:45 -07:00
Chip Senkbeil 9a8a0f35e7 Update realpath test to support error or ok 2021-10-10 14:54:45 -07:00
Chip Senkbeil 0cc426df7d Reenable PAM as Fedora was complaining about it being disabled 2021-10-10 14:54:45 -07:00
Chip Senkbeil 4befffccd4 Add ignore attr to non-linux/non-macos tests 2021-10-10 14:54:45 -07:00
Chip Senkbeil 7d5c301c66 Ensure /run/sshd exists, explicitly set username in sshd fixture, add back use_privilege_mode no 2021-10-10 14:54:45 -07:00
Chip Senkbeil d98a2cbbc2 Remove deprecated privilege separation from sshd 2021-10-10 14:54:45 -07:00
Chip Senkbeil 1dd3d5cdf0 Update tests to generate keys using old PEM format 2021-10-10 14:54:45 -07:00
Chip Senkbeil 4a0376e6de Refactor exposed ssh2 types to wrapper types 2021-10-10 14:54:45 -07:00
Chip Senkbeil 86c307a214 Add tests for File::readdir and File::stat; change .cirrus.yml to set home directory permissions 2021-10-10 14:54:45 -07:00
Chip Senkbeil 50a0372e17 Fix file asyncread and asyncwrite future handling by keeping stateful futures 2021-10-10 14:54:45 -07:00
Chip Senkbeil 35043e9341 Fix four failing tests and clean up sshd setup to not require ssh-add 2021-10-10 14:54:45 -07:00
Chip Senkbeil d797b3f27e Add tests for remaining sftp methods off of sftp channel -- 4 are failing 2021-10-10 14:54:45 -07:00
Chip Senkbeil ec09a6ab68 Add tests for stat and lstat 2021-10-10 14:54:45 -07:00
Chip Senkbeil dc61ba2774 Add a couple more tests for sftp to cover mkdir and rmdir 2021-10-10 14:54:45 -07:00
Chip Senkbeil 259ac04ce5 Refactor sftp interaction into a separate struct that uses SessionSender underneath 2021-10-10 14:54:45 -07:00
Chip Senkbeil fca3bd6904 Add some initial tests to wezterm-ssh, ignoring read/write of file as those are hanging 2021-10-10 14:54:45 -07:00