mirror of
https://github.com/grafana/grafana.git
synced 2024-12-01 21:19:28 -06:00
790e1feb93
* streamline initialization of test databases, support on-disk sqlite test db * clean up test databases * introduce testsuite helper * use testsuite everywhere we use a test db * update documentation * improve error handling * disable entity integration test until we can figure out locking error
34 lines
655 B
Go
34 lines
655 B
Go
package quotaimpl
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/grafana/grafana/pkg/infra/db"
|
|
"github.com/grafana/grafana/pkg/services/quota"
|
|
"github.com/grafana/grafana/pkg/tests/testsuite"
|
|
)
|
|
|
|
func TestMain(m *testing.M) {
|
|
testsuite.Run(m)
|
|
}
|
|
|
|
func TestIntegrationQuotaDataAccess(t *testing.T) {
|
|
if testing.Short() {
|
|
t.Skip("skipping integration test")
|
|
}
|
|
|
|
ss := db.InitTestDB(t)
|
|
quotaStore := sqlStore{
|
|
db: ss,
|
|
}
|
|
|
|
t.Run("quota deleted", func(t *testing.T) {
|
|
ctx := quota.FromContext(context.Background(), "a.TargetToSrv{})
|
|
err := quotaStore.DeleteByUser(ctx, 1)
|
|
require.NoError(t, err)
|
|
})
|
|
}
|