Skip to content

PostgreSQL backup tool with Point-In-Time-Recovery and restore verification

FIX (healthckeck): Write database name in healthcheck messages

Rostislav Dugin8541ad7b281e
diff --git a/backend/internal/features/healthcheck/attempt/check_pg_health_uc.go b/backend/internal/features/healthcheck/attempt/check_pg_health_uc.go
index 95194ee1..10727f7f 100644
--- a/backend/internal/features/healthcheck/attempt/check_pg_health_uc.go
+++ b/backend/internal/features/healthcheck/attempt/check_pg_health_uc.go
@@ -225,11 +225,11 @@ func (uc *CheckPgHealthUseCase) sendDbStatusNotification(
messageBody := ""
if newHealthStatus == databases.HealthStatusAvailable {
- messageTitle = "✅ Database is back online"
- messageBody = "✅ The database is back online after being unavailable"
+ messageTitle = fmt.Sprintf("✅ DB [%s] is back online", database.Name)
+ messageBody = fmt.Sprintf("✅ The [%s] database is back online after being unavailable", database.Name)
} else {
- messageTitle = "❌ Database is unavailable"
- messageBody = "❌ The database is currently unavailable"
+ messageTitle = fmt.Sprintf("❌ DB [%s] is unavailable", database.Name)
+ messageBody = fmt.Sprintf("❌ The [%s] database is currently unavailable", database.Name)
}
for _, notifier := range database.Notifiers {
diff --git a/backend/internal/features/healthcheck/attempt/check_pg_health_uc_test.go b/backend/internal/features/healthcheck/attempt/check_pg_health_uc_test.go
index 4e23d5a7..f7e27780 100644
--- a/backend/internal/features/healthcheck/attempt/check_pg_health_uc_test.go
+++ b/backend/internal/features/healthcheck/attempt/check_pg_health_uc_test.go
@@ -2,6 +2,7 @@ package healthcheck_attempt
import (
"errors"
+ "fmt"
"testing"
"time"
@@ -84,8 +85,8 @@ func Test_CheckPgHealthUseCase(t *testing.T) {
t,
"SendNotification",
mock.Anything,
- "❌ Database is unavailable",
- "❌ The database is currently unavailable",
+ fmt.Sprintf("❌ DB [%s] is unavailable", database.Name),
+ fmt.Sprintf("❌ The [%s] database is currently unavailable", database.Name),
)
})
@@ -149,8 +150,8 @@ func Test_CheckPgHealthUseCase(t *testing.T) {
t,
"SendNotification",
mock.Anything,
- "❌ Database is unavailable",
- "❌ The database is currently unavailable",
+ fmt.Sprintf("❌ DB [%s] is unavailable", database.Name),
+ fmt.Sprintf("❌ The [%s] database is currently unavailable", database.Name),
)
},
)
@@ -228,8 +229,8 @@ func Test_CheckPgHealthUseCase(t *testing.T) {
t,
"SendNotification",
mock.Anything,
- "❌ Database is unavailable",
- "❌ The database is currently unavailable",
+ fmt.Sprintf("❌ DB [%s] is unavailable", database.Name),
+ fmt.Sprintf("❌ The [%s] database is currently unavailable", database.Name),
)
},
)
@@ -301,8 +302,8 @@ func Test_CheckPgHealthUseCase(t *testing.T) {
t,
"SendNotification",
mock.Anything,
- "✅ Database is back online",
- "✅ The database is back online after being unavailable",
+ fmt.Sprintf("✅ DB [%s] is back online", database.Name),
+ fmt.Sprintf("✅ The [%s] database is back online after being unavailable", database.Name),
)
})