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
@@ -10,6 +10,7 @@ import (
"github.com/grafana/grafana/pkg/infra/db"
"github.com/grafana/grafana/pkg/tests/testsuite"
"github.com/grafana/grafana/pkg/util/testutil"
)
func TestMain(m *testing.M) {
@@ -17,9 +18,8 @@ func TestMain(m *testing.M) {
}
func TestIntegrationAnonStore_DeleteDevicesOlderThan(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
store := db.InitTestDB(t)
anonDBStore := ProvideAnonDBStore(store, 0)
const keepFor = time.Hour * 24 * 61
@@ -57,9 +57,8 @@ func TestIntegrationAnonStore_DeleteDevicesOlderThan(t *testing.T) {
}
func TestIntegrationBeyondDeviceLimit(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
store := db.InitTestDB(t)
anonDBStore := ProvideAnonDBStore(store, 1)
@@ -81,9 +80,8 @@ func TestIntegrationBeyondDeviceLimit(t *testing.T) {
}
func TestIntegrationAnonStore_DeleteDevice(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
store := db.InitTestDB(t)
anonDBStore := ProvideAnonDBStore(store, 0)
const keepFor = time.Hour * 24 * 61
+7 -12
View File
@@ -21,6 +21,7 @@ import (
"github.com/grafana/grafana/pkg/services/org/orgtest"
"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) {
@@ -28,9 +29,7 @@ func TestMain(m *testing.M) {
}
func TestIntegrationDeviceService_tag(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
type tagReq struct {
httpReq *http.Request
@@ -208,9 +207,8 @@ func TestIntegrationDeviceService_tag(t *testing.T) {
// Ensure that the local cache prevents request from being tagged
func TestIntegrationAnonDeviceService_localCacheSafety(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
store := db.InitTestDB(t)
anonService := ProvideAnonymousDeviceService(&usagestats.UsageStatsMock{},
&authntest.FakeService{}, store, setting.NewCfg(), orgtest.NewOrgServiceFake(), nil, actest.FakeAccessControl{}, &routing.RouteRegisterImpl{}, validator.FakeAnonUserLimitValidator{})
@@ -243,9 +241,7 @@ func TestIntegrationAnonDeviceService_localCacheSafety(t *testing.T) {
}
func TestIntegrationDeviceService_SearchDevice(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
fixedTime := time.Date(2024, 1, 1, 12, 0, 0, 0, time.UTC) // Fixed timestamp for testing
@@ -356,9 +352,8 @@ func TestIntegrationDeviceService_SearchDevice(t *testing.T) {
}
func TestIntegrationAnonDeviceService_DeviceLimitWithCache(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
// Setup test environment
store := db.InitTestDB(t)
cfg := setting.NewCfg()