mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Fix integration test for creating silences (#65722)
* fix integration test for creating silences to create correct silence with endsAt in the future * Update api_alertmanager_test.go
This commit is contained in:
parent
a24554ba0a
commit
ed8628e39d
@ -12,11 +12,12 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/grafana/grafana/pkg/expr"
|
|
||||||
"github.com/prometheus/common/model"
|
"github.com/prometheus/common/model"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
"github.com/grafana/grafana/pkg/expr"
|
||||||
|
|
||||||
apimodels "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
apimodels "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||||
ngmodels "github.com/grafana/grafana/pkg/services/ngalert/models"
|
ngmodels "github.com/grafana/grafana/pkg/services/ngalert/models"
|
||||||
ngstore "github.com/grafana/grafana/pkg/services/ngalert/store"
|
ngstore "github.com/grafana/grafana/pkg/services/ngalert/store"
|
||||||
@ -212,11 +213,11 @@ func TestIntegrationAMConfigAccess(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
t.Run("when creating silence", func(t *testing.T) {
|
t.Run("when creating silence", func(t *testing.T) {
|
||||||
body := `
|
now := time.Now()
|
||||||
|
body := fmt.Sprintf(`
|
||||||
{
|
{
|
||||||
"comment": "string",
|
"comment": "string",
|
||||||
"createdBy": "string",
|
"createdBy": "string",
|
||||||
"endsAt": "2023-03-31T14:17:04.419Z",
|
|
||||||
"matchers": [
|
"matchers": [
|
||||||
{
|
{
|
||||||
"isRegex": true,
|
"isRegex": true,
|
||||||
@ -224,9 +225,10 @@ func TestIntegrationAMConfigAccess(t *testing.T) {
|
|||||||
"value": "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{
|
testCases := []testCase{
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user