simplify API
This commit is contained in:
@@ -22,14 +22,10 @@ func TestGetHTTPSuccess(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
status, err := fn(t.Context())
|
||||
err = fn(t.Context())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if status != watchdog.StatusOK {
|
||||
t.Fatalf("incorrect status %s, expected %s", status, watchdog.StatusOK)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetHTTPError(t *testing.T) {
|
||||
@@ -39,8 +35,8 @@ func TestGetHTTPError(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
status, err := fn(t.Context())
|
||||
if status != watchdog.StatusDown || err == nil {
|
||||
err = fn(t.Context())
|
||||
if err == nil {
|
||||
t.Errorf("incorrect status for unavalable host")
|
||||
}
|
||||
}
|
||||
@@ -57,14 +53,10 @@ func TestHeadHTTPSuccess(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
status, err := fn(t.Context())
|
||||
err = fn(t.Context())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if status != watchdog.StatusOK {
|
||||
t.Fatalf("incorrect status %s, expected %s", status, watchdog.StatusOK)
|
||||
}
|
||||
}
|
||||
|
||||
func TestHeadHTTPError(t *testing.T) {
|
||||
@@ -74,8 +66,8 @@ func TestHeadHTTPError(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
status, err := fn(t.Context())
|
||||
if status != watchdog.StatusDown || err == nil {
|
||||
err = fn(t.Context())
|
||||
if err == nil {
|
||||
t.Errorf("incorrect status for unavalable host")
|
||||
}
|
||||
}
|
||||
@@ -101,15 +93,10 @@ func TestDialTCPSuccess(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
status, err := fn(t.Context())
|
||||
err = fn(t.Context())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if status != watchdog.StatusOK {
|
||||
t.Error("incorrect status for available addr")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestDialTCPError(t *testing.T) {
|
||||
@@ -120,8 +107,8 @@ func TestDialTCPError(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
status, err := fn(t.Context())
|
||||
if (status != watchdog.StatusDown) || (err == nil) {
|
||||
t.Errorf("incorrect status %s, expected %s", status, watchdog.StatusDown)
|
||||
err = fn(t.Context())
|
||||
if err == nil {
|
||||
t.Errorf("incorrect status")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user