Skip to content

Commit

Permalink
DEV-47397 - Fix failing tests on TestTemplateDefaultData (#84)
Browse files Browse the repository at this point in the history
* DEV-47397 - Fix failing tests on TestTemplateDefaultData

due to changes for append timeframe for panel/dashboard URL
tests needed to be fixed as well
  • Loading branch information
yasmin-tr authored Jan 23, 2025
1 parent 622b366 commit 4969ad5
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions pkg/services/ngalert/notifier/templates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"testing"
"time" // LOGZ.IO GRAFANA CHANGE :: DEV-47397 - Append timeframe for panel/dashboard URL

"github.com/go-openapi/strfmt"
alertingModels "github.com/grafana/alerting/models"
Expand Down Expand Up @@ -125,8 +126,11 @@ CommonAnnotations: {{ range .CommonAnnotations.SortedPairs }}{{ .Name }}={{ .Val
Results: []alertingNotify.TestTemplatesResult{{
Name: "slack.title",
// LOGZ.IO GRAFANA CHANGE :: DEV-45707: remove org id query param from notification urls
Text: fmt.Sprintf("http://localhost:9093/d/%s",
DefaultAnnotations[alertingModels.DashboardUIDAnnotation]),
// LOGZ.IO GRAFANA CHANGE :: DEV-47397 - Append timeframe for panel/dashboard URL
Text: fmt.Sprintf("http://localhost:9093/d/%s?from=%d&to=%d",
DefaultAnnotations[alertingModels.DashboardUIDAnnotation],
time.Time(simpleAlert.StartsAt).Add(-5*time.Minute).UnixMilli(),
time.Time(simpleAlert.EndsAt).UnixMilli()),
// LOGZ.IO GRAFANA CHANGE :: End
}},
Errors: nil,
Expand All @@ -142,9 +146,12 @@ CommonAnnotations: {{ range .CommonAnnotations.SortedPairs }}{{ .Name }}={{ .Val
Results: []alertingNotify.TestTemplatesResult{{
Name: "slack.title",
// LOGZ.IO GRAFANA CHANGE :: DEV-45707: remove org id query param from notification urls
Text: fmt.Sprintf("http://localhost:9093/d/%s?viewPanel=%s",
// LOGZ.IO GRAFANA CHANGE :: DEV-47397 - Append timeframe for panel/dashboard URL
Text: fmt.Sprintf("http://localhost:9093/d/%s?viewPanel=%s&from=%d&to=%d",
DefaultAnnotations[alertingModels.DashboardUIDAnnotation],
DefaultAnnotations[alertingModels.PanelIDAnnotation]),
DefaultAnnotations[alertingModels.PanelIDAnnotation],
time.Time(simpleAlert.StartsAt).Add(-5*time.Minute).UnixMilli(),
time.Time(simpleAlert.EndsAt).UnixMilli()),
// LOGZ.IO GRAFANA CHANGE :: End
}},
Errors: nil,
Expand Down

0 comments on commit 4969ad5

Please sign in to comment.