Tests: Fix dashboard mock (#98647)

This commit is contained in:
Stephanie Hingtgen 2025-01-07 15:20:35 -07:00 committed by GitHub
parent 25538bcfdf
commit 69adb3d25b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 4 additions and 4 deletions

View File

@ -401,7 +401,7 @@ func Test_DeletedDashboardsNotMigrated(t *testing.T) {
// modify what the mock returns for just this test case
dashMock := s.dashboardService.(*dashboards.FakeDashboardService)
dashMock.On("GetAllDashboardsByOrgId", mock.Anything).Return(
dashMock.On("GetAllDashboardsByOrgId", mock.Anything, int64(1)).Return(
[]*dashboards.Dashboard{
{UID: "1", OrgID: 1, Data: simplejson.New()},
{UID: "2", OrgID: 1, Data: simplejson.New(), Deleted: time.Now()},

View File

@ -200,7 +200,7 @@ func (_m *FakeDashboardService) GetAllDashboards(ctx context.Context) ([]*Dashbo
func (_m *FakeDashboardService) GetAllDashboardsByOrgId(ctx context.Context, orgID int64) ([]*Dashboard, error) {
ret := _m.Called(ctx)
ret := _m.Called(ctx, orgID)
if len(ret) == 0 {
panic("no return value specified for GetAllDashboardsByOrgId")

View File

@ -525,7 +525,7 @@ func TestGetAllDashboardsByOrgId(t *testing.T) {
t.Run("Should fallback to dashboard store if Kubernetes feature flags are not enabled", func(t *testing.T) {
service.features = featuremgmt.WithFeatures()
fakeStore.On("GetAllDashboardsByOrgId", mock.Anything).Return([]*dashboards.Dashboard{}, nil).Once()
fakeStore.On("GetAllDashboardsByOrgId", mock.Anything, int64(1)).Return([]*dashboards.Dashboard{}, nil).Once()
dashboard, err := service.GetAllDashboardsByOrgId(context.Background(), 1)
require.NoError(t, err)
require.NotNil(t, dashboard)

View File

@ -211,7 +211,7 @@ func (_m *FakeDashboardStore) GetAllDashboards(ctx context.Context) ([]*Dashboar
// GetAllDashboardsByOrgId provides a mock function with given fields: ctx
func (_m *FakeDashboardStore) GetAllDashboardsByOrgId(ctx context.Context, orgID int64) ([]*Dashboard, error) {
ret := _m.Called(ctx)
ret := _m.Called(ctx, orgID)
if len(ret) == 0 {
panic("no return value specified for GetAllDashboardsByOrgId")