Skip to content

Refactor shell management and add SFTP integration tests#417

Merged
OutOfBedlam merged 3 commits into
mainfrom
wip-improve
Jun 10, 2026
Merged

Refactor shell management and add SFTP integration tests#417
OutOfBedlam merged 3 commits into
mainfrom
wip-improve

Conversation

@OutOfBedlam

Copy link
Copy Markdown
Contributor

This pull request introduces improvements to SSH server handling and testing, particularly focusing on SFTP support and command execution reliability. It also removes unused shell management code from the server management module. The most significant changes are grouped as follows:

SSH Server Improvements:

  • The SFTP handler in sshd now sets the working directory explicitly using the first entry in FileDirs, improving SFTP session consistency.
  • In the SSH command handler, output stream management is now handled using a WaitGroup instead of a sync.Once closure, ensuring all output streams are properly closed before the session ends. This prevents premature session closure and potential race conditions. [1] [2] [3] [4] [5]
  • The command exit code handling logic is updated for better reliability, ensuring the correct exit code is sent to the SSH client.

Testing Enhancements:

  • Adds a comprehensive SFTP integration test (TestSSHSftp) to verify directory creation, file upload, file stat, directory listing, and file download functionality over SFTP.
  • Introduces a new SSH command test suite (TestSSHCommands and SSHTestCommand) to validate command execution and output matching, improving test coverage for SSH interactions.
  • Test dependencies are updated to include the SFTP package and necessary imports. [1] [2]

Code Cleanup:

  • Removes unused shell management API types and functions (ListShell, AddShell, DelShell, and related types) from svrmgmt.go, simplifying the server management codebase. [1] [2]

@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.03%. Comparing base (afd582a) to head (16364a0).

Files with missing lines Patch % Lines
mods/server/ssh.go 84.61% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #417      +/-   ##
==========================================
+ Coverage   63.89%   64.03%   +0.14%     
==========================================
  Files         353      353              
  Lines       68359    68307      -52     
==========================================
+ Hits        43675    43743      +68     
+ Misses      20080    19946     -134     
- Partials     4604     4618      +14     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@OutOfBedlam OutOfBedlam merged commit 3cee853 into main Jun 10, 2026
9 checks passed
@OutOfBedlam OutOfBedlam deleted the wip-improve branch June 10, 2026 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant