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:
@@ -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
|
||||
|
||||
@@ -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"`
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
@@ -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)
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
@@ -21,9 +22,7 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegrationPasswordMigrationCommand(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
// setup datasources with password, basic_auth and none
|
||||
store := db.InitTestDB(t)
|
||||
|
||||
@@ -8,13 +8,12 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/db"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestIntegrationUnifiedStorageCommand(t *testing.T) {
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
// setup datasources with password, basic_auth and none
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
|
||||
store := db.InitTestDB(t)
|
||||
err := store.WithDbSession(context.Background(), func(sess *db.Session) error {
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/infra/db"
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -178,10 +179,8 @@ func TestIntegrationFsStorage(t *testing.T) {
|
||||
if true {
|
||||
t.Skip("flakey tests - skipping")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
//skipTest := true
|
||||
emptyContents := make([]byte, 0)
|
||||
pngImage, _ := base64.StdEncoding.DecodeString(pngImageBase64)
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/infra/db"
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
@@ -42,9 +43,8 @@ func (t *TestCase) Value() string {
|
||||
}
|
||||
|
||||
func TestIntegrationKVStore(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
kv := createTestableKVStore(t)
|
||||
|
||||
ctx := context.Background()
|
||||
@@ -249,9 +249,8 @@ func TestIntegrationKVStore(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationGetItems(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
kv := createTestableKVStore(t)
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
@@ -9,12 +9,12 @@ import (
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/db"
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestIntegrationDatabaseStorageGarbageCollection(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlstore := db.InitTestDB(t)
|
||||
|
||||
db := &databaseCache{
|
||||
@@ -62,9 +62,8 @@ func TestIntegrationDatabaseStorageGarbageCollection(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationSecondSet(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
var err error
|
||||
sqlstore := db.InitTestDB(t)
|
||||
|
||||
|
||||
@@ -5,12 +5,11 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestIntegrationMemcachedCacheStorage(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
u, ok := os.LookupEnv("MEMCACHED_HOSTS")
|
||||
if !ok || u == "" {
|
||||
|
||||
@@ -8,12 +8,11 @@ import (
|
||||
|
||||
"github.com/go-redis/redis/v8"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestIntegrationRedisCacheStorage(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
u, ok := os.LookupEnv("REDIS_URL")
|
||||
if !ok || u == "" {
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore"
|
||||
"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) {
|
||||
@@ -34,9 +35,8 @@ func createTestClient(t *testing.T, opts *setting.RemoteCacheSettings, sqlstore
|
||||
}
|
||||
|
||||
func TestIntegrationCachedBasedOnConfig(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
db, cfg := sqlstore.InitTestDB(t)
|
||||
err := cfg.Load(setting.CommandLineArgs{
|
||||
HomePath: "../../../",
|
||||
|
||||
@@ -6,13 +6,13 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestIntegrationServerLock_LockAndExecute(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sl := createTestableServerLock(t)
|
||||
|
||||
counter := 0
|
||||
@@ -38,9 +38,8 @@ func TestIntegrationServerLock_LockAndExecute(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationServerLock_LockExecuteAndRelease(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sl := createTestableServerLock(t)
|
||||
|
||||
counter := 0
|
||||
@@ -65,9 +64,8 @@ func TestIntegrationServerLock_LockExecuteAndRelease(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationServerLock_LockExecuteAndReleaseWithRetries(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sl := createTestableServerLock(t)
|
||||
|
||||
retries := 0
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/infra/tracing"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
@@ -31,9 +32,8 @@ func createTestableServerLock(t *testing.T) *ServerLockService {
|
||||
}
|
||||
|
||||
func TestIntegrationServerLock(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sl := createTestableServerLock(t)
|
||||
operationUID := "test-operation"
|
||||
|
||||
@@ -70,9 +70,8 @@ func TestIntegrationServerLock(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationLockAndRelease(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
operationUID := "test-operation-release"
|
||||
|
||||
t.Run("create lock and then release it", func(t *testing.T) {
|
||||
|
||||
@@ -27,6 +27,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/supportbundles/supportbundlestest"
|
||||
"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) {
|
||||
@@ -156,9 +157,8 @@ func TestMetrics(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationGetUsageReport_IncludesMetrics(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore := dbtest.NewFakeDB()
|
||||
uss := createService(t, sqlStore, true)
|
||||
metricName := "stats.test_metric.count"
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
// run tests with cleanup
|
||||
@@ -28,9 +29,8 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegrationConcurrentUsersMetrics(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore, cfg := db.InitTestDBWithCfg(t)
|
||||
statsService := statsimpl.ProvideService(&setting.Cfg{}, sqlStore, &dashboards.FakeDashboardService{}, &foldertest.FakeService{}, &orgtest.FakeOrgService{}, featuremgmt.WithFeatures())
|
||||
s := createService(t, cfg, sqlStore, statsService)
|
||||
@@ -49,9 +49,8 @@ func TestIntegrationConcurrentUsersMetrics(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationConcurrentUsersStats(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore, cfg := db.InitTestDBWithCfg(t)
|
||||
statsService := statsimpl.ProvideService(&setting.Cfg{}, sqlStore, &dashboards.FakeDashboardService{}, &foldertest.FakeService{}, &orgtest.FakeOrgService{}, featuremgmt.WithFeatures())
|
||||
s := createService(t, cfg, sqlStore, statsService)
|
||||
|
||||
@@ -22,6 +22,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/supportbundles/supportbundlestest"
|
||||
"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) {
|
||||
@@ -29,9 +30,8 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegrationSocialService_ProvideService(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
setup func(t *testing.T)
|
||||
@@ -128,9 +128,8 @@ func TestIntegrationSocialService_ProvideService(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationSocialService_ProvideService_GrafanaComGrafanaNet(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
rawIniContent string
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/plugins"
|
||||
"github.com/grafana/grafana/pkg/plugins/backendplugin"
|
||||
"github.com/grafana/grafana/pkg/plugins/manager/fakes"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -157,9 +158,8 @@ func TestCheckHealth(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationCallResource(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
registry := fakes.NewFakePluginRegistry()
|
||||
p := &plugins.Plugin{
|
||||
JSONData: plugins.JSONData{
|
||||
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/accesscontrol"
|
||||
"github.com/grafana/grafana/pkg/storage/legacysql"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
@@ -119,9 +120,7 @@ func setupTestRoles(t *testing.T, store db.DB) {
|
||||
}
|
||||
|
||||
func TestIntegration_ResourcePermSqlBackend_getResourcePermission(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
backend := setupBackend(t)
|
||||
sql, err := backend.dbProvider(context.Background())
|
||||
@@ -270,9 +269,7 @@ func TestResourcePermSqlBackend_deleteResourcePermission(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegration_ResourcePermSqlBackend_CreateResourcePermission(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
store := db.InitTestDB(t)
|
||||
|
||||
|
||||
@@ -15,12 +15,11 @@ import (
|
||||
"github.com/grafana/grafana/pkg/storage/legacysql"
|
||||
"github.com/grafana/grafana/pkg/storage/unified/resource"
|
||||
"github.com/grafana/grafana/pkg/storage/unified/resourcepb"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestIntegration_ResourcePermSqlBackend_ReadResource(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
backend := setupBackend(t)
|
||||
sql, err := backend.dbProvider(context.Background())
|
||||
|
||||
@@ -24,6 +24,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/storage/secret/migrator"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
@@ -437,9 +438,7 @@ func TestEncryptionService_Decrypt(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegration_SecretsService(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
ctx := context.Background()
|
||||
someData := []byte(`some-data`)
|
||||
|
||||
@@ -12,12 +12,12 @@ import (
|
||||
secretv1beta1 "github.com/grafana/grafana/apps/secret/pkg/apis/secret/v1beta1"
|
||||
"github.com/grafana/grafana/pkg/registry/apis/secret/testutils"
|
||||
"github.com/grafana/grafana/pkg/registry/apis/secret/validator"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestIntegration_SecureValueClient_CRUD(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
setup := testutils.Setup(t)
|
||||
|
||||
validator := validator.ProvideSecureValueValidator()
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/infra/db"
|
||||
"github.com/grafana/grafana/pkg/modules"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -19,9 +20,8 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegrationWillRunInstrumentationServerWhenTargetHasNoHttpServer(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
if db.IsTestDbSQLite() {
|
||||
t.Skip("sqlite is not supported by the storage server target")
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/storage/unified/resourcepb"
|
||||
"github.com/grafana/grafana/pkg/storage/unified/search"
|
||||
"github.com/grafana/grafana/pkg/storage/unified/sql"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.opentelemetry.io/otel/trace/noop"
|
||||
@@ -42,9 +43,7 @@ var (
|
||||
|
||||
//nolint:gocyclo
|
||||
func TestIntegrationDistributor(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
dbType := sqlutil.GetTestDBType()
|
||||
if dbType != "mysql" {
|
||||
|
||||
@@ -24,6 +24,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"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
@@ -50,9 +51,8 @@ func setupTestEnv(t testing.TB) *Service {
|
||||
}
|
||||
|
||||
func TestIntegrationUsageMetrics(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
expectedValue int
|
||||
@@ -84,9 +84,8 @@ func TestIntegrationUsageMetrics(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationService_DeclareFixedRoles(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
registrations []accesscontrol.RoleRegistration
|
||||
@@ -172,9 +171,8 @@ func TestIntegrationService_DeclareFixedRoles(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationService_DeclarePluginRoles(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
pluginID string
|
||||
@@ -288,9 +286,8 @@ func TestIntegrationService_DeclarePluginRoles(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationService_RegisterFixedRoles(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
token licensing.Licensing
|
||||
@@ -393,9 +390,8 @@ func TestIntegrationService_RegisterFixedRoles(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationService_SearchUsersPermissions(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
searchOption := accesscontrol.SearchOptions{ActionPrefix: "teams"}
|
||||
ctx := context.Background()
|
||||
listAllPerms := map[string][]string{accesscontrol.ActionUsersPermissionsRead: {"users:*"}}
|
||||
@@ -617,9 +613,8 @@ func TestIntegrationService_SearchUsersPermissions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationService_SearchUserPermissions(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
ctx := context.Background()
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -851,9 +846,8 @@ func TestIntegrationService_SearchUserPermissions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationService_SaveExternalServiceRole(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
type run struct {
|
||||
cmd accesscontrol.SaveExternalServiceRoleCommand
|
||||
wantErr bool
|
||||
@@ -941,9 +935,8 @@ func TestIntegrationService_SaveExternalServiceRole(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationService_DeleteExternalServiceRole(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
initCmd *accesscontrol.SaveExternalServiceRoleCommand
|
||||
@@ -998,9 +991,8 @@ func TestIntegrationService_DeleteExternalServiceRole(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationService_GetRoleByName(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
t.Parallel()
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
@@ -25,6 +25,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
"github.com/grafana/grafana/pkg/services/user/userimpl"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
// run tests with cleanup
|
||||
@@ -45,9 +46,8 @@ type getUserPermissionsTestCase struct {
|
||||
}
|
||||
|
||||
func TestIntegrationAccessControlStore_GetUserPermissions(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
tests := []getUserPermissionsTestCase{
|
||||
{
|
||||
desc: "should successfully get user, team and builtin permissions",
|
||||
@@ -162,9 +162,8 @@ type getTeamsPermissionsTestCase struct {
|
||||
}
|
||||
|
||||
func TestIntegrationAccessControlStore_GetTeamsPermissions(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
tests := []getTeamsPermissionsTestCase{
|
||||
{
|
||||
desc: "should successfully get team permissions",
|
||||
@@ -237,9 +236,8 @@ func TestIntegrationAccessControlStore_GetTeamsPermissions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationAccessControlStore_DeleteUserPermissions(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
t.Run("expect permissions in all orgs to be deleted", func(t *testing.T) {
|
||||
store, permissionsStore, usrSvc, teamSvc, _, sql := setupTestEnv(t)
|
||||
user, _ := createUserAndTeam(t, sql, usrSvc, teamSvc, 1)
|
||||
@@ -322,9 +320,8 @@ func TestIntegrationAccessControlStore_DeleteUserPermissions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationAccessControlStore_DeleteTeamPermissions(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
t.Run("expect permissions related to team to be deleted", func(t *testing.T) {
|
||||
store, permissionsStore, usrSvc, teamSvc, _, sql := setupTestEnv(t)
|
||||
user, team := createUserAndTeam(t, sql, usrSvc, teamSvc, 1)
|
||||
@@ -505,9 +502,8 @@ func setupTestEnv(t testing.TB) (*database.AccessControlStore, rs.Store, user.Se
|
||||
}
|
||||
|
||||
func TestIntegrationAccessControlStore_SearchUsersPermissions(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
ctx := context.Background()
|
||||
readTeamPerm := func(teamID string) rs.SetResourcePermissionCommand {
|
||||
return rs.SetResourcePermissionCommand{
|
||||
@@ -783,9 +779,8 @@ func TestIntegrationAccessControlStore_SearchUsersPermissions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationAccessControlStore_GetUsersBasicRoles(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
ctx := context.Background()
|
||||
tests := []struct {
|
||||
name string
|
||||
|
||||
@@ -9,13 +9,13 @@ import (
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/db"
|
||||
"github.com/grafana/grafana/pkg/services/accesscontrol"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestIntegrationAccessControlStore_SaveExternalServiceRole(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
type run struct {
|
||||
cmd accesscontrol.SaveExternalServiceRoleCommand
|
||||
wantErr bool
|
||||
@@ -156,9 +156,8 @@ func TestIntegrationAccessControlStore_SaveExternalServiceRole(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationAccessControlStore_DeleteExternalServiceRole(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
extID := "app1"
|
||||
tests := []struct {
|
||||
name string
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
dsService "github.com/grafana/grafana/pkg/services/datasources/service"
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
type filterDatasourcesTestCase struct {
|
||||
@@ -33,9 +34,8 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegrationFilter_Datasources(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
tests := []filterDatasourcesTestCase{
|
||||
{
|
||||
desc: "expect all data sources to be returned",
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
ac "github.com/grafana/grafana/pkg/services/accesscontrol"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
@@ -46,9 +47,8 @@ func batchInsertPermissions(cnt int, sqlStore db.DB) error {
|
||||
// TestIntegrationMigrateScopeSplit tests the scope split migration
|
||||
// also tests the scope split truncation logic
|
||||
func TestIntegrationMigrateScopeSplitTruncation(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore := db.InitTestDB(t)
|
||||
logger := log.New("accesscontrol.migrator.test")
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
|
||||
"github.com/grafana/grafana/pkg/services/team"
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
"github.com/grafana/grafana/pkg/web"
|
||||
)
|
||||
|
||||
@@ -31,9 +32,8 @@ type getDescriptionTestCase struct {
|
||||
}
|
||||
|
||||
func TestIntegrationApi_getDescription(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
tests := []getDescriptionTestCase{
|
||||
{
|
||||
desc: "should return description",
|
||||
@@ -139,9 +139,8 @@ type getPermissionsTestCase struct {
|
||||
}
|
||||
|
||||
func TestIntegrationApi_getPermissions(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
tests := []getPermissionsTestCase{
|
||||
{
|
||||
desc: "expect permissions for resource with id 1",
|
||||
@@ -188,9 +187,8 @@ type setBuiltinPermissionTestCase struct {
|
||||
}
|
||||
|
||||
func TestIntegrationApi_setBuiltinRolePermission(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
tests := []setBuiltinPermissionTestCase{
|
||||
{
|
||||
desc: "should set Edit permission for Viewer",
|
||||
@@ -270,9 +268,8 @@ type setTeamPermissionTestCase struct {
|
||||
}
|
||||
|
||||
func TestIntegrationApi_setTeamPermission(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
tests := []setTeamPermissionTestCase{
|
||||
{
|
||||
desc: "should set Edit permission for team 1",
|
||||
@@ -380,9 +377,8 @@ type setUserPermissionTestCase struct {
|
||||
}
|
||||
|
||||
func TestIntegrationApi_setUserPermission(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
tests := []setUserPermissionTestCase{
|
||||
{
|
||||
desc: "should set Edit permission for user 1",
|
||||
@@ -458,9 +454,8 @@ func TestIntegrationApi_setUserPermission(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationApi_setUserPermissionForTeams(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
type setUserPermissionForTeamsTestCase struct {
|
||||
setUserPermissionTestCase
|
||||
teamCmd *team.CreateTeamCommand
|
||||
|
||||
@@ -24,6 +24,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
"github.com/grafana/grafana/pkg/services/user/userimpl"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
type setUserPermissionTest struct {
|
||||
@@ -32,9 +33,8 @@ type setUserPermissionTest struct {
|
||||
}
|
||||
|
||||
func TestIntegrationService_SetUserPermission(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
tests := []setUserPermissionTest{
|
||||
{
|
||||
desc: "should call hook when updating user permissions",
|
||||
@@ -79,9 +79,8 @@ type setTeamPermissionTest struct {
|
||||
}
|
||||
|
||||
func TestIntegrationService_SetTeamPermission(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
tests := []setTeamPermissionTest{
|
||||
{
|
||||
desc: "should call hook when updating user permissions",
|
||||
@@ -131,9 +130,8 @@ type setBuiltInRolePermissionTest struct {
|
||||
}
|
||||
|
||||
func TestIntegrationService_SetBuiltInRolePermission(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
tests := []setBuiltInRolePermissionTest{
|
||||
{
|
||||
desc: "should call hook when updating user permissions",
|
||||
@@ -176,9 +174,8 @@ type setPermissionsTest struct {
|
||||
}
|
||||
|
||||
func TestIntegrationService_SetPermissions(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
tests := []setPermissionsTest{
|
||||
{
|
||||
desc: "should set all permissions",
|
||||
@@ -248,9 +245,8 @@ func TestIntegrationService_SetPermissions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationService_RegisterActionSets(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
type registerActionSetsTest struct {
|
||||
desc string
|
||||
options Options
|
||||
|
||||
@@ -23,6 +23,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/user/userimpl"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
type setUserResourcePermissionTest struct {
|
||||
@@ -41,9 +42,8 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegrationStore_SetUserResourcePermission(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
tests := []setUserResourcePermissionTest{
|
||||
{
|
||||
desc: "should set resource permission for user",
|
||||
@@ -126,9 +126,8 @@ type setTeamResourcePermissionTest struct {
|
||||
}
|
||||
|
||||
func TestIntegrationStore_SetTeamResourcePermission(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
tests := []setTeamResourcePermissionTest{
|
||||
{
|
||||
desc: "should add new resource permission for team",
|
||||
@@ -214,9 +213,8 @@ type setBuiltInResourcePermissionTest struct {
|
||||
}
|
||||
|
||||
func TestIntegrationStore_SetBuiltInResourcePermission(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
tests := []setBuiltInResourcePermissionTest{
|
||||
{
|
||||
desc: "should add new resource permission for builtin role",
|
||||
@@ -298,9 +296,8 @@ type setResourcePermissionsTest struct {
|
||||
}
|
||||
|
||||
func TestIntegrationStore_SetResourcePermissions(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
tests := []setResourcePermissionsTest{
|
||||
{
|
||||
desc: "should set all permissions provided",
|
||||
@@ -371,9 +368,8 @@ type getResourcePermissionsTest struct {
|
||||
}
|
||||
|
||||
func TestIntegrationStore_GetResourcePermissions(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
tests := []getResourcePermissionsTest{
|
||||
{
|
||||
desc: "should return permissions for resource id",
|
||||
@@ -628,9 +624,7 @@ type orgPermission struct {
|
||||
}
|
||||
|
||||
func TestIntegrationStore_DeleteResourcePermissions(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
type deleteResourcePermissionsTest struct {
|
||||
desc string
|
||||
|
||||
@@ -14,12 +14,11 @@ import (
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/services/annotations"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestIntegrationAnnotationCleanUp(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("Skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
fakeSQL := db.InitTestDB(t)
|
||||
|
||||
@@ -150,9 +149,7 @@ func TestIntegrationAnnotationCleanUp(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationOldAnnotationsAreDeletedFirst(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("Skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
fakeSQL := db.InitTestDB(t)
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
tutil "github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
@@ -41,9 +42,7 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegrationAlertStateHistoryStore(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sql, cfg := db.InitTestDBWithCfg(t)
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
tutil "github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
@@ -31,9 +32,8 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegrationAnnotations(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sql := db.InitTestDB(t)
|
||||
|
||||
cfg := setting.NewCfg()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -4,12 +4,12 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/db"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestIntegrationXORMApiKeyDataAccess(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
testIntegrationApiKeyDataAccess(t, func(ss db.DB) store {
|
||||
return &sqlStore{db: ss}
|
||||
})
|
||||
|
||||
@@ -26,6 +26,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"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
@@ -33,9 +34,8 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegrationUserAuthToken(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
ctx := createTestContext(t)
|
||||
usr := &user.User{ID: int64(10)}
|
||||
|
||||
@@ -790,9 +790,8 @@ func (c *testContext) updateRotatedAt(id, rotatedAt int64) (bool, error) {
|
||||
}
|
||||
|
||||
func TestIntegrationTokenCount(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
ctx := createTestContext(t)
|
||||
user := &user.User{ID: int64(10)}
|
||||
|
||||
@@ -830,9 +829,8 @@ func TestIntegrationTokenCount(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationRevokeAllUserTokens(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
t.Run("should not fail if the external sessions could not be removed", func(t *testing.T) {
|
||||
ctx := createTestContext(t)
|
||||
usr := &user.User{ID: int64(10)}
|
||||
@@ -866,9 +864,8 @@ func TestIntegrationRevokeAllUserTokens(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationRevokeToken(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
t.Run("should not fail if the external sessions could not be removed", func(t *testing.T) {
|
||||
ctx := createTestContext(t)
|
||||
usr := &user.User{ID: int64(10)}
|
||||
@@ -900,9 +897,8 @@ func TestIntegrationRevokeToken(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationBatchRevokeAllUserTokens(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
t.Run("should not fail if the external sessions could not be removed", func(t *testing.T) {
|
||||
ctx := createTestContext(t)
|
||||
userIds := []int64{1, 2, 3}
|
||||
|
||||
@@ -8,13 +8,13 @@ import (
|
||||
"github.com/grafana/grafana/pkg/infra/tracing"
|
||||
"github.com/grafana/grafana/pkg/services/auth"
|
||||
"github.com/grafana/grafana/pkg/services/secrets/fakes"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestIntegrationGetExternalSession(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
t.Run("returns existing external session", func(t *testing.T) {
|
||||
store := setupTest(t)
|
||||
|
||||
@@ -40,9 +40,7 @@ func TestIntegrationGetExternalSession(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationListExternalSessions(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
t.Run("returns external sessions by ID", func(t *testing.T) {
|
||||
store := setupTest(t)
|
||||
@@ -106,9 +104,7 @@ func TestIntegrationListExternalSessions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationDeleteExternalSessionsByUserID(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
t.Run("deletes all external sessions for a given user ID", func(t *testing.T) {
|
||||
store := setupTest(t)
|
||||
@@ -147,9 +143,7 @@ func TestIntegrationDeleteExternalSessionsByUserID(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationDeleteExternalSession(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
t.Run("deletes an existing external session", func(t *testing.T) {
|
||||
store := setupTest(t)
|
||||
@@ -177,9 +171,7 @@ func TestIntegrationDeleteExternalSession(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationBatchDeleteExternalSessionsByUserIDs(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
t.Run("deletes all external sessions for given user IDs", func(t *testing.T) {
|
||||
store := setupTest(t)
|
||||
|
||||
@@ -10,12 +10,11 @@ import (
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/db"
|
||||
"github.com/grafana/grafana/pkg/services/auth"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestIntegrationUserAuthTokenCleanup(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
setup := func() *testContext {
|
||||
ctx := createTestContext(t)
|
||||
@@ -82,9 +81,7 @@ func TestIntegrationUserAuthTokenCleanup(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationOrphanedExternalSessionsCleanup(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
setup := func() *testContext {
|
||||
ctx := createTestContext(t)
|
||||
|
||||
@@ -22,6 +22,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/infra/remotecache"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
type scenarioContext struct {
|
||||
@@ -46,9 +47,8 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegrationVerifyUsingPKIXPublicKeyFile(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
key := rsaKeys[0]
|
||||
unknownKey := rsaKeys[1]
|
||||
|
||||
@@ -84,9 +84,8 @@ func TestIntegrationVerifyUsingPKIXPublicKeyFile(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationVerifyUsingJWKSetFile(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
configure := func(t *testing.T, cfg *setting.Cfg) {
|
||||
t.Helper()
|
||||
|
||||
@@ -126,9 +125,8 @@ func TestIntegrationVerifyUsingJWKSetFile(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationVerifyUsingJWKSetURL(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
t.Run("should refuse to start with non-https URL", func(t *testing.T) {
|
||||
var err error
|
||||
|
||||
@@ -172,9 +170,7 @@ func TestIntegrationVerifyUsingJWKSetURL(t *testing.T) {
|
||||
|
||||
// test that caCert and bearer token files have been read and configured and an error is thrown when the file does not exist or is empty
|
||||
func TestIntegrationCustomRootCAJWKHTTPSClient(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
urlConfigure := func(t *testing.T, cfg *setting.Cfg) {
|
||||
cfg.JWTAuth.JWKSetURL = "https://example.com/.well-known/jwks.json"
|
||||
@@ -241,9 +237,7 @@ func TestIntegrationCustomRootCAJWKHTTPSClient(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationAuthorizationHeaderJWKHTTPSClient(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
urlConfigure := func(t *testing.T, cfg *setting.Cfg) {
|
||||
cfg.JWTAuth.JWKSetURL = "https://example.com/.well-known/jwks.json"
|
||||
@@ -366,9 +360,8 @@ func TestIntegrationAuthorizationHeaderJWKHTTPSClient(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationCachingJWKHTTPResponse(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
jwkCachingScenario(t, "caches the jwk response", func(t *testing.T, sc cachingScenarioContext) {
|
||||
for i := 0; i < 5; i++ {
|
||||
token := sign(t, &jwKeys[0], jwt.Claims{Subject: subject}, nil)
|
||||
@@ -409,9 +402,8 @@ func TestIntegrationCachingJWKHTTPResponse(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationSignatureWithNoneAlgorithm(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
scenario(t, "rejects a token signed with \"none\" algorithm", func(t *testing.T, sc scenarioContext) {
|
||||
token := signNone(t, jwt.Claims{Subject: "foo"})
|
||||
_, err := sc.authJWTSvc.Verify(sc.ctx, token)
|
||||
@@ -420,9 +412,8 @@ func TestIntegrationSignatureWithNoneAlgorithm(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationClaimValidation(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
key := rsaKeys[0]
|
||||
|
||||
scenario(t, "validates iss field for equality", func(t *testing.T, sc scenarioContext) {
|
||||
@@ -583,9 +574,8 @@ func jwkCachingScenario(t *testing.T, desc string, fn cachingScenarioFunc, cbs .
|
||||
}
|
||||
|
||||
func TestIntegrationBase64Paddings(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
key := rsaKeys[0]
|
||||
|
||||
scenario(t, "verifies a token with base64 padding (non compliant rfc7515#section-2 but accepted)", func(t *testing.T, sc scenarioContext) {
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -48,9 +49,7 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegrationServer(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
// Create a test-specific config to avoid migration conflicts
|
||||
cfg := setting.NewCfg()
|
||||
|
||||
@@ -17,14 +17,14 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/tag/tagimpl"
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
var testFeatureToggles = featuremgmt.WithFeatures(featuremgmt.FlagPanelTitleSearch)
|
||||
|
||||
func TestIntegrationDashboardFolderDataAccess(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
t.Run("Testing DB", func(t *testing.T) {
|
||||
var sqlStore db.DB
|
||||
var cfg *setting.Cfg
|
||||
|
||||
@@ -11,12 +11,12 @@ import (
|
||||
"github.com/grafana/grafana/pkg/infra/db"
|
||||
"github.com/grafana/grafana/pkg/services/dashboards"
|
||||
"github.com/grafana/grafana/pkg/services/tag/tagimpl"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestIntegrationDashboardProvisioningTest(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore, cfg := db.InitTestDBWithCfg(t)
|
||||
dashboardStore, err := ProvideDashboardStore(sqlStore, cfg, testFeatureToggles, tagimpl.ProvideService(sqlStore))
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -26,6 +26,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
// run tests with cleanup
|
||||
@@ -34,9 +35,8 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegrationDashboardDataAccess(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
var sqlStore db.DB
|
||||
var cfg *setting.Cfg
|
||||
var savedFolder, savedDash, savedDash2 *dashboards.Dashboard
|
||||
@@ -637,9 +637,8 @@ func TestIntegrationDashboardDataAccess(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationDashboardDataAccessGivenPluginWithImportedDashboards(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore := db.InitTestDB(t)
|
||||
dashboardStore, err := ProvideDashboardStore(sqlStore, &setting.Cfg{}, testFeatureToggles, tagimpl.ProvideService(sqlStore))
|
||||
require.NoError(t, err)
|
||||
@@ -661,9 +660,8 @@ func TestIntegrationDashboardDataAccessGivenPluginWithImportedDashboards(t *test
|
||||
}
|
||||
|
||||
func TestIntegrationDashboard_SortingOptions(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore := db.InitTestDB(t)
|
||||
dashboardStore, err := ProvideDashboardStore(sqlStore, &setting.Cfg{}, testFeatureToggles, tagimpl.ProvideService(sqlStore))
|
||||
require.NoError(t, err)
|
||||
@@ -711,9 +709,8 @@ func TestIntegrationDashboard_SortingOptions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationDashboard_Filter(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore := db.InitTestDB(t)
|
||||
cfg := setting.NewCfg()
|
||||
dashboardStore, err := ProvideDashboardStore(sqlStore, cfg, testFeatureToggles, tagimpl.ProvideService(sqlStore))
|
||||
@@ -810,9 +807,7 @@ func insertTestFolder(t *testing.T, dashboardStore dashboards.Store, sqlStore db
|
||||
}
|
||||
|
||||
func TestIntegrationFindDashboardsByTitle(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore := db.InitTestDB(t)
|
||||
cfg := setting.NewCfg()
|
||||
@@ -928,9 +923,7 @@ func TestIntegrationFindDashboardsByTitle(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationFindDashboardsByFolder(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore, cfg := db.InitTestDBWithCfg(t)
|
||||
features := featuremgmt.WithFeatures(featuremgmt.FlagPanelTitleSearch)
|
||||
@@ -1059,9 +1052,7 @@ func TestIntegrationFindDashboardsByFolder(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationGetDashboardsByLibraryPanelUID(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore, cfg := db.InitTestDBWithCfg(t)
|
||||
dashboardStore, err := ProvideDashboardStore(sqlStore, cfg, testFeatureToggles, tagimpl.ProvideService(sqlStore))
|
||||
|
||||
@@ -48,6 +48,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/storage/unified/resourcepb"
|
||||
"github.com/grafana/grafana/pkg/storage/unified/search"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
@@ -2212,9 +2213,8 @@ func TestCleanUpDashboard(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationK8sDashboardCleanupJob(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
readFromUnified bool
|
||||
|
||||
@@ -19,6 +19,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"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
@@ -26,9 +27,8 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegrationDashboardSnapshotDBAccess(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlstore := db.InitTestDB(t)
|
||||
cfg := setting.NewCfg()
|
||||
dashStore := ProvideStore(sqlstore, cfg)
|
||||
@@ -160,9 +160,8 @@ func TestIntegrationDashboardSnapshotDBAccess(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationDeleteExpiredSnapshots(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlstore := db.InitTestDB(t)
|
||||
dashStore := NewStore(sqlstore)
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
secretsManager "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) {
|
||||
@@ -24,9 +25,8 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegrationDashboardSnapshotsService(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore := db.InitTestDB(t)
|
||||
cfg := setting.NewCfg()
|
||||
dsStore := dashsnapdb.ProvideStore(sqlStore, cfg)
|
||||
|
||||
@@ -4,12 +4,12 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/db"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestIntegrationXORMGetDashboardVersion(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
testIntegrationGetDashboardVersion(t, func(ss db.DB) store {
|
||||
return &sqlStore{
|
||||
db: ss,
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -9,12 +9,12 @@ import (
|
||||
"github.com/grafana/grafana/pkg/kinds/librarypanel"
|
||||
"github.com/grafana/grafana/pkg/services/libraryelements/model"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestIntegration_CreateLibraryElement(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
scenarioWithPanel(t, "When an admin tries to create a library panel that already exists, it should fail",
|
||||
func(t *testing.T, sc scenarioContext) {
|
||||
// nolint:staticcheck
|
||||
|
||||
@@ -10,13 +10,13 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/dashboards"
|
||||
"github.com/grafana/grafana/pkg/services/libraryelements/model"
|
||||
"github.com/grafana/grafana/pkg/services/org"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
"github.com/grafana/grafana/pkg/web"
|
||||
)
|
||||
|
||||
func TestIntegration_DeleteLibraryElement(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
scenarioWithPanel(t, "When an admin tries to delete a library panel that does not exist, it should fail",
|
||||
func(t *testing.T, sc scenarioContext) {
|
||||
resp := sc.service.deleteHandler(sc.reqContext)
|
||||
|
||||
@@ -13,12 +13,12 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/org"
|
||||
searchmodel "github.com/grafana/grafana/pkg/services/search/model"
|
||||
"github.com/grafana/grafana/pkg/services/search/sort"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestIntegration_GetAllLibraryElements(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
testScenario(t, "When an admin tries to get all library panels and none exists, it should return none",
|
||||
func(t *testing.T, sc scenarioContext) {
|
||||
resp := sc.service.getAllHandler(sc.reqContext)
|
||||
|
||||
@@ -13,13 +13,13 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/folder"
|
||||
"github.com/grafana/grafana/pkg/services/libraryelements/model"
|
||||
"github.com/grafana/grafana/pkg/services/org"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
"github.com/grafana/grafana/pkg/web"
|
||||
)
|
||||
|
||||
func TestIntegration_GetLibraryElement(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
scenarioWithPanel(t, "When an admin tries to get a library panel that does not exist, it should fail",
|
||||
func(t *testing.T, sc scenarioContext) {
|
||||
// by uid
|
||||
|
||||
@@ -11,13 +11,13 @@ import (
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
"github.com/grafana/grafana/pkg/web"
|
||||
)
|
||||
|
||||
func TestIntegration_PatchLibraryElement(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
scenarioWithPanel(t, "When an admin tries to patch a library panel that does not exist, it should fail",
|
||||
func(t *testing.T, sc scenarioContext) {
|
||||
cmd := model.PatchLibraryElementCommand{Kind: int64(model.PanelElement), Version: 1}
|
||||
|
||||
@@ -24,12 +24,12 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/user/userimpl"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/tests/testinfra"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestIntegrationLibraryElementPermissions(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{})
|
||||
|
||||
grafanaListedAddr, env := testinfra.StartGrafanaEnv(t, dir, path)
|
||||
@@ -136,9 +136,8 @@ func TestIntegrationLibraryElementPermissions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationLibraryElementGranularPermissions(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{})
|
||||
grafanaListedAddr, env := testinfra.StartGrafanaEnv(t, dir, path)
|
||||
cfgProvider, err := configprovider.ProvideService(env.Cfg)
|
||||
|
||||
@@ -38,6 +38,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
"github.com/grafana/grafana/pkg/services/user/userimpl"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
"github.com/grafana/grafana/pkg/web"
|
||||
)
|
||||
|
||||
@@ -49,9 +50,8 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegration_DeleteLibraryPanelsInFolder(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
scenarioWithPanel(t, "When an admin tries to delete a folder that contains connected library elements, it should fail",
|
||||
func(t *testing.T, sc scenarioContext) {
|
||||
err := sc.service.ConnectElementsToDashboard(sc.reqContext.Req.Context(), sc.reqContext.SignedInUser, []string{sc.initialResult.Result.UID}, 1)
|
||||
@@ -98,9 +98,8 @@ func TestIntegration_DeleteLibraryPanelsInFolder(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegration_GetLibraryPanelConnections(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
scenarioWithPanel(t, "When an admin tries to get connections of library panel, it should succeed and return correct result",
|
||||
func(t *testing.T, sc scenarioContext) {
|
||||
err := sc.service.ConnectElementsToDashboard(sc.reqContext.Req.Context(), sc.reqContext.SignedInUser, []string{sc.initialResult.Result.UID}, 1)
|
||||
|
||||
@@ -29,6 +29,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
"github.com/grafana/grafana/pkg/services/user/userimpl"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
const userInDbName = "user_in_db"
|
||||
@@ -40,9 +41,8 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegrationConnectLibraryPanelsForDashboard(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
scenarioWithLibraryPanel(t, "When an admin tries to store a dashboard with a library panel, it should connect the two",
|
||||
func(t *testing.T, sc scenarioContext) {
|
||||
dashJSON := map[string]any{
|
||||
@@ -336,9 +336,8 @@ func TestIntegrationConnectLibraryPanelsForDashboard(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationImportLibraryPanelsForDashboard(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
testScenario(t, "When an admin tries to import a dashboard with a library panel that does not exist, it should import the library panel",
|
||||
func(t *testing.T, sc scenarioContext) {
|
||||
var missingUID = "jL6MrxCMz"
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/live/model"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
@@ -15,9 +16,8 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegrationLiveMessage(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
storage := SetupTestStorage(t)
|
||||
|
||||
getQuery := &model.GetLiveMessageQuery{
|
||||
|
||||
@@ -23,6 +23,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/live/livecontext"
|
||||
"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) {
|
||||
@@ -30,9 +31,8 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegration_provideLiveService_RedisUnavailable(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
cfg := setting.NewCfg()
|
||||
|
||||
cfg.LiveHAEngine = "testredisunavailable"
|
||||
|
||||
@@ -7,13 +7,12 @@ import (
|
||||
|
||||
"github.com/go-redis/redis/v8"
|
||||
"github.com/google/uuid"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestIntegrationRedisCacheStorage(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
u, ok := os.LookupEnv("REDIS_URL")
|
||||
if !ok || u == "" {
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
secretstest "github.com/grafana/grafana/pkg/services/secrets/fakes"
|
||||
"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) {
|
||||
@@ -21,9 +22,7 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegrationAuthInfoStore(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sql := db.InitTestDB(t)
|
||||
store := ProvideStore(sql, secretstest.NewFakeSecretsService())
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/services/loginattempt"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestService_Validate(t *testing.T) {
|
||||
@@ -134,9 +135,8 @@ func TestService_Validate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationUserLoginAttempts(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
ctx := context.Background()
|
||||
cfg := setting.NewCfg()
|
||||
cfg.DisableBruteForceLoginProtection = false
|
||||
@@ -282,9 +282,8 @@ func TestService_ValidateIPAddress(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationIPLoginAttempts(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
ctx := context.Background()
|
||||
cfg := setting.NewCfg()
|
||||
cfg.DisableBruteForceLoginProtection = false
|
||||
@@ -312,9 +311,7 @@ func TestIntegrationIPLoginAttempts(t *testing.T) {
|
||||
// TestIPv6AddressSupport verifies that various IPv6 address formats can be stored properly with the new column length, testing various IPv6 address formats that could be encountered.
|
||||
// This test validates that the ip_address column length is sufficient for IPv6 addresses
|
||||
func TestIntegrationIPv6AddressSupport(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
ctx := context.Background()
|
||||
cfg := setting.NewCfg()
|
||||
|
||||
@@ -9,6 +9,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) {
|
||||
@@ -16,9 +17,8 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegrationLoginAttemptsQuery(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
user := "user"
|
||||
|
||||
beginningOfTime := time.Date(2017, 10, 22, 8, 0, 0, 0, time.Local)
|
||||
@@ -85,9 +85,8 @@ func TestIntegrationLoginAttemptsQuery(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationLoginAttemptsDelete(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
user := "user"
|
||||
|
||||
beginningOfTime := time.Date(2017, 10, 22, 8, 0, 0, 0, time.Local)
|
||||
|
||||
@@ -49,6 +49,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
"github.com/grafana/grafana/pkg/web"
|
||||
)
|
||||
|
||||
@@ -60,9 +61,8 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegrationProvisioningApi(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
t.Run("policies", func(t *testing.T) {
|
||||
t.Run("successful GET returns 200", func(t *testing.T) {
|
||||
sut := createProvisioningSrvSut(t)
|
||||
@@ -1650,9 +1650,8 @@ func TestIntegrationProvisioningApi(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationProvisioningApiContactPointExport(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
createTestEnv := func(t *testing.T, testConfig string) testEnvironment {
|
||||
env := createTestEnv(t, testConfig)
|
||||
env.ac = &recordingAccessControlFake{
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/notifier/channels_config"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestReceiver_Clone(t *testing.T) {
|
||||
@@ -70,9 +71,8 @@ func TestReceiver_EncryptDecrypt(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegration_Redact(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
redactFn := func(key string) string {
|
||||
return "TESTREDACTED"
|
||||
}
|
||||
@@ -103,11 +103,9 @@ func TestIntegration_Redact(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegration_Validate(t *testing.T) {
|
||||
// Test that all known integration types are valid.
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
// Test that all known integration types are valid.
|
||||
for integrationType := range alertingNotify.AllKnownConfigsForTesting {
|
||||
t.Run(integrationType, func(t *testing.T) {
|
||||
validIntegration := IntegrationGen(IntegrationMuts.WithValidConfig(integrationType))()
|
||||
@@ -122,11 +120,9 @@ func TestIntegration_Validate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegration_WithExistingSecureFields(t *testing.T) {
|
||||
// Test that WithExistingSecureFields will copy over the secure fields from the existing integration.
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
// Test that WithExistingSecureFields will copy over the secure fields from the existing integration.
|
||||
testCases := []struct {
|
||||
name string
|
||||
integration Integration
|
||||
@@ -290,11 +286,9 @@ func TestSecretsIntegrationConfig(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegration_SecureFields(t *testing.T) {
|
||||
// Test that all known integration types have a config and correctly mark their secrets as secure.
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
// Test that all known integration types have a config and correctly mark their secrets as secure.
|
||||
for integrationType := range alertingNotify.AllKnownConfigsForTesting {
|
||||
t.Run(integrationType, func(t *testing.T) {
|
||||
t.Run("contains SecureSettings", func(t *testing.T) {
|
||||
|
||||
@@ -23,6 +23,7 @@ import (
|
||||
secretsManager "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) {
|
||||
@@ -64,9 +65,8 @@ func setupAMTest(t *testing.T) *alertmanager {
|
||||
}
|
||||
|
||||
func TestIntegrationAlertmanager_newAlertmanager(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
am := setupAMTest(t)
|
||||
require.False(t, am.Ready())
|
||||
}
|
||||
|
||||
@@ -31,12 +31,12 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/secrets/manager"
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestIntegrationReceiverService_GetReceiver(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore := db.InitTestDB(t)
|
||||
secretsService := manager.SetupTestService(t, database.ProvideSecretsStore(sqlStore))
|
||||
|
||||
@@ -65,9 +65,8 @@ func TestIntegrationReceiverService_GetReceiver(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationReceiverService_GetReceivers(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore := db.InitTestDB(t)
|
||||
secretsService := manager.SetupTestService(t, database.ProvideSecretsStore(sqlStore))
|
||||
|
||||
@@ -98,9 +97,8 @@ func TestIntegrationReceiverService_GetReceivers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationReceiverService_DecryptRedact(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore := db.InitTestDB(t)
|
||||
secretsService := manager.SetupTestService(t, database.ProvideSecretsStore(sqlStore))
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
apimodels "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -58,9 +59,8 @@ var (
|
||||
)
|
||||
|
||||
func TestIntegrationTemplateDefaultData(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
am := setupAMTest(t)
|
||||
|
||||
tests := []struct {
|
||||
|
||||
@@ -30,14 +30,14 @@ 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"
|
||||
)
|
||||
|
||||
// note: additional integration tests are in /pkg/tests/api/alerting/api_provisioning_test.go
|
||||
|
||||
func TestIntegrationAlertRuleService(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
ruleService := createAlertRuleService(t, nil)
|
||||
var orgID int64 = 1
|
||||
u := &user.SignedInUser{
|
||||
@@ -751,9 +751,8 @@ func TestIntegrationAlertRuleService(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationCreateAlertRule(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
orgID := rand.Int63()
|
||||
u := &user.SignedInUser{OrgID: orgID, UserUID: util.GenerateShortUID()}
|
||||
groupKey := models.GenerateGroupKey(orgID)
|
||||
|
||||
@@ -33,12 +33,12 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/secrets/manager"
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestIntegrationContactPointService(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore := db.InitTestDB(t)
|
||||
secretsService := manager.SetupTestService(t, database.ProvideSecretsStore(sqlStore))
|
||||
|
||||
@@ -365,9 +365,8 @@ func TestIntegrationContactPointService(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationContactPointServiceDecryptRedact(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
secretsService := manager.SetupTestService(t, database.ProvideSecretsStore(db.InitTestDB(t)))
|
||||
|
||||
redactedUser := &user.SignedInUser{OrgID: 1, Permissions: map[int64]map[string][]string{
|
||||
|
||||
@@ -51,6 +51,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
//go:embed test-data/*.*
|
||||
@@ -260,11 +261,10 @@ func TestGetRemoteState(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationApplyConfig(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
// errorHandler returns an error response for the readiness check and state sync.
|
||||
|
||||
// errorHandler returns an error response for the readiness check and state sync.
|
||||
}
|
||||
const tenantID = "test"
|
||||
|
||||
errorHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -938,9 +938,7 @@ receivers:
|
||||
}
|
||||
|
||||
func TestIntegrationRemoteAlertmanagerConfiguration(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
amURL, ok := os.LookupEnv("AM_URL")
|
||||
if !ok {
|
||||
@@ -1119,9 +1117,7 @@ func TestIntegrationRemoteAlertmanagerConfiguration(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationRemoteAlertmanagerGetStatus(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
amURL, ok := os.LookupEnv("AM_URL")
|
||||
if !ok {
|
||||
@@ -1153,9 +1149,7 @@ func TestIntegrationRemoteAlertmanagerGetStatus(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationRemoteAlertmanagerSilences(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
amURL, ok := os.LookupEnv("AM_URL")
|
||||
if !ok {
|
||||
@@ -1239,9 +1233,7 @@ func TestIntegrationRemoteAlertmanagerSilences(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationRemoteAlertmanagerAlerts(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
amURL, ok := os.LookupEnv("AM_URL")
|
||||
if !ok {
|
||||
@@ -1316,9 +1308,7 @@ func TestIntegrationRemoteAlertmanagerAlerts(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationRemoteAlertmanagerReceivers(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
amURL, ok := os.LookupEnv("AM_URL")
|
||||
if !ok {
|
||||
@@ -1355,9 +1345,7 @@ func TestIntegrationRemoteAlertmanagerReceivers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationRemoteAlertmanagerTestTemplates(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
amURL, ok := os.LookupEnv("AM_URL")
|
||||
if !ok {
|
||||
|
||||
@@ -30,12 +30,12 @@ import (
|
||||
secretsManager "github.com/grafana/grafana/pkg/services/secrets/manager"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestIntegrationSendingToExternalAlertmanager(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
ruleKey := models.GenerateRuleKey(1)
|
||||
|
||||
fakeAM := NewFakeExternalAlertmanager(t)
|
||||
@@ -102,9 +102,8 @@ func TestIntegrationSendingToExternalAlertmanager(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationSendingToExternalAlertmanager_WithMultipleOrgs(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
ruleKey1 := models.GenerateRuleKey(1)
|
||||
ruleKey2 := models.GenerateRuleKey(2)
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
tutil "github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
@@ -47,9 +48,8 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegrationWarmStateCache(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
evaluationTime, err := time.Parse("2006-01-02", "2021-03-25")
|
||||
require.NoError(t, err)
|
||||
ctx := context.Background()
|
||||
@@ -275,9 +275,8 @@ func TestIntegrationWarmStateCache(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationDashboardAnnotations(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
evaluationTime, err := time.Parse("2006-01-02", "2022-01-01")
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -1457,10 +1456,10 @@ func printAllAnnotations(annos map[int64]annotations.Item) string {
|
||||
}
|
||||
|
||||
func TestIntegrationStaleResultsHandler(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
// Truncate to the second since we don't store sub-second precision.
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
// Truncate to the second since we don't store sub-second precision.
|
||||
|
||||
evaluationTime := time.Now().Truncate(time.Second).UTC()
|
||||
interval := time.Minute
|
||||
|
||||
@@ -1748,9 +1747,8 @@ func TestStaleResults(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationDeleteStateByRuleUID(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
interval := time.Minute
|
||||
ctx := context.Background()
|
||||
ng, dbstore := tests.SetupTestEnv(t, 1)
|
||||
@@ -1897,9 +1895,8 @@ func TestIntegrationDeleteStateByRuleUID(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationResetStateByRuleUID(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
interval := time.Minute
|
||||
ctx := context.Background()
|
||||
ng, dbstore := tests.SetupTestEnv(t, 1)
|
||||
|
||||
@@ -36,12 +36,12 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/models"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
tutil "github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestIntegrationUpdateAlertRules(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
cfg := setting.NewCfg()
|
||||
cfg.UnifiedAlerting = setting.UnifiedAlertingSettings{BaseInterval: time.Duration(rand.Int64N(100)+1) * time.Second}
|
||||
sqlStore := db.InitTestDB(t)
|
||||
@@ -232,9 +232,7 @@ func TestIntegrationUpdateAlertRules(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegration_GetAlertRulesForScheduling(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
cfg := setting.NewCfg()
|
||||
cfg.UnifiedAlerting = setting.UnifiedAlertingSettings{
|
||||
@@ -389,9 +387,7 @@ func TestIntegration_GetAlertRulesForScheduling(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegration_CountAlertRules(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore := db.InitTestDB(t)
|
||||
cfg := setting.NewCfg()
|
||||
@@ -456,9 +452,7 @@ func TestIntegration_CountAlertRules(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegration_DeleteInFolder(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore := db.InitTestDB(t)
|
||||
cfg := setting.NewCfg()
|
||||
@@ -488,9 +482,7 @@ func TestIntegration_DeleteInFolder(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegration_DeleteAlertRulesByUID(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore := db.InitTestDB(t)
|
||||
cfg := setting.NewCfg()
|
||||
@@ -739,9 +731,7 @@ func TestIntegration_DeleteAlertRulesByUID(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationInsertAlertRules(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
orgID := int64(1)
|
||||
usr := models.UserUID("test")
|
||||
@@ -908,9 +898,7 @@ func TestIntegrationInsertAlertRules(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationAlertRulesNotificationSettings(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
usr := models.UserUID("test")
|
||||
|
||||
@@ -1199,9 +1187,8 @@ func TestIntegrationAlertRulesNotificationSettings(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationListNotificationSettings(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
usr := models.UserUID("test")
|
||||
sqlStore := db.InitTestDB(t)
|
||||
folderService := setupFolderService(t, sqlStore, setting.NewCfg(), featuremgmt.WithFeatures())
|
||||
@@ -1320,9 +1307,7 @@ func TestIntegrationListNotificationSettings(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationGetNamespacesByRuleUID(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
usr := models.UserUID("test")
|
||||
|
||||
@@ -1371,9 +1356,8 @@ func TestIntegrationGetNamespacesByRuleUID(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationRuleGroupsCaseSensitive(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
usr := models.UserUID("test")
|
||||
|
||||
sqlStore := db.InitTestDB(t)
|
||||
@@ -1478,9 +1462,8 @@ func TestIntegrationRuleGroupsCaseSensitive(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationIncreaseVersionForAllRulesInNamespaces(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
cfg := setting.NewCfg()
|
||||
cfg.UnifiedAlerting = setting.UnifiedAlertingSettings{BaseInterval: time.Duration(rand.Int64N(100)+1) * time.Second}
|
||||
sqlStore := db.InitTestDB(t)
|
||||
@@ -1527,9 +1510,8 @@ func TestIntegrationIncreaseVersionForAllRulesInNamespaces(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationGetRuleVersions(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
cfg := setting.NewCfg()
|
||||
cfg.UnifiedAlerting = setting.UnifiedAlertingSettings{BaseInterval: time.Duration(rand.Int64N(100)+1) * time.Second}
|
||||
sqlStore := db.InitTestDB(t)
|
||||
@@ -1637,9 +1619,8 @@ func setupFolderService(t testing.TB, sqlStore db.DB, cfg *setting.Cfg, features
|
||||
}
|
||||
|
||||
func TestIntegration_AlertRuleVersionsCleanup(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
usr := models.UserUID("test")
|
||||
cfg := setting.UnifiedAlertingSettings{
|
||||
BaseInterval: time.Duration(rand.Int64N(100)+1) * time.Second,
|
||||
@@ -1736,9 +1717,7 @@ func TestIntegration_AlertRuleVersionsCleanup(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegration_ListAlertRulesByGroup(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore := db.InitTestDB(t)
|
||||
cfg := setting.NewCfg()
|
||||
@@ -1899,9 +1878,8 @@ func Benchmark_ListAlertRules(b *testing.B) {
|
||||
}
|
||||
|
||||
func TestIntegration_ListAlertRules(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore := db.InitTestDB(t)
|
||||
cfg := setting.NewCfg()
|
||||
cfg.UnifiedAlerting = setting.UnifiedAlertingSettings{
|
||||
@@ -1957,9 +1935,8 @@ func TestIntegration_ListAlertRules(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegration_ListAlertRulesPaginated(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore := db.InitTestDB(t)
|
||||
cfg := setting.NewCfg()
|
||||
cfg.UnifiedAlerting = setting.UnifiedAlertingSettings{
|
||||
@@ -2097,9 +2074,8 @@ func TestIntegration_ListAlertRulesPaginated(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegration_ListDeletedRules(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
cfg := setting.NewCfg()
|
||||
cfg.UnifiedAlerting = setting.UnifiedAlertingSettings{
|
||||
BaseInterval: 1 * time.Second,
|
||||
@@ -2183,9 +2159,7 @@ func TestIntegration_ListDeletedRules(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegration_CleanUpDeletedAlertRules(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
oldClk := TimeNow
|
||||
t.Cleanup(func() {
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/models"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
@@ -21,9 +22,8 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegrationAlertmanagerStore(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore := db.InitTestDB(t)
|
||||
store := &DBstore{
|
||||
SQLStore: sqlStore,
|
||||
@@ -143,9 +143,8 @@ func TestIntegrationAlertmanagerStore(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationAlertmanagerHash(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore := db.InitTestDB(t)
|
||||
store := &DBstore{
|
||||
SQLStore: sqlStore,
|
||||
@@ -190,9 +189,8 @@ func TestIntegrationAlertmanagerHash(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationAlertmanagerConfigCleanup(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore := db.InitTestDB(t)
|
||||
store := &DBstore{
|
||||
SQLStore: sqlStore,
|
||||
@@ -283,9 +281,8 @@ func TestIntegrationAlertmanagerConfigCleanup(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationMarkConfigurationAsApplied(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore := db.InitTestDB(t)
|
||||
store := &DBstore{
|
||||
SQLStore: sqlStore,
|
||||
@@ -338,9 +335,8 @@ func TestIntegrationMarkConfigurationAsApplied(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationGetAppliedConfigurations(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore := db.InitTestDB(t)
|
||||
store := &DBstore{
|
||||
SQLStore: sqlStore,
|
||||
@@ -429,9 +425,8 @@ func TestIntegrationGetAppliedConfigurations(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationGetHistoricalConfiguration(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore := db.InitTestDB(t)
|
||||
store := &DBstore{
|
||||
SQLStore: sqlStore,
|
||||
|
||||
@@ -12,12 +12,11 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/models"
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/store"
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/tests"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestIntegrationSaveAndGetImage(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
// our database schema uses second precision for timestamps
|
||||
store.TimeNow = func() time.Time {
|
||||
@@ -86,9 +85,7 @@ func TestIntegrationSaveAndGetImage(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationGetImages(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
// our database schema uses second precision for timestamps
|
||||
store.TimeNow = func() time.Time {
|
||||
@@ -168,9 +165,7 @@ func TestIntegrationGetImages(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationDeleteExpiredImages(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
// our database schema uses second precision for timestamps
|
||||
store.TimeNow = func() time.Time {
|
||||
|
||||
@@ -17,14 +17,13 @@ import (
|
||||
pb "github.com/grafana/grafana/pkg/services/ngalert/store/proto/v1"
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/tests"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
const baseIntervalSeconds = 10
|
||||
|
||||
func TestIntegration_CompressedAlertRuleStateOperations(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
ctx := context.Background()
|
||||
ng, dbstore := tests.SetupTestEnv(
|
||||
@@ -124,9 +123,8 @@ func createAlertInstance(orgID int64, ruleUID, labelsHash, reason string, state
|
||||
}
|
||||
|
||||
func TestIntegrationAlertInstanceOperations(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
ctx := context.Background()
|
||||
ng, dbstore := tests.SetupTestEnv(t, baseIntervalSeconds)
|
||||
|
||||
@@ -301,9 +299,8 @@ func TestIntegrationAlertInstanceOperations(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationFullSync(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
batchSize := 1
|
||||
|
||||
ctx := context.Background()
|
||||
@@ -511,9 +508,7 @@ func TestIntegrationFullSync(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegration_ProtoInstanceDBStore_VerifyCompressedData(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
ctx := context.Background()
|
||||
ng, dbstore := tests.SetupTestEnv(
|
||||
|
||||
@@ -18,12 +18,11 @@ import (
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/db"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestIntegration_GetUserVisibleNamespaces(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
sqlStore := db.InitTestDB(t)
|
||||
cfg := setting.NewCfg()
|
||||
|
||||
@@ -11,12 +11,12 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/testutil"
|
||||
"github.com/grafana/grafana/pkg/services/org"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
tutil "github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestIntegrationFetchOrgIds(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
tutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
t.Run("returns empty result when no orgs exist", func(t *testing.T) {
|
||||
|
||||
@@ -16,14 +16,13 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/provisioning"
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/store"
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/tests"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
const testAlertingIntervalSeconds = 10
|
||||
|
||||
func TestIntegrationProvisioningStore(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/datasources"
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/models"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -146,9 +147,8 @@ func TestCanBeInstant(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationMigrateLokiQueryToInstant(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
original := createMigrateableLokiRule(t)
|
||||
migrated := createMigrateableLokiRule(t, func(r *models.AlertRule) {
|
||||
r.Data[0] = lokiQuery(t, "A", "instant", "grafanacloud-logs")
|
||||
@@ -172,9 +172,8 @@ func TestIntegrationMigrateLokiQueryToInstant(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationMigrateMultiLokiQueryToInstant(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
original := createMultiQueryMigratableLokiRule(t)
|
||||
migrated := createMultiQueryMigratableLokiRule(t, func(r *models.AlertRule) {
|
||||
r.Data[0] = lokiQuery(t, "TotalRequests", "instant", "grafanacloud-logs")
|
||||
@@ -212,9 +211,8 @@ func TestIntegrationMigrateMultiLokiQueryToInstant(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationMigratePromQueryToInstant(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
original := createMigratablePromRule(t)
|
||||
migrated := createMigratablePromRule(t, func(r *models.AlertRule) {
|
||||
r.Data[0] = prometheusQuery(t, "A", promExternalDS, promIsInstant)
|
||||
@@ -236,9 +234,8 @@ func TestIntegrationMigratePromQueryToInstant(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationMigrateMultiPromQueryToInstant(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
original := createMultiQueryMigratablePromRule(t)
|
||||
migrated := createMultiQueryMigratablePromRule(t, func(r *models.AlertRule) {
|
||||
r.Data[0] = prometheusQuery(t, "TotalRequests", promExternalDS, promIsInstant)
|
||||
|
||||
@@ -27,6 +27,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/login/authinfotest"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
const EXPIRED_ID_TOKEN = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2V4YW1wbGUuY29tIiwic3ViIjoiMTIzNDU2Nzg5MCIsImF1ZCI6InlvdXItY2xpZW50LWlkIiwiZXhwIjoxNjAwMDAwMDAwLCJpYXQiOjE2MDAwMDAwMDAsIm5hbWUiOiJKb2huIERvZSIsImVtYWlsIjoiam9obkBleGFtcGxlLmNvbSJ9.c2lnbmF0dXJl" // #nosec G101 not a hardcoded credential
|
||||
@@ -64,9 +65,7 @@ func (f *FakeAuthInfoStore) DeleteAuthInfo(ctx context.Context, cmd *login.Delet
|
||||
}
|
||||
|
||||
func TestIntegration_TryTokenRefresh(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
unexpiredToken := &oauth2.Token{
|
||||
AccessToken: "testaccess",
|
||||
@@ -346,9 +345,7 @@ func TestIntegration_TryTokenRefresh(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegration_TryTokenRefresh_WithExternalSessions(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
unexpiredToken := &oauth2.Token{
|
||||
AccessToken: "testaccess",
|
||||
|
||||
@@ -27,6 +27,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/user/userimpl"
|
||||
"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) {
|
||||
@@ -34,9 +35,7 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func TestIntegrationOrgDataAccess(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
ss := db.InitTestDB(t)
|
||||
orgStore := sqlStore{
|
||||
@@ -277,9 +276,7 @@ func TestIntegrationOrgDataAccess(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationOrgUserDataAccess(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
ss := db.InitTestDB(t)
|
||||
orgUserStore := sqlStore{
|
||||
@@ -568,9 +565,7 @@ func TestIntegrationOrgUserDataAccess(t *testing.T) {
|
||||
|
||||
// This test will be refactore after the CRUD store refactor
|
||||
func TestIntegrationSQLStore_AddOrgUser(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
store, cfg := db.InitTestDBWithCfg(t)
|
||||
defer func() {
|
||||
@@ -640,9 +635,7 @@ func TestIntegrationSQLStore_AddOrgUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegration_SQLStore_GetOrgUsers(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
store, cfg := db.InitTestDBWithCfg(t)
|
||||
orgUserStore := sqlStore{
|
||||
@@ -755,9 +748,8 @@ func hasWildcardScope(user identity.Requester, action string) bool {
|
||||
}
|
||||
|
||||
func TestIntegration_SQLStore_GetOrgUsers_PopulatesCorrectly(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
// The millisecond part is not stored in the DB
|
||||
constNow := time.Date(2022, 8, 17, 20, 34, 58, 0, time.UTC)
|
||||
userimpl.MockTimeNow(constNow)
|
||||
@@ -821,9 +813,7 @@ func TestIntegration_SQLStore_GetOrgUsers_PopulatesCorrectly(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegration_SQLStore_SearchOrgUsers(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
store, cfg := db.InitTestDBWithCfg(t, sqlstore.InitTestDBOpt{})
|
||||
orgUserStore := sqlStore{
|
||||
@@ -899,9 +889,8 @@ func TestIntegration_SQLStore_SearchOrgUsers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegration_SQLStore_RemoveOrgUser(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
store, cfg := db.InitTestDBWithCfg(t)
|
||||
orgUserStore := sqlStore{
|
||||
db: store,
|
||||
|
||||
@@ -4,12 +4,12 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/db"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestIntegrationXormPlaylistDataAccess(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
testIntegrationPlaylistDataAccess(t, func(ss db.DB) store {
|
||||
return &sqlStore{db: ss}
|
||||
})
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/secrets/fakes"
|
||||
secretsManager "github.com/grafana/grafana/pkg/services/secrets/manager"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
@@ -99,9 +100,8 @@ func TestService_DecryptedValuesCache(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationPluginSettings(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
store := db.InitTestDB(t)
|
||||
secretsService := secretsManager.SetupTestService(t, fakes.NewFakeSecretsStore())
|
||||
psService := ProvideService(store, secretsService)
|
||||
|
||||
@@ -48,6 +48,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/tsdb/prometheus"
|
||||
"github.com/grafana/grafana/pkg/tsdb/tempo"
|
||||
"github.com/grafana/grafana/pkg/tsdb/zipkin"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
@@ -57,9 +58,7 @@ func TestMain(m *testing.M) {
|
||||
// This test should run before TestIntegrationPluginManager because this test relies on having a pre-existing Admin user
|
||||
// and because the SQLStore instance is shared between tests, this test does all the necessary setup
|
||||
func TestIntegrationPluginDashboards(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
|
||||
AnonymousUserRole: org.RoleAdmin,
|
||||
@@ -123,9 +122,8 @@ func TestIntegrationPluginDashboards(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationPluginManager(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
staticRootPath, err := filepath.Abs("../../../../public/")
|
||||
require.NoError(t, err)
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/db"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
func TestIntegrationXORMPreferencesDataAccess(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
testIntegrationPreferencesDataAccess(t, func(ss db.DB) store {
|
||||
return &sqlStore{db: ss}
|
||||
})
|
||||
|
||||
@@ -30,6 +30,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/storage/legacysql/dualwrite"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -109,9 +110,8 @@ func TestCreatingNewDashboardFileReader(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationDashboardFileReader(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
logger := log.New("test-logger")
|
||||
cfg := &config{}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/supportbundles/supportbundlestest"
|
||||
"github.com/grafana/grafana/pkg/services/tag/tagimpl"
|
||||
"github.com/grafana/grafana/pkg/storage/legacysql/dualwrite"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -32,9 +33,8 @@ const (
|
||||
)
|
||||
|
||||
func TestIntegrationDuplicatesValidator(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
fakeService := &dashboards.FakeDashboardProvisioning{}
|
||||
defer fakeService.AssertExpectations(t)
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/tests/testsuite"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
)
|
||||
|
||||
// This is what the db sets empty time settings to
|
||||
@@ -42,9 +43,7 @@ func TestLogPrefix(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationListPublicDashboard(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
var sqlStore db.DB
|
||||
var cfg *setting.Cfg
|
||||
@@ -116,9 +115,8 @@ func TestIntegrationListPublicDashboard(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationExistsEnabledByAccessToken(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
var sqlStore db.DB
|
||||
var cfg *setting.Cfg
|
||||
var dashboardStore dashboards.Store
|
||||
@@ -188,9 +186,8 @@ func TestIntegrationExistsEnabledByAccessToken(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationExistsEnabledByDashboardUid(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
var sqlStore db.DB
|
||||
var cfg *setting.Cfg
|
||||
var dashboardStore dashboards.Store
|
||||
@@ -252,9 +249,8 @@ func TestIntegrationExistsEnabledByDashboardUid(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationFindByDashboardUid(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
var sqlStore db.DB
|
||||
var cfg *setting.Cfg
|
||||
var dashboardStore dashboards.Store
|
||||
@@ -319,9 +315,8 @@ func TestIntegrationFindByDashboardUid(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationFindByAccessToken(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
var sqlStore db.DB
|
||||
var cfg *setting.Cfg
|
||||
var dashboardStore dashboards.Store
|
||||
@@ -387,9 +382,8 @@ func TestIntegrationFindByAccessToken(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationCreatePublicDashboard(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
var sqlStore db.DB
|
||||
var cfg *setting.Cfg
|
||||
var dashboardStore dashboards.Store
|
||||
@@ -465,9 +459,8 @@ func TestIntegrationCreatePublicDashboard(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationUpdatePublicDashboard(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
var sqlStore db.DB
|
||||
var cfg *setting.Cfg
|
||||
var dashboardStore dashboards.Store
|
||||
@@ -569,9 +562,8 @@ func TestIntegrationUpdatePublicDashboard(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationGetOrgIdByAccessToken(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
var sqlStore db.DB
|
||||
var cfg *setting.Cfg
|
||||
var dashboardStore dashboards.Store
|
||||
@@ -640,9 +632,8 @@ func TestIntegrationGetOrgIdByAccessToken(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationDelete(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
var sqlStore db.DB
|
||||
var cfg *setting.Cfg
|
||||
var dashboardStore dashboards.Store
|
||||
@@ -683,9 +674,8 @@ func TestIntegrationDelete(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationDeleteByDashboardUIDs(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
|
||||
@@ -736,9 +726,8 @@ func TestIntegrationDeleteByDashboardUIDs(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationGetMetrics(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
var sqlStore db.DB
|
||||
var cfg *setting.Cfg
|
||||
var dashboardStore dashboards.Store
|
||||
|
||||
@@ -25,6 +25,7 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/tag/tagimpl"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
|
||||
"github.com/grafana/grafana/pkg/util/testutil"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/mock"
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -308,9 +309,8 @@ const (
|
||||
)
|
||||
|
||||
func TestIntegrationGetQueryDataResponse(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
fakeDashboardService := &dashboards.FakeDashboardService{}
|
||||
service, sqlStore, _ := newPublicDashboardServiceImpl(t, nil, nil, nil, fakeDashboardService, nil)
|
||||
fakeQueryService := &query.FakeQueryService{}
|
||||
@@ -365,9 +365,8 @@ func TestIntegrationGetQueryDataResponse(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationFindAnnotations(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
color := "red"
|
||||
name := "annoName"
|
||||
t.Run("service identity has correct permissions to get annotations dashboards and query datasources", func(t *testing.T) {
|
||||
@@ -724,9 +723,8 @@ func TestIntegrationFindAnnotations(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationGetMetricRequest(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
service, sqlStore, cfg := newPublicDashboardServiceImpl(t, nil, nil, nil, nil, nil)
|
||||
dashboardStore, err := dashboardsDB.ProvideDashboardStore(sqlStore, cfg, featuremgmt.WithFeatures(), tagimpl.ProvideService(sqlStore))
|
||||
require.NoError(t, err)
|
||||
@@ -766,9 +764,8 @@ func TestIntegrationGetMetricRequest(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationBuildMetricRequest(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
fakeDashboardService := &dashboards.FakeDashboardService{}
|
||||
service, sqlStore, cfg := newPublicDashboardServiceImpl(t, nil, nil, nil, fakeDashboardService, nil)
|
||||
|
||||
|
||||
@@ -28,6 +28,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"
|
||||
)
|
||||
|
||||
var timeSettings = &TimeSettings{From: "now-12h", To: "now"}
|
||||
@@ -44,9 +45,8 @@ func TestLogPrefix(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationGetPublicDashboardForView(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
type storeResp struct {
|
||||
pd *PublicDashboard
|
||||
d *dashboards.Dashboard
|
||||
@@ -439,9 +439,8 @@ func TestIntegrationGetPublicDashboardForView(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationGetPublicDashboard(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
type storeResp struct {
|
||||
pd *PublicDashboard
|
||||
d *dashboards.Dashboard
|
||||
@@ -519,9 +518,8 @@ func TestIntegrationGetPublicDashboard(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIntegrationGetEnabledPublicDashboard(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
type storeResp struct {
|
||||
pd *PublicDashboard
|
||||
d *dashboards.Dashboard
|
||||
@@ -587,9 +585,8 @@ func TestIntegrationGetEnabledPublicDashboard(t *testing.T) {
|
||||
// We're using sqlite here because testing all of the behaviors with mocks in
|
||||
// the correct order is convoluted.
|
||||
func TestIntegrationCreatePublicDashboard(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
t.Run("Create public dashboard", func(t *testing.T) {
|
||||
fakeDashboardService := &dashboards.FakeDashboardService{}
|
||||
service, sqlStore, cfg := newPublicDashboardServiceImpl(t, nil, nil, nil, fakeDashboardService, nil)
|
||||
@@ -971,9 +968,8 @@ func assertFalseIfNull(t *testing.T, expectedValue bool, nullableValue *bool) {
|
||||
}
|
||||
|
||||
func TestIntegrationUpdatePublicDashboard(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
fakeDashboardService := &dashboards.FakeDashboardService{}
|
||||
service, sqlStore, cfg := newPublicDashboardServiceImpl(t, nil, nil, nil, fakeDashboardService, nil)
|
||||
|
||||
@@ -1218,9 +1214,8 @@ func assertOldValueIfNull(t *testing.T, expectedValue bool, oldValue bool, nulla
|
||||
}
|
||||
|
||||
func TestIntegrationDeletePublicDashboard(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping integration test in short mode")
|
||||
}
|
||||
testutil.SkipIntegrationTestInShortMode(t)
|
||||
|
||||
pubdash := &PublicDashboard{Uid: "2", OrgId: 1, DashboardUid: "uid"}
|
||||
|
||||
type mockFindResponse struct {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user