Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix
  • Loading branch information
mtojek committed Jul 15, 2024
commit 3ace8c679b82df058147b1991e93b6b35bdfc466
5 changes: 2 additions & 3 deletions coderd/provisionerdserver/provisionerdserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1103,9 +1103,8 @@ func (s *server) notifyWorkspaceBuildFailed(ctx context.Context, workspace datab

if _, err := s.NotificationEnqueuer.Enqueue(ctx, workspace.OwnerID, notifications.WorkspaceAutobuildFailed,
map[string]string{
"name": workspace.Name,
"initiator": build.InitiatorByUsername,
"reason": reason,
"name": workspace.Name,
"reason": reason,
}, "provisionerdserver",
// Associate this notification with all the related entities.
workspace.ID, workspace.OwnerID, workspace.TemplateID, workspace.OrganizationID,
Expand Down
3 changes: 3 additions & 0 deletions coderd/provisionerdserver/provisionerdserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1714,6 +1714,9 @@ func TestNotifications(t *testing.T) {
require.Contains(t, notifEnq.sent[0].targets, user.ID)
if tc.buildReason == database.BuildReasonInitiator {
require.Equal(t, notifEnq.sent[0].labels["initiator"], initiator.Username)
} else {
_, ok := notifEnq.sent[0].labels["initiator"]
require.False(t, ok, "initiator label not expected")
}
} else {
require.Len(t, notifEnq.sent, 0)
Expand Down