-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: enable ssh-portal support by default (#290)
- Loading branch information
1 parent
e1bdcb5
commit 38cfffe
Showing
2 changed files
with
62 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ func Test_generateSSHConnectionString(t *testing.T) { | |
lagoon map[string]string | ||
service string | ||
container string | ||
isPortal bool | ||
} | ||
tests := []struct { | ||
name string | ||
|
@@ -65,15 +66,44 @@ func Test_generateSSHConnectionString(t *testing.T) { | |
service: "cli", | ||
container: "cli", | ||
}, | ||
want: `ssh -t /home/user/.ssh/my-key-o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -p 22 [email protected] service=cli container=cli`, | ||
want: `ssh -t -i /home/user/.ssh/my-key -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -p 22 [email protected] service=cli container=cli`, | ||
}, | ||
{ | ||
name: "test5 - sshportal", | ||
args: args{ | ||
lagoon: map[string]string{ | ||
"hostname": "lagoon.example.com", | ||
"port": "22", | ||
"username": "example-com-main", | ||
"sshKey": "/home/user/.ssh/my-key", | ||
}, | ||
isPortal: true, | ||
service: "cli", | ||
container: "cli", | ||
}, | ||
want: `ssh -t -i /home/user/.ssh/my-key -p 22 [email protected] service=cli container=cli`, | ||
}, | ||
{ | ||
name: "test6 - sshportal", | ||
args: args{ | ||
lagoon: map[string]string{ | ||
"hostname": "lagoon.example.com", | ||
"port": "22", | ||
"username": "example-com-main", | ||
}, | ||
isPortal: true, | ||
service: "cli", | ||
container: "cli", | ||
}, | ||
want: `ssh -t -p 22 [email protected] service=cli container=cli`, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
cmdProjectName = tt.args.project | ||
cmdProjectEnvironment = tt.args.environment | ||
|
||
if got := generateSSHConnectionString(tt.args.lagoon, tt.args.service, tt.args.container); got != tt.want { | ||
if got := generateSSHConnectionString(tt.args.lagoon, tt.args.service, tt.args.container, tt.args.isPortal); got != tt.want { | ||
t.Errorf("generateSSHConnectionString() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
|