K8s: Dashboards: Fix multi-org quota (#103073)
This commit is contained in:
@@ -447,11 +447,13 @@ func (dr *DashboardServiceImpl) Count(ctx context.Context, scopeParams *quota.Sc
|
||||
}
|
||||
total += orgDashboards
|
||||
|
||||
tag, err := quota.NewTag(dashboards.QuotaTargetSrv, dashboards.QuotaTarget, quota.OrgScope)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
if scopeParams != nil && scopeParams.OrgID == org.ID {
|
||||
tag, err := quota.NewTag(dashboards.QuotaTargetSrv, dashboards.QuotaTarget, quota.OrgScope)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
u.Set(tag, orgDashboards)
|
||||
}
|
||||
u.Set(tag, orgDashboards)
|
||||
}
|
||||
|
||||
tag, err := quota.NewTag(dashboards.QuotaTargetSrv, dashboards.QuotaTarget, quota.GlobalScope)
|
||||
|
||||
@@ -2244,8 +2244,8 @@ func TestQuotaCount(t *testing.T) {
|
||||
ctx, k8sCliMock := setupK8sDashboardTests(service)
|
||||
orgSvc := orgtest.FakeOrgService{ExpectedOrgs: orgs}
|
||||
service.orgService = &orgSvc
|
||||
k8sCliMock.On("GetStats", mock.Anything, mock.Anything).Return(&countOrg2, nil).Once()
|
||||
k8sCliMock.On("GetStats", mock.Anything, mock.Anything).Return(&countOrg1, nil).Once()
|
||||
k8sCliMock.On("GetStats", mock.Anything, int64(2)).Return(&countOrg2, nil).Once()
|
||||
k8sCliMock.On("GetStats", mock.Anything, int64(1)).Return(&countOrg1, nil).Once()
|
||||
|
||||
result, err := service.Count(ctx, query)
|
||||
require.NoError(t, err)
|
||||
|
||||
Reference in New Issue
Block a user