brev-cli
brev-cli copied to clipboard
Fix: Improve error handling for missing SSH client and add unit tests for `shell` command
Summary
NOTE: The first 3 commits are based off the preceding PR https://github.com/brevdev/brev-cli/pull/198.
Resolves #185
This PR addresses the issue where running the brev shell command in a Docker environment without an installed SSH client would cause a panic. Additionally, it improves the error handling when the specified workspace cannot be found.
Key changes
-
SSH Client Check:
- Added a check to ensure that the SSH client is installed and available in the system's PATH before attempting to establish a connection. If the SSH client is not found, a clear and actionable error message is returned.
-
Unit Tests:
- Added unit tests to verify the behavior when the SSH client is not installed, ensuring that the error is properly caught and reported.
- Added a test case to validate that an appropriate error is raised when the workspace is not found.
-
Code Cleanup:
- Performed minor formatting improvements and removed unnecessary whitespace for cleaner code.
Impact
- Users running
brev shellin environments without an SSH client will now receive a clear error message guiding them to install the required software. - Ensures robustness in handling edge cases where the specified workspace cannot be found.