Quota(fix): remove service accounts from quota count (#56700)
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@@ -40,16 +41,22 @@ func TestIntegrationQuotaCommandsAndQueries(t *testing.T) {
|
||||
AlertRule: 5,
|
||||
},
|
||||
}
|
||||
|
||||
createUserCmd := user.CreateUserCommand{
|
||||
Name: "TestUser",
|
||||
OrgID: orgId,
|
||||
SkipOrgSetup: true,
|
||||
}
|
||||
user, err := sqlStore.CreateUser(context.Background(), createUserCmd)
|
||||
require.NoError(t, err)
|
||||
// create a new org and add user_id 1 as admin.
|
||||
// we will then have an org with 1 user. and a user
|
||||
// with 1 org.
|
||||
userCmd := models.CreateOrgCommand{
|
||||
Name: "TestOrg",
|
||||
UserId: 1,
|
||||
UserId: user.ID,
|
||||
}
|
||||
|
||||
err := sqlStore.CreateOrg(context.Background(), &userCmd)
|
||||
err = sqlStore.CreateOrg(context.Background(), &userCmd)
|
||||
require.NoError(t, err)
|
||||
orgId = userCmd.Result.Id
|
||||
|
||||
@@ -198,7 +205,7 @@ func TestIntegrationQuotaCommandsAndQueries(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, int64(5), query.Result.Limit)
|
||||
require.Equal(t, int64(0), query.Result.Used)
|
||||
require.Equal(t, int64(1), query.Result.Used)
|
||||
})
|
||||
|
||||
t.Run("Should be able to global org quota", func(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user