mirror of
https://github.com/TwiN/gatus.git
synced 2024-11-28 02:43:10 +01:00
9d151fcdb4
* refactor: Partially break core package into dns, result and ssh packages * refactor: Move core package to config/endpoint * refactor: Fix warning about overlapping imported package name with endpoint variable * refactor: Rename EndpointStatus to Status * refactor: Merge result pkg back into endpoint pkg, because it makes more sense * refactor: Rename parameter r to result in Condition.evaluate * refactor: Rename parameter r to result * refactor: Revert accidental change to endpoint.TypeDNS * refactor: Rename parameter r to result * refactor: Merge util package into endpoint package * refactor: Rename parameter r to result
26 lines
688 B
Go
26 lines
688 B
Go
package ssh
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
)
|
|
|
|
func TestSSH_validate(t *testing.T) {
|
|
cfg := &Config{}
|
|
if err := cfg.Validate(); err == nil {
|
|
t.Error("expected an error")
|
|
} else if !errors.Is(err, ErrEndpointWithoutSSHUsername) {
|
|
t.Errorf("expected error to be '%v', got '%v'", ErrEndpointWithoutSSHUsername, err)
|
|
}
|
|
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)
|
|
}
|
|
}
|