Skip to content

Commit 3e097e1

Browse files
authored
acc: testserver: fix api/2.0/alerts/{id} error message to match cloud (#4550)
Fixes TestAccept/bundle/resources/alerts/basic/ on cloud
1 parent 74a29f6 commit 3e097e1

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

acceptance/bundle/resources/alerts/basic/output.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Deleting files...
6262
Destroy complete!
6363

6464
>>> [CLI] alerts-v2 get-alert [ALERT_ID]
65-
Error: Node with resource name None does not exist.
65+
Error: Alert with ID '[ALERT_ID]' does not exist.
6666

6767
Exit code: 1
6868

libs/testserver/handlers.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -543,12 +543,13 @@ func AddDefaultHandlers(server *Server) {
543543
server.Handle("GET", "/api/2.0/alerts/{id}", func(req Request) any {
544544
defer req.Workspace.LockUnlock()()
545545

546-
value, ok := req.Workspace.Alerts[req.Vars["id"]]
546+
id := req.Vars["id"]
547+
548+
value, ok := req.Workspace.Alerts[id]
547549
if !ok || value.LifecycleState == sql.AlertLifecycleStateDeleted {
548550
return Response{
549551
StatusCode: 404,
550-
// Backend returns a terrible error message today.
551-
Body: map[string]string{"message": "Node with resource name None does not exist."},
552+
Body: map[string]string{"message": "Alert with ID '" + id + "' does not exist."},
552553
}
553554
}
554555

0 commit comments

Comments
 (0)