Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions pkg/ssh/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,92 @@ Host existingtesthost

Host existinghost
User existinguser`,
},
{
name: "Host addition with lowercase host entries",
config: `host 192.168.1.1
User alice
Port 22

host myserver
User bob`,
execPath: testExecPath,
host: testHostBasic,
user: testUser,
context: testContextAlt,
workspace: testWorkspaceAlt,
workdir: "",
command: "",
gpgagent: false,
agentForwarding: true,
devsyHome: "",
provider: "",
expected: `# Devsy Start testhost
Host testhost
ForwardAgent yes
LogLevel error
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
HostKeyAlgorithms rsa-sha2-256,rsa-sha2-512,ssh-rsa
ProxyCommand "/path/to/exec" workspace ssh --stdio --context testcontext --user testuser testworkspace
User testuser
# Devsy End testhost
host 192.168.1.1
User alice
Port 22

host myserver
User bob`,
},
{
name: "Host addition does not corrupt existing Devsy block followed by plain host",
config: `host plain-host
User alice

# Devsy Start existing.devsy
Host existing.devsy
ForwardAgent yes
LogLevel error
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
HostKeyAlgorithms rsa-sha2-256,rsa-sha2-512,ssh-rsa
ProxyCommand "/path/to/exec" workspace ssh --stdio --context ctx --user user existing
User user
# Devsy End existing.devsy`,
execPath: testExecPath,
host: testHostBasic,
user: testUser,
context: testContextAlt,
workspace: testWorkspaceAlt,
workdir: "",
command: "",
gpgagent: false,
agentForwarding: true,
devsyHome: "",
provider: "",
expected: `# Devsy Start testhost
Host testhost
ForwardAgent yes
LogLevel error
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
HostKeyAlgorithms rsa-sha2-256,rsa-sha2-512,ssh-rsa
ProxyCommand "/path/to/exec" workspace ssh --stdio --context testcontext --user testuser testworkspace
User testuser
# Devsy End testhost
host plain-host
User alice

# Devsy Start existing.devsy
Host existing.devsy
ForwardAgent yes
LogLevel error
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
HostKeyAlgorithms rsa-sha2-256,rsa-sha2-512,ssh-rsa
ProxyCommand "/path/to/exec" workspace ssh --stdio --context ctx --user user existing
User user
# Devsy End existing.devsy`,
},
{
name: "Host addition after top level includes",
Expand Down
Loading