Replace check for integration tests. (#110707)
* Replace check for integration tests. * Revert changes in pkg/tsdb/mysql packages. * Fix formatting of few tests.
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -61,9 +62,8 @@ func TestBatching(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationBulkOps(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
db, _ := InitTestDB(t)
|
||||
err := db.engine.Sync(new(bulkTestItem))
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
type databaseConfigTest struct {
|
||||
@@ -105,9 +106,8 @@ var databaseConfigTestCases = []databaseConfigTest{
|
||||
}
|
||||
|
||||
func TestIntegrationSQLConnectionString(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
for _, testCase := range databaseConfigTestCases {
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
cfg := makeDatabaseTestConfig(t, testCase)
|
||||
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
. "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/sqlutil"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestMigrations(t *testing.T) {
|
||||
@@ -72,9 +73,7 @@ func TestMigrations(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationMigrationLock(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
dbType := sqlutil.GetTestDBType()
|
||||
// skip for SQLite since there is no database locking (only migrator locking)
|
||||
|
||||
@@ -12,12 +12,12 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestIntegrationServiceAccountMigration(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
// Run initial migration to have a working DB
|
||||
x := setupTestDB(t)
|
||||
|
||||
@@ -287,9 +287,8 @@ func TestIntegrationServiceAccountMigration(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationServiceAccountDedupOrgMigration(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
// Run initial migration to have a working DB
|
||||
x := setupTestDB(t)
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/tag/tagimpl"
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
@@ -34,9 +35,7 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegration_DashboardPermissionFilter(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
type testCase struct {
|
||||
desc string
|
||||
@@ -203,9 +202,7 @@ func TestIntegration_DashboardPermissionFilter(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegration_DashboardPermissionFilter_WithSelfContainedPermissions(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
type testCase struct {
|
||||
desc string
|
||||
@@ -375,9 +372,8 @@ func TestIntegration_DashboardPermissionFilter_WithSelfContainedPermissions(t *t
|
||||
}
|
||||
|
||||
func TestIntegration_DashboardNestedPermissionFilter(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
testCases := []struct {
|
||||
desc string
|
||||
queryType string
|
||||
@@ -469,9 +465,8 @@ func TestIntegration_DashboardNestedPermissionFilter(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegration_DashboardNestedPermissionFilter_WithSelfContainedPermissions(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
testCases := []struct {
|
||||
desc string
|
||||
queryType string
|
||||
@@ -568,9 +563,8 @@ func TestIntegration_DashboardNestedPermissionFilter_WithSelfContainedPermission
|
||||
}
|
||||
|
||||
func TestIntegration_DashboardNestedPermissionFilter_WithActionSets(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
testCases := []struct {
|
||||
desc string
|
||||
queryType string
|
||||
|
||||
@@ -4,13 +4,13 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/searchstore"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestIntegrationFolderUIDFilter(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
testCases := []struct {
|
||||
description string
|
||||
uids []string
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -32,9 +33,8 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegrationBuilder_EqualResults_Basic(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
user := &user.SignedInUser{
|
||||
UserID: 1,
|
||||
OrgID: 1,
|
||||
@@ -79,9 +79,8 @@ func TestIntegrationBuilder_EqualResults_Basic(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationBuilder_Pagination(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
user := &user.SignedInUser{
|
||||
UserID: 1,
|
||||
OrgID: 1,
|
||||
@@ -129,9 +128,8 @@ func TestIntegrationBuilder_Pagination(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationBuilder_RBAC(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
testsCases := []struct {
|
||||
desc string
|
||||
userPermissions []accesscontrol.Permission
|
||||
|
||||
@@ -10,12 +10,12 @@ import (
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
||||
"github.com/grafana/grafana/pkg/util/sqlite"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestIntegration_RetryingDisabled(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
store, _ := InitTestDB(t)
|
||||
retryErrors := getRetryErrors(t, store)
|
||||
|
||||
@@ -64,9 +64,8 @@ func TestIntegration_RetryingDisabled(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegration_RetryingOnFailures(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
store, _ := InitTestDB(t)
|
||||
retryErrors := getRetryErrors(t, store)
|
||||
store.dbCfg.QueryRetries = 5
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/featuremgmt"
|
||||
"github.com/grafana/grafana/pkg/services/org"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
@@ -24,9 +25,8 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegrationIsUniqueConstraintViolation(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
store, _ := InitTestDB(t)
|
||||
|
||||
testCases := []struct {
|
||||
|
||||
@@ -12,15 +12,14 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/org"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
"github.com/grafana/grafana/pkg/util/xorm"
|
||||
)
|
||||
|
||||
// Ensure that we can get any connection at all.
|
||||
// If this test fails, it may be sensible to ignore a lot of other test failures as they may be rooted in this.
|
||||
func TestIntegrationTempDatabaseConnect(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore := sqlstore.NewTestStore(t, sqlstore.WithoutMigrator())
|
||||
err := sqlStore.WithDbSession(context.Background(), func(sess *sqlstore.DBSession) error {
|
||||
@@ -34,17 +33,13 @@ func TestIntegrationTempDatabaseConnect(t *testing.T) {
|
||||
// If this test fails, it may be sensible to ignore a lot of other test failures as they may be rooted in this.
|
||||
// This only applies OSS migrations, with no feature flags.
|
||||
func TestIntegrationTempDatabaseOSSMigrate(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
_ = sqlstore.NewTestStore(t, sqlstore.WithOSSMigrations())
|
||||
}
|
||||
|
||||
func TestIntegrationUniqueConstraintViolation(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
testCases := []struct {
|
||||
desc string
|
||||
@@ -93,9 +88,7 @@ func TestIntegrationUniqueConstraintViolation(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationTruncateDatabase(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
migrator := &truncateDatabaseSetup{}
|
||||
store := sqlstore.NewTestStore(t, sqlstore.WithMigrator(migrator), sqlstore.WithTruncation())
|
||||
|
||||
@@ -5,14 +5,14 @@ import (
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestIntegrationReuseSessionWithTransaction(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
ss, _ := InitTestDB(t)
|
||||
|
||||
t.Run("top level transaction", func(t *testing.T) {
|
||||
@@ -69,9 +69,7 @@ func TestIntegrationReuseSessionWithTransaction(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationPublishAfterCommitWithNestedTransactions(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
ss, _ := InitTestDB(t)
|
||||
ctx := context.Background()
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -11,9 +12,8 @@ import (
|
||||
// admin user: getOrCreateOrg was unable to find the existing org.
|
||||
// https://github.com/grafana/grafana/issues/71781
|
||||
func TestIntegrationGetOrCreateOrg(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("Skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
ss, _ := InitTestDB(t)
|
||||
|
||||
err := ss.WithDbSession(context.Background(), func(sess *DBSession) error {
|
||||
|
||||
Reference in New Issue
Block a user