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 <appleboy.tw@gmail.com>
This commit is contained in:
appleboy 2025-04-27 09:46:02 +08:00
parent 1849c53ed5
commit 4a649cfe45
No known key found for this signature in database

View File

@ -974,9 +974,10 @@ func runSSHContainerTest(t *testing.T, cfg SSHTestConfig) {
if pluginCfg.CommandTimeout == 0 {
pluginCfg.CommandTimeout = 10 * time.Second
}
if cfg.AuthMethod == "key" {
switch cfg.AuthMethod {
case "key":
pluginCfg.KeyPath = cfg.KeyPath
} else if cfg.AuthMethod == "password" {
case "password":
pluginCfg.Password = cfg.Password
}