feat: v0.4.0 simplify

Reviewed-on: #1
Co-authored-by: Dmitry Fedotov <dmitry@uint32.ru>
Co-committed-by: Dmitry Fedotov <dmitry@uint32.ru>
This commit is contained in:
2025-09-23 23:14:13 +03:00
committed by Dmitry
parent 214fda877e
commit 7d95eba336
6 changed files with 131 additions and 174 deletions

View File

@@ -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")
}
}