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:
Peter Štibraný
2025-09-08 15:49:49 +02:00
committed by GitHub
parent 544872d117
commit 7fd9ab9481
218 changed files with 1130 additions and 1630 deletions
@@ -18,6 +18,7 @@ import (
"github.com/grafana/grafana/pkg/services/tag/tagimpl"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/tests/testsuite"
"github.com/grafana/grafana/pkg/util/testutil"
)
// run tests with cleanup
@@ -26,9 +27,8 @@ func TestMain(m *testing.M) {
}
func TestIntegrationDashboardFolderStore(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
var sqlStore db.DB
var cfg *setting.Cfg
var dashboardStore dashboards.Store
@@ -116,9 +116,7 @@ func insertTestDashboard(t *testing.T, dashboardStore dashboards.Store, title st
}
func TestIntegrationGetDashFolderStore(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
db, cfg := sqlstore.InitTestDB(t)
folderStore := ProvideStore(db)
@@ -43,6 +43,7 @@ import (
"github.com/grafana/grafana/pkg/storage/legacysql/dualwrite"
"github.com/grafana/grafana/pkg/storage/unified/resource"
"github.com/grafana/grafana/pkg/storage/unified/resourcepb"
"github.com/grafana/grafana/pkg/util/testutil"
)
type rcp struct {
@@ -74,9 +75,7 @@ func compareFoldersNormalizeTime(t *testing.T, expected, actual *folder.Folder)
}
func TestIntegrationFolderServiceViaUnifiedStorage(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
m := map[string]folderv1.Folder{}
@@ -846,9 +845,8 @@ func TestGetFoldersFromApiServer(t *testing.T) {
}
func TestIntegrationDeleteFoldersFromApiServer(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
fakeK8sClient := new(client.MockK8sHandler)
fakeK8sClient.On("GetNamespace", mock.Anything, mock.Anything).Return("default")
dashboardK8sclient := new(client.MockK8sHandler)
@@ -27,6 +27,7 @@ import (
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util"
"github.com/grafana/grafana/pkg/util/testutil"
)
var folderTitle string = "folder1"
@@ -34,9 +35,7 @@ var folderDsc string = "folder desc"
var usr = &user.SignedInUser{UserID: 1, OrgID: orgID, Permissions: map[int64]map[string][]string{orgID: {dashboards.ActionFoldersCreate: {dashboards.ScopeFoldersProvider.GetResourceScopeUID(folder.GeneralFolderUID)}}}}
func TestIntegrationCreate(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
db, cfg := sqlstore.InitTestDB(t)
folderStore := ProvideStore(db)
@@ -166,9 +165,7 @@ func TestIntegrationCreate(t *testing.T) {
}
func TestIntegrationDelete(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
db, cfg := sqlstore.InitTestDB(t)
folderStore := ProvideStore(db)
@@ -213,9 +210,7 @@ func TestIntegrationDelete(t *testing.T) {
}
func TestIntegrationUpdate(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
db, cfg := sqlstore.InitTestDB(t)
folderStore := ProvideStore(db)
@@ -388,9 +383,7 @@ func TestIntegrationUpdate(t *testing.T) {
}
func TestIntegrationGet(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
db, cfg := sqlstore.InitTestDB(t)
folderStore := ProvideStore(db)
@@ -523,9 +516,7 @@ func TestIntegrationGet(t *testing.T) {
}
func TestIntegrationGetParents(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
db, cfg := sqlstore.InitTestDB(t)
folderStore := ProvideStore(db)
@@ -591,9 +582,7 @@ func TestIntegrationGetParents(t *testing.T) {
}
func TestIntegrationGetChildren(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
db, cfg := sqlstore.InitTestDB(t)
folderStore := ProvideStore(db)
@@ -826,9 +815,7 @@ func TestIntegrationGetChildren(t *testing.T) {
}
func TestIntegrationGetHeight(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
db, cfg := sqlstore.InitTestDB(t)
folderStore := ProvideStore(db)
@@ -858,9 +845,7 @@ func TestIntegrationGetHeight(t *testing.T) {
}
func TestIntegrationGetFolders(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
foldersNum := 10
db, cfg := sqlstore.InitTestDB(t)