Skip to content

Commit 4a649cf

Browse files
committed
refactor: refactor SSH authentication handling with switch statement
- Refactor if-else logic to a switch statement for handling SSH authentication methods Signed-off-by: appleboy <[email protected]>
1 parent 1849c53 commit 4a649cf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

plugin_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -974,9 +974,10 @@ func runSSHContainerTest(t *testing.T, cfg SSHTestConfig) {
974974
if pluginCfg.CommandTimeout == 0 {
975975
pluginCfg.CommandTimeout = 10 * time.Second
976976
}
977-
if cfg.AuthMethod == "key" {
977+
switch cfg.AuthMethod {
978+
case "key":
978979
pluginCfg.KeyPath = cfg.KeyPath
979-
} else if cfg.AuthMethod == "password" {
980+
case "password":
980981
pluginCfg.Password = cfg.Password
981982
}
982983

0 commit comments

Comments
 (0)