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
@@ -40,6 +40,7 @@ import (
secretsmng "github.com/grafana/grafana/pkg/services/secrets/manager"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/tests/testsuite"
"github.com/grafana/grafana/pkg/util/testutil"
)
func TestMain(m *testing.M) {
@@ -63,9 +64,8 @@ func (d *dataSourceMockRetriever) GetDataSource(ctx context.Context, query *data
}
func TestIntegrationService_AddDataSource(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
t.Run("should not fail if the plugin is not installed", func(t *testing.T) {
dsService := initDSService(t)
dsService.pluginStore = &pluginstore.FakePluginStore{
@@ -357,9 +357,8 @@ func TestService_getAvailableName(t *testing.T) {
}
func TestIntegrationService_UpdateDataSource(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
t.Run("should return not found error if datasource not found", func(t *testing.T) {
dsService := initDSService(t)
@@ -810,9 +809,8 @@ func TestIntegrationService_UpdateDataSource(t *testing.T) {
}
func TestIntegrationService_DeleteDataSource(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
t.Run("should not return an error if data source doesn't exist", func(t *testing.T) {
sqlStore := db.InitTestDB(t)
secretsService := secretsmng.SetupTestService(t, fakes.NewFakeSecretsStore())
@@ -1090,9 +1088,8 @@ func TestService_awsServiceNamespace(t *testing.T) {
//nolint:goconst
func TestIntegrationService_GetHttpTransport(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
cfg := &setting.Cfg{}
t.Run("Should use cached proxy", func(t *testing.T) {
@@ -1505,9 +1502,8 @@ func TestIntegrationService_GetHttpTransport(t *testing.T) {
}
func TestIntegrationService_getProxySettings(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
sqlStore := db.InitTestDB(t)
secretsService := secretsmng.SetupTestService(t, fakes.NewFakeSecretsStore())
secretsStore := secretskvs.NewSQLSecretsKVStore(sqlStore, secretsService, log.New("test.logger"))
@@ -1586,9 +1582,8 @@ func TestIntegrationService_getProxySettings(t *testing.T) {
}
func TestIntegrationService_getTimeout(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
cfg := &setting.Cfg{}
originalTimeout := sdkhttpclient.DefaultTimeoutOptions.Timeout
sdkhttpclient.DefaultTimeoutOptions.Timeout = time.Minute
@@ -1623,9 +1618,8 @@ func TestIntegrationService_getTimeout(t *testing.T) {
}
func TestIntegrationService_GetDecryptedValues(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
t.Run("should migrate and retrieve values from secure json data", func(t *testing.T) {
ds := &datasources.DataSource{
ID: 1,
@@ -1685,9 +1679,8 @@ func TestIntegrationService_GetDecryptedValues(t *testing.T) {
}
func TestIntegrationDataSource_CustomHeaders(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
sqlStore := db.InitTestDB(t)
secretsService := secretsmng.SetupTestService(t, fakes.NewFakeSecretsStore())
secretsStore := secretskvs.NewSQLSecretsKVStore(sqlStore, secretsService, log.New("test.logger"))
@@ -13,12 +13,12 @@ import (
"github.com/grafana/grafana/pkg/infra/db"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/services/datasources"
"github.com/grafana/grafana/pkg/util/testutil"
)
func TestIntegrationDataAccess(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
defaultAddDatasourceCommand := datasources.AddDataSourceCommand{
OrgID: 10,
Name: "nisse",