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
+3 -3
View File
@@ -54,6 +54,7 @@ import (
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/services/user/usertest"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util/testutil"
"github.com/grafana/grafana/pkg/web"
"github.com/grafana/grafana/pkg/web/webtest"
)
@@ -406,9 +407,8 @@ func TestHTTPServer_GetDashboardVersions_AccessControl(t *testing.T) {
}
func TestIntegrationDashboardAPIEndpoint(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
t.Run("Given two dashboards with the same title in different folders", func(t *testing.T) {
dashOne := dashboards.NewDashboard("dash")
dashOne.ID = 2
+9 -12
View File
@@ -41,6 +41,7 @@ import (
"github.com/grafana/grafana/pkg/services/updatemanager"
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util/testutil"
"github.com/grafana/grafana/pkg/web"
)
@@ -114,9 +115,8 @@ func setupTestEnvironment(t *testing.T, cfg *setting.Cfg, features featuremgmt.F
}
func TestIntegrationHTTPServer_GetFrontendSettings_hideVersionAnonymous(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
type buildInfo struct {
Version string `json:"version"`
Commit string `json:"commit"`
@@ -186,9 +186,8 @@ func TestIntegrationHTTPServer_GetFrontendSettings_hideVersionAnonymous(t *testi
}
func TestIntegrationHTTPServer_GetFrontendSettings_pluginsCDNBaseURL(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
type settings struct {
PluginsCDNBaseURL string `json:"pluginsCDNBaseURL"`
}
@@ -239,9 +238,8 @@ func TestIntegrationHTTPServer_GetFrontendSettings_pluginsCDNBaseURL(t *testing.
}
func TestIntegrationHTTPServer_GetFrontendSettings_apps(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
type settings struct {
Apps map[string]*plugins.AppDTO `json:"apps"`
}
@@ -472,9 +470,8 @@ func newAppSettings(id string, enabled bool) map[string]*pluginsettings.DTO {
}
func TestIntegrationHTTPServer_GetFrontendSettings_translations(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
type settings struct {
Datasources map[string]plugins.DataSourceDTO `json:"datasources"`
Panels map[string]*plugins.PanelDTO `json:"panels"`
+3 -3
View File
@@ -37,6 +37,7 @@ import (
"github.com/grafana/grafana/pkg/services/user/userimpl"
"github.com/grafana/grafana/pkg/services/user/usertest"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util/testutil"
"github.com/grafana/grafana/pkg/web/webtest"
)
@@ -68,9 +69,8 @@ func setUpGetOrgUsersDB(t *testing.T, sqlStore db.DB, cfg *setting.Cfg) {
}
func TestIntegrationOrgUsersAPIEndpoint_userLoggedIn(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
hs := setupSimpleHTTPServer(featuremgmt.WithFeatures())
settings := hs.Cfg
+3 -3
View File
@@ -38,13 +38,13 @@ import (
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/tsdb/cloudwatch"
testdatasource "github.com/grafana/grafana/pkg/tsdb/grafana-testdata-datasource"
"github.com/grafana/grafana/pkg/util/testutil"
"github.com/grafana/grafana/pkg/web/webtest"
)
func TestIntegrationCallResource(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
staticRootPath, err := filepath.Abs("../../public/")
require.NoError(t, err)
+3 -3
View File
@@ -53,6 +53,7 @@ import (
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/tests/testsuite"
"github.com/grafana/grafana/pkg/util/testutil"
"github.com/grafana/grafana/pkg/web"
)
@@ -61,9 +62,8 @@ func TestMain(m *testing.M) {
}
func TestIntegrationDataSourceProxy_routeRule(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
cfg := &setting.Cfg{}
t.Run("Plugin with routes", func(t *testing.T) {
+9 -12
View File
@@ -52,15 +52,15 @@ import (
"github.com/grafana/grafana/pkg/services/user/userimpl"
"github.com/grafana/grafana/pkg/services/user/usertest"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util/testutil"
"github.com/grafana/grafana/pkg/web/webtest"
)
const newEmail = "newemail@localhost"
func TestIntegrationUserAPIEndpoint_userLoggedIn(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
settings := setting.NewCfg()
sqlStore := db.InitTestDB(t, sqlstore.InitTestDBOpt{Cfg: settings})
hs := &HTTPServer{
@@ -408,9 +408,8 @@ func Test_GetUserByID(t *testing.T) {
}
func TestIntegrationHTTPServer_UpdateUser(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
settings := setting.NewCfg()
sqlStore := db.InitTestDB(t)
@@ -485,9 +484,8 @@ func setupUpdateEmailTests(t *testing.T, cfg *setting.Cfg) (*user.User, *HTTPSer
}
func TestIntegrationUser_UpdateEmail(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
cases := []struct {
Name string
Field user.UpdateEmailActionType
@@ -1163,9 +1161,8 @@ func updateUserScenario(t *testing.T, ctx updateUserContext, hs *HTTPServer) {
}
func TestIntegrationHTTPServer_UpdateSignedInUser(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
settings := setting.NewCfg()
sqlStore := db.InitTestDB(t)