Skip to content

Commit 8541ad7

Browse files
FIX (healthckeck): Write database name in healthcheck messages
1 parent 67505f3 commit 8541ad7

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

backend/internal/features/healthcheck/attempt/check_pg_health_uc.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,11 @@ func (uc *CheckPgHealthUseCase) sendDbStatusNotification(
225225
messageBody := ""
226226

227227
if newHealthStatus == databases.HealthStatusAvailable {
228-
messageTitle = "✅ Database is back online"
229-
messageBody = "✅ The database is back online after being unavailable"
228+
messageTitle = fmt.Sprintf("✅ DB [%s] is back online", database.Name)
229+
messageBody = fmt.Sprintf("✅ The [%s] database is back online after being unavailable", database.Name)
230230
} else {
231-
messageTitle = "❌ Database is unavailable"
232-
messageBody = "❌ The database is currently unavailable"
231+
messageTitle = fmt.Sprintf("❌ DB [%s] is unavailable", database.Name)
232+
messageBody = fmt.Sprintf("❌ The [%s] database is currently unavailable", database.Name)
233233
}
234234

235235
for _, notifier := range database.Notifiers {

backend/internal/features/healthcheck/attempt/check_pg_health_uc_test.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package healthcheck_attempt
22

33
import (
44
"errors"
5+
"fmt"
56
"testing"
67
"time"
78

@@ -84,8 +85,8 @@ func Test_CheckPgHealthUseCase(t *testing.T) {
8485
t,
8586
"SendNotification",
8687
mock.Anything,
87-
"❌ Database is unavailable",
88-
"❌ The database is currently unavailable",
88+
fmt.Sprintf("❌ DB [%s] is unavailable", database.Name),
89+
fmt.Sprintf("❌ The [%s] database is currently unavailable", database.Name),
8990
)
9091
})
9192

@@ -149,8 +150,8 @@ func Test_CheckPgHealthUseCase(t *testing.T) {
149150
t,
150151
"SendNotification",
151152
mock.Anything,
152-
"❌ Database is unavailable",
153-
"❌ The database is currently unavailable",
153+
fmt.Sprintf("❌ DB [%s] is unavailable", database.Name),
154+
fmt.Sprintf("❌ The [%s] database is currently unavailable", database.Name),
154155
)
155156
},
156157
)
@@ -228,8 +229,8 @@ func Test_CheckPgHealthUseCase(t *testing.T) {
228229
t,
229230
"SendNotification",
230231
mock.Anything,
231-
"❌ Database is unavailable",
232-
"❌ The database is currently unavailable",
232+
fmt.Sprintf("❌ DB [%s] is unavailable", database.Name),
233+
fmt.Sprintf("❌ The [%s] database is currently unavailable", database.Name),
233234
)
234235
},
235236
)
@@ -301,8 +302,8 @@ func Test_CheckPgHealthUseCase(t *testing.T) {
301302
t,
302303
"SendNotification",
303304
mock.Anything,
304-
"✅ Database is back online",
305-
"✅ The database is back online after being unavailable",
305+
fmt.Sprintf("✅ DB [%s] is back online", database.Name),
306+
fmt.Sprintf("✅ The [%s] database is back online after being unavailable", database.Name),
306307
)
307308
})
308309

0 commit comments

Comments
 (0)