Chore: GetDashboardQuery should be dispatched using DispatchCtx (#36877)
* Chore: GetDashboardQuery should be dispatched using DispatchCtx * Fix after merge * Changes after review * Various fixes * Use GetDashboardCtx function instead of GetDashboard
This commit is contained in:
@@ -234,7 +234,7 @@ func (ss *SQLStore) GetFolderByTitle(orgID int64, title string) (*models.Dashboa
|
||||
|
||||
// TODO: Remove me
|
||||
func GetDashboard(query *models.GetDashboardQuery) error {
|
||||
return GetDashboardCtx(context.Background(), query)
|
||||
return GetDashboardCtx(context.TODO(), query)
|
||||
}
|
||||
|
||||
func GetDashboardCtx(ctx context.Context, query *models.GetDashboardQuery) error {
|
||||
|
||||
@@ -56,7 +56,7 @@ func TestDashboardDataAccess(t *testing.T) {
|
||||
OrgId: 1,
|
||||
}
|
||||
|
||||
err := GetDashboard(&query)
|
||||
err := GetDashboardCtx(context.Background(), &query)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
So(query.Result.Title, ShouldEqual, "test dash 23")
|
||||
@@ -72,7 +72,7 @@ func TestDashboardDataAccess(t *testing.T) {
|
||||
OrgId: 1,
|
||||
}
|
||||
|
||||
err := GetDashboard(&query)
|
||||
err := GetDashboardCtx(context.Background(), &query)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
So(query.Result.Title, ShouldEqual, "test dash 23")
|
||||
@@ -88,7 +88,7 @@ func TestDashboardDataAccess(t *testing.T) {
|
||||
OrgId: 1,
|
||||
}
|
||||
|
||||
err := GetDashboard(&query)
|
||||
err := GetDashboardCtx(context.Background(), &query)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
So(query.Result.Title, ShouldEqual, "test dash 23")
|
||||
@@ -103,7 +103,7 @@ func TestDashboardDataAccess(t *testing.T) {
|
||||
OrgId: 1,
|
||||
}
|
||||
|
||||
err := GetDashboard(&query)
|
||||
err := GetDashboardCtx(context.Background(), &query)
|
||||
So(err, ShouldEqual, models.ErrDashboardIdentifierNotSet)
|
||||
})
|
||||
|
||||
@@ -191,7 +191,7 @@ func TestDashboardDataAccess(t *testing.T) {
|
||||
OrgId: 1,
|
||||
}
|
||||
|
||||
err = GetDashboard(&query)
|
||||
err = GetDashboardCtx(context.Background(), &query)
|
||||
So(err, ShouldBeNil)
|
||||
So(query.Result.FolderId, ShouldEqual, 0)
|
||||
So(query.Result.CreatedBy, ShouldEqual, savedDash.CreatedBy)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package sqlstore
|
||||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
@@ -51,7 +52,7 @@ func TestGetDashboardVersion(t *testing.T) {
|
||||
Uid: savedDash.Uid,
|
||||
}
|
||||
|
||||
err = GetDashboard(&dashCmd)
|
||||
err = GetDashboardCtx(context.Background(), &dashCmd)
|
||||
So(err, ShouldBeNil)
|
||||
eq := reflect.DeepEqual(dashCmd.Result.Data, query.Result.Data)
|
||||
So(eq, ShouldEqual, true)
|
||||
|
||||
Reference in New Issue
Block a user