Skip to content

Commit

Permalink
fix integration test for creating silences
Browse files Browse the repository at this point in the history
to create correct silence with endsAt in the future
  • Loading branch information
yuri-tceretian committed Mar 31, 2023
1 parent a24554b commit 8ef2fb4
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pkg/tests/api/alerting/api_alertmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ import (
"testing"
"time"

"github.com/grafana/grafana/pkg/expr"
"github.com/prometheus/common/model"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/grafana/grafana/pkg/expr"

apimodels "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
ngmodels "github.com/grafana/grafana/pkg/services/ngalert/models"
ngstore "github.com/grafana/grafana/pkg/services/ngalert/store"
Expand Down Expand Up @@ -44,6 +45,7 @@ func TestIntegrationAMConfigAccess(t *testing.T) {
EnableUnifiedAlerting: true,
DisableAnonymous: true,
AppModeProduction: true,
EnableLog: true,
})

grafanaListedAddr, store := testinfra.StartGrafana(t, dir, path)
Expand Down Expand Up @@ -212,21 +214,22 @@ func TestIntegrationAMConfigAccess(t *testing.T) {
})

t.Run("when creating silence", func(t *testing.T) {
body := `
now := time.Now()
body := fmt.Sprintf(`
{
"comment": "string",
"createdBy": "string",
"endsAt": "2023-03-31T14:17:04.419Z",
"matchers": [
{
"isRegex": true,
"name": "string",
"value": "string"
}
],
"startsAt": "2021-03-31T13:17:04.419Z"
"startsAt": "%s",
"endsAt": "%s"
}
`
`, now.Format(time.RFC3339), now.Add(10*time.Second).Format(time.RFC3339))

testCases := []testCase{
{
Expand Down

0 comments on commit 8ef2fb4

Please sign in to comment.