mirror of
https://github.com/grafana/grafana.git
synced 2026-08-13 06:34:55 -05:00
Chore: Remove pkg/models/stats.go (#61613)
* remove pkg/models/stats.go * rename models package in tests
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/session"
|
||||
"github.com/grafana/grafana/pkg/services/stats"
|
||||
"github.com/grafana/grafana/pkg/services/team"
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
)
|
||||
@@ -23,10 +24,10 @@ type SQLStoreMock struct {
|
||||
ExpectedUser *user.User
|
||||
ExpectedTeamsByUser []*team.TeamDTO
|
||||
ExpectedAlert *models.Alert
|
||||
ExpectedSystemStats *models.SystemStats
|
||||
ExpectedDataSourceStats []*models.DataSourceStats
|
||||
ExpectedDataSourcesAccessStats []*models.DataSourceAccessStats
|
||||
ExpectedNotifierUsageStats []*models.NotifierUsageStats
|
||||
ExpectedSystemStats *stats.SystemStats
|
||||
ExpectedDataSourceStats []*stats.DataSourceStats
|
||||
ExpectedDataSourcesAccessStats []*stats.DataSourceAccessStats
|
||||
ExpectedNotifierUsageStats []*stats.NotifierUsageStats
|
||||
ExpectedSignedInUser *user.SignedInUser
|
||||
|
||||
ExpectedError error
|
||||
@@ -36,30 +37,6 @@ func NewSQLStoreMock() *SQLStoreMock {
|
||||
return &SQLStoreMock{}
|
||||
}
|
||||
|
||||
func (m *SQLStoreMock) GetAdminStats(ctx context.Context, query *models.GetAdminStatsQuery) error {
|
||||
return m.ExpectedError
|
||||
}
|
||||
|
||||
func (m *SQLStoreMock) GetAlertNotifiersUsageStats(ctx context.Context, query *models.GetAlertNotifierUsageStatsQuery) error {
|
||||
query.Result = m.ExpectedNotifierUsageStats
|
||||
return m.ExpectedError
|
||||
}
|
||||
|
||||
func (m *SQLStoreMock) GetDataSourceStats(ctx context.Context, query *models.GetDataSourceStatsQuery) error {
|
||||
query.Result = m.ExpectedDataSourceStats
|
||||
return m.ExpectedError
|
||||
}
|
||||
|
||||
func (m *SQLStoreMock) GetDataSourceAccessStats(ctx context.Context, query *models.GetDataSourceAccessStatsQuery) error {
|
||||
query.Result = m.ExpectedDataSourcesAccessStats
|
||||
return m.ExpectedError
|
||||
}
|
||||
|
||||
func (m *SQLStoreMock) GetSystemStats(ctx context.Context, query *models.GetSystemStatsQuery) error {
|
||||
query.Result = m.ExpectedSystemStats
|
||||
return m.ExpectedError
|
||||
}
|
||||
|
||||
func (m *SQLStoreMock) GetDialect() migrator.Dialect {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -24,13 +24,13 @@ import (
|
||||
"github.com/grafana/grafana/pkg/infra/localcache"
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/infra/tracing"
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/registry"
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/migrations"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/session"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/sqlutil"
|
||||
"github.com/grafana/grafana/pkg/services/stats"
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
@@ -202,7 +202,7 @@ func (ss *SQLStore) ensureMainOrgAndAdminUser(test bool) error {
|
||||
|
||||
// If this is a test database, don't exit early when any user is found.
|
||||
if !test {
|
||||
var stats models.SystemUserCountStats
|
||||
var stats stats.SystemUserCountStats
|
||||
// TODO: Should be able to rename "Count" to "count", for more standard SQL style
|
||||
// Just have to make sure it gets deserialized properly into models.SystemUserCountStats
|
||||
rawSQL := `SELECT COUNT(id) AS Count FROM ` + ss.Dialect.Quote("user")
|
||||
|
||||
Reference in New Issue
Block a user