Chore: Use time mocks in queryhistory to speed up tests (#66644)

* use time mocks in queryhistory to speed up tests

* remove comments
This commit is contained in:
Serge Zaitsev
2023-04-17 12:02:47 +02:00
committed by GitHub
parent 086d8b7363
commit f58a63b2df
6 changed files with 31 additions and 29 deletions
+2 -3
View File
@@ -4,7 +4,6 @@ import (
"context"
"fmt"
"strconv"
"time"
"github.com/grafana/grafana/pkg/infra/db"
"github.com/grafana/grafana/pkg/services/user"
@@ -19,7 +18,7 @@ func (s QueryHistoryService) createQuery(ctx context.Context, user *user.SignedI
Queries: cmd.Queries,
DatasourceUID: cmd.DatasourceUID,
CreatedBy: user.UserID,
CreatedAt: time.Now().Unix(),
CreatedAt: s.now().Unix(),
Comment: "",
}
@@ -50,7 +49,7 @@ func (s QueryHistoryService) searchQueries(ctx context.Context, user *user.Signe
var allQueries []interface{}
if query.To <= 0 {
query.To = time.Now().Unix()
query.To = s.now().Unix()
}
if query.Page <= 0 {