Alerting: Delete expired images from the database (#53236)

This commit adds a DeleteExpiredService that deletes expired images from the database. It is run in the periodic collector service.
This commit is contained in:
George Robinson
2022-08-09 15:28:36 +01:00
committed by GitHub
parent adbb789877
commit 196b781c70
10 changed files with 354 additions and 218 deletions

View File

@@ -3,27 +3,15 @@ package store_test
import (
"context"
"testing"
"time"
"github.com/grafana/grafana/pkg/services/ngalert/models"
"github.com/grafana/grafana/pkg/services/ngalert/store"
"github.com/grafana/grafana/pkg/services/ngalert/tests"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/services/ngalert/models"
"github.com/grafana/grafana/pkg/services/ngalert/tests"
)
const baseIntervalSeconds = 10
// Every time this is called, time advances by 1 second.
func mockTimeNow() {
var timeSeed int64
store.TimeNow = func() time.Time {
fakeNow := time.Unix(timeSeed, 0).UTC()
timeSeed++
return fakeNow
}
}
func TestIntegrationAlertInstanceOperations(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")