* Feature + Test + Documentation: added no-auth ssh health cheack feature, changed documentation to fit new behavior, added ssh test cases. * Refactor: refactored authenticate field to infer from username and password insted of specifying it inside config. * Refactor: removed non used field. * Refactor: changed error, removed spaces. * Refactor: added comments.
24 lines
547 B
Go
24 lines
547 B
Go
package ssh
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
)
|
|
|
|
func TestSSH_validate(t *testing.T) {
|
|
cfg := &Config{}
|
|
if err := cfg.Validate(); err != nil {
|
|
t.Error("didn't expect an error")
|
|
}
|
|
cfg.Username = "username"
|
|
if err := cfg.Validate(); err == nil {
|
|
t.Error("expected an error")
|
|
} else if !errors.Is(err, ErrEndpointWithoutSSHPassword) {
|
|
t.Errorf("expected error to be '%v', got '%v'", ErrEndpointWithoutSSHPassword, err)
|
|
}
|
|
cfg.Password = "password"
|
|
if err := cfg.Validate(); err != nil {
|
|
t.Errorf("expected no error, got '%v'", err)
|
|
}
|
|
}
|