remove bus from search and avoid import cycle (#46789)

* fix the import cicle

* fix some unittest

* fix removal bus from search
This commit is contained in:
ying-jeanne
2022-03-21 16:54:30 +01:00
committed by GitHub
parent 8199cc0cf8
commit 0d5a6c2194
13 changed files with 137 additions and 137 deletions

View File

@@ -4,7 +4,6 @@ import (
"context"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/services/search"
"github.com/grafana/grafana/pkg/services/sqlstore"
)
@@ -38,8 +37,10 @@ type SQLStoreMock struct {
ExpectedDataSources []*models.DataSource
ExpectedDataSourcesAccessStats []*models.DataSourceAccessStats
ExpectedNotifierUsageStats []*models.NotifierUsageStats
ExpectedError error
ExpectedPersistedDashboards models.HitList
ExpectedSignedInUser *models.SignedInUser
ExpectedUserStars map[int64]bool
ExpectedError error
}
func NewSQLStoreMock() *SQLStoreMock {
@@ -179,10 +180,12 @@ func (m *SQLStoreMock) GetUserOrgList(ctx context.Context, query *models.GetUser
}
func (m *SQLStoreMock) GetSignedInUserWithCacheCtx(ctx context.Context, query *models.GetSignedInUserQuery) error {
query.Result = m.ExpectedSignedInUser
return m.ExpectedError
}
func (m *SQLStoreMock) GetSignedInUser(ctx context.Context, query *models.GetSignedInUserQuery) error {
query.Result = m.ExpectedSignedInUser
return m.ExpectedError
}
@@ -322,6 +325,7 @@ func (m *SQLStoreMock) UnstarDashboard(ctx context.Context, cmd *models.UnstarDa
}
func (m *SQLStoreMock) GetUserStars(ctx context.Context, query *models.GetUserStarsQuery) error {
query.Result = m.ExpectedUserStars
return m.ExpectedError
}
@@ -469,7 +473,8 @@ func (m *SQLStoreMock) GetDashboard(ctx context.Context, query *models.GetDashbo
return m.ExpectedError
}
func (m SQLStoreMock) SearchDashboards(ctx context.Context, query *search.FindPersistedDashboardsQuery) error {
func (m SQLStoreMock) SearchDashboards(ctx context.Context, query *models.FindPersistedDashboardsQuery) error {
query.Result = m.ExpectedPersistedDashboards
return m.ExpectedError
}