Replace check for integration tests. (#110707)

* Replace check for integration tests.
* Revert changes in pkg/tsdb/mysql packages.
* Fix formatting of few tests.
This commit is contained in:
Peter Štibraný
2025-09-08 15:49:49 +02:00
committed by GitHub
parent 544872d117
commit 7fd9ab9481
218 changed files with 1130 additions and 1630 deletions
@@ -15,12 +15,12 @@ import (
"github.com/grafana/grafana/pkg/infra/db"
"github.com/grafana/grafana/pkg/server"
"github.com/grafana/grafana/pkg/util/testutil"
)
func TestIntegration_AdminApiReencrypt_Enterprise(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
getSecretsFunctions := map[string]func(*testing.T, *server.TestEnv) map[int]secret{}
getSecretsFunctions["settings"] = func(t *testing.T, env *server.TestEnv) map[int]secret {
return getSettingSecrets(t, env.SQLStore)
@@ -21,6 +21,7 @@ import (
"github.com/grafana/grafana/pkg/services/ngalert/notifier"
"github.com/grafana/grafana/pkg/tests/testinfra"
"github.com/grafana/grafana/pkg/tests/testsuite"
"github.com/grafana/grafana/pkg/util/testutil"
)
func TestMain(m *testing.M) {
@@ -28,9 +29,8 @@ func TestMain(m *testing.M) {
}
func TestIntegration_AdminApiReencrypt(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
const (
dataSourceTable = "data_source"
secretsTable = "secrets"
@@ -24,12 +24,12 @@ import (
"github.com/grafana/grafana/pkg/services/quota/quotatest"
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/tests/testinfra"
"github.com/grafana/grafana/pkg/util/testutil"
)
func TestIntegrationAdminConfiguration_SendingToExternalAlertmanagers(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
const disableOrgID int64 = 2
@@ -9,12 +9,11 @@ import (
apimodels "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
"github.com/grafana/grafana/pkg/tests/testinfra"
"github.com/grafana/grafana/pkg/util/testutil"
)
func TestIntegrationAlertmanagerExtraConfigMerging(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
@@ -23,12 +23,12 @@ import (
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/tests/testinfra"
"github.com/grafana/grafana/pkg/util"
"github.com/grafana/grafana/pkg/util/testutil"
)
func TestIntegrationSilenceAuth(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -22,12 +22,12 @@ import (
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/tests/testinfra"
"github.com/grafana/grafana/pkg/util"
"github.com/grafana/grafana/pkg/util/testutil"
)
func TestIntegrationAMConfigAccess(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -357,9 +357,8 @@ func TestIntegrationAMConfigAccess(t *testing.T) {
}
func TestIntegrationAlertmanagerCreateSilence(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableLegacyAlerting: true,
@@ -510,11 +509,10 @@ func TestIntegrationAlertmanagerCreateSilence(t *testing.T) {
}
func TestIntegrationAlertmanagerStatus(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
testutil.SkipIntegrationTestInShortMode(t)
// Setup Grafana and its Database
// Setup Grafana and its Database
}
testinfra.SQLiteIntegrationTest(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -13,12 +13,12 @@ import (
"github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/tests/testinfra"
"github.com/grafana/grafana/pkg/util/testutil"
)
func TestIntegrationAvailableChannels(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -12,13 +12,14 @@ import (
"github.com/grafana/grafana/pkg/services/featuremgmt"
apimodels "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
"github.com/grafana/grafana/pkg/tests/testinfra"
"github.com/grafana/grafana/pkg/util/testutil"
)
func TestIntegrationConvertPrometheusAlertmanagerEndpoints(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
// Setup Grafana with alerting import feature flag enabled
}
testutil.SkipIntegrationTestInShortMode(t)
// Setup Grafana with alerting import feature flag enabled
testinfra.SQLiteIntegrationTest(t)
dir, gpath := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -330,9 +331,8 @@ receivers:
}
func TestIntegrationConvertPrometheusAlertmanagerEndpoints_FeatureFlagDisabled(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
dir, gpath := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -13,6 +13,7 @@ import (
apimodels "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
"github.com/grafana/grafana/pkg/tests/testinfra"
"github.com/grafana/grafana/pkg/util"
"github.com/grafana/grafana/pkg/util/testutil"
)
const (
@@ -20,11 +21,10 @@ const (
)
func TestIntegrationConvertPrometheusNotificationSettings(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
testutil.SkipIntegrationTestInShortMode(t)
// Setup Grafana and its Database
// Setup Grafana and its Database
}
testinfra.SQLiteIntegrationTest(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -18,6 +18,7 @@ import (
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/tests/testinfra"
"github.com/grafana/grafana/pkg/util"
"github.com/grafana/grafana/pkg/util/testutil"
)
const (
@@ -106,9 +107,8 @@ var (
)
func TestIntegrationConvertPrometheusEndpoints_RecordingRuleTargetDatasource(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
runTest := func(t *testing.T, enableLokiPaths bool) {
testinfra.SQLiteIntegrationTest(t)
@@ -175,9 +175,8 @@ func TestIntegrationConvertPrometheusEndpoints_RecordingRuleTargetDatasource(t *
}
func TestIntegrationConvertPrometheusEndpoints(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
runTest := func(t *testing.T, enableLokiPaths bool, postContentType string) {
testinfra.SQLiteIntegrationTest(t)
@@ -383,9 +382,8 @@ func TestIntegrationConvertPrometheusEndpoints(t *testing.T) {
}
func TestIntegrationConvertPrometheusEndpoints_UpdateRule(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
runTest := func(t *testing.T, enableLokiPaths bool) {
testinfra.SQLiteIntegrationTest(t)
@@ -466,9 +464,8 @@ func TestIntegrationConvertPrometheusEndpoints_UpdateRule(t *testing.T) {
}
func TestIntegrationConvertPrometheusEndpoints_Conflict(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
runTest := func(t *testing.T, enableLokiPaths bool) {
testinfra.SQLiteIntegrationTest(t)
@@ -550,9 +547,8 @@ func TestIntegrationConvertPrometheusEndpoints_Conflict(t *testing.T) {
}
func TestIntegrationConvertPrometheusEndpoints_CreatePausedRules(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
runTest := func(t *testing.T, enableLokiPaths bool) {
testinfra.SQLiteIntegrationTest(t)
@@ -660,9 +656,8 @@ func TestIntegrationConvertPrometheusEndpoints_CreatePausedRules(t *testing.T) {
}
func TestIntegrationConvertPrometheusEndpoints_FolderUIDHeader(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
runTest := func(t *testing.T, enableLokiPaths bool) {
testinfra.SQLiteIntegrationTest(t)
@@ -759,9 +754,8 @@ func TestIntegrationConvertPrometheusEndpoints_FolderUIDHeader(t *testing.T) {
}
func TestIntegrationConvertPrometheusEndpoints_Provenance(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
runTest := func(t *testing.T, enableLokiPaths bool) {
testinfra.SQLiteIntegrationTest(t)
@@ -871,9 +865,8 @@ func TestIntegrationConvertPrometheusEndpoints_Provenance(t *testing.T) {
}
func TestIntegrationConvertPrometheusEndpoints_Delete(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
runTest := func(t *testing.T, enableLokiPaths bool) {
testinfra.SQLiteIntegrationTest(t)
@@ -1168,9 +1161,8 @@ func TestIntegrationConvertPrometheusEndpoints_Delete(t *testing.T) {
}
func TestIntegrationConvertPrometheusEndpoints_Editor(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
dir, gpath := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -1219,9 +1211,8 @@ func TestIntegrationConvertPrometheusEndpoints_Editor(t *testing.T) {
}
func TestIntegrationConvertPrometheusEndpoints_GroupLabels(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
dir, gpath := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
+5 -6
View File
@@ -18,12 +18,12 @@ import (
"github.com/grafana/grafana/pkg/services/quota/quotaimpl"
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/tests/testinfra"
"github.com/grafana/grafana/pkg/util/testutil"
)
func TestIntegration_NamespacingForRules(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
dir, p := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableLegacyAlerting: true,
EnableUnifiedAlerting: true,
@@ -218,9 +218,8 @@ func TestIntegration_NamespacingForRules(t *testing.T) {
}
func TestIntegration_NamespacingForPrometheusRules(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
dir, p := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableLegacyAlerting: true,
EnableUnifiedAlerting: true,
@@ -37,12 +37,12 @@ import (
"github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/tests/testinfra"
"github.com/grafana/grafana/pkg/util/testutil"
)
func TestIntegrationTestReceivers(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
t.Run("assert no receivers returns 400 Bad Request", func(t *testing.T) {
@@ -547,9 +547,8 @@ func TestIntegrationTestReceivers(t *testing.T) {
}
func TestIntegrationTestReceiversAlertCustomization(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
t.Run("assert custom annotations and labels are sent", func(t *testing.T) {
@@ -837,9 +836,8 @@ func TestIntegrationTestReceiversAlertCustomization(t *testing.T) {
}
func TestIntegrationNotificationChannels(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -25,15 +25,15 @@ import (
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/tests/testinfra"
"github.com/grafana/grafana/pkg/util"
"github.com/grafana/grafana/pkg/util/testutil"
)
// Declare respModel at the function level
var respModel apimodels.UpdateRuleGroupResponse
func TestIntegrationPrometheusRules(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -362,9 +362,8 @@ func TestIntegrationPrometheusRules(t *testing.T) {
}
func TestIntegrationPrometheusRulesFilterByDashboard(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -696,9 +695,8 @@ func TestIntegrationPrometheusRulesFilterByDashboard(t *testing.T) {
}
func TestIntegrationPrometheusRulesPermissions(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
+11 -15
View File
@@ -30,6 +30,7 @@ import (
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/tests/testinfra"
"github.com/grafana/grafana/pkg/util"
"github.com/grafana/grafana/pkg/util/testutil"
)
func createRuleWithNotificationSettings(t *testing.T, client apiClient, folder string, nfSettings *definitions.AlertRuleNotificationSettings) (definitions.PostableRuleGroupConfig, string) {
@@ -77,9 +78,8 @@ func createRuleWithNotificationSettings(t *testing.T, client apiClient, folder s
}
func TestIntegrationProvisioning(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -562,9 +562,8 @@ func TestIntegrationProvisioning(t *testing.T) {
}
func TestIntegrationProvisioningRules(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -986,9 +985,8 @@ func createTestRequest(method string, url string, user string, body string) *htt
}
func TestIntegrationExportFileProvision(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
dir, p := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableLegacyAlerting: true,
EnableUnifiedAlerting: true,
@@ -1086,9 +1084,8 @@ func TestIntegrationExportFileProvision(t *testing.T) {
}
func TestIntegrationExportFileProvisionMixed(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
dir, p := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableLegacyAlerting: true,
EnableUnifiedAlerting: true,
@@ -1135,9 +1132,8 @@ func TestIntegrationExportFileProvisionMixed(t *testing.T) {
}
func TestIntegrationExportFileProvisionContactPoints(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
dir, p := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableLegacyAlerting: true,
EnableUnifiedAlerting: true,
@@ -13,14 +13,14 @@ import (
apimodels "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
"github.com/grafana/grafana/pkg/tests/alertmanager"
"github.com/grafana/grafana/pkg/tests/testinfra"
"github.com/grafana/grafana/pkg/util/testutil"
)
// TestIntegrationRemoteAlertmanagerConfigUpload tests that when we post an alertmanager
// configuration to Grafana with remote alertmanager enabled, it gets uploaded to the remote Mimir.
func TestIntegrationRemoteAlertmanagerConfigUpload(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
s, err := alertmanager.NewAlertmanagerScenario()
@@ -136,9 +136,8 @@ receivers:
// a historical alertmanager configuration with extra configs, it gets properly decrypted
// and uploaded to the remote Mimir.
func TestIntegrationRemoteAlertmanagerHistoricalConfigActivation(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
s, err := alertmanager.NewAlertmanagerScenario()
@@ -12,14 +12,14 @@ import (
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/tests/testinfra"
"github.com/grafana/grafana/pkg/util"
"github.com/grafana/grafana/pkg/util/testutil"
)
func TestIntegrationAlertRulePauseNamespace(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
testutil.SkipIntegrationTestInShortMode(t)
// Setup Grafana and its Database
// Setup Grafana and its Database
}
testinfra.SQLiteIntegrationTest(t)
dir, p := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
+53 -74
View File
@@ -39,17 +39,17 @@ import (
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/tests/testinfra"
"github.com/grafana/grafana/pkg/util"
"github.com/grafana/grafana/pkg/util/testutil"
)
//go:embed test-data/*.*
var testData embed.FS
func TestIntegrationAlertRulePermissions(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
testutil.SkipIntegrationTestInShortMode(t)
// Setup Grafana and its Database
// Setup Grafana and its Database
}
testinfra.SQLiteIntegrationTest(t)
dir, p := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -353,11 +353,10 @@ func TestIntegrationAlertRulePermissions(t *testing.T) {
}
func TestIntegrationAlertRuleNestedPermissions(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
testutil.SkipIntegrationTestInShortMode(t)
// Setup Grafana and its Database
// Setup Grafana and its Database
}
testinfra.SQLiteIntegrationTest(t)
dir, p := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -791,9 +790,8 @@ func TestAlertRulePostExport(t *testing.T) {
}
func TestIntegrationAlertRuleEditorSettings(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
const folderName = "folder1"
@@ -966,11 +964,10 @@ func TestIntegrationAlertRuleEditorSettings(t *testing.T) {
}
func TestIntegrationAlertRuleConflictingTitle(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
testutil.SkipIntegrationTestInShortMode(t)
// Setup Grafana and its Database
// Setup Grafana and its Database
}
testinfra.SQLiteIntegrationTest(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -1050,9 +1047,8 @@ func TestIntegrationAlertRuleConflictingTitle(t *testing.T) {
}
func TestIntegrationRulerRulesFilterByDashboard(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -1423,11 +1419,10 @@ func TestIntegrationRulerRulesFilterByDashboard(t *testing.T) {
}
func TestIntegrationRuleGroupSequence(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
testutil.SkipIntegrationTestInShortMode(t)
// Setup Grafana and its Database
// Setup Grafana and its Database
}
testinfra.SQLiteIntegrationTest(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -1533,9 +1528,8 @@ func TestIntegrationRuleGroupSequence(t *testing.T) {
}
func TestIntegrationRuleCreate(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableLegacyAlerting: true,
@@ -1671,11 +1665,10 @@ func TestIntegrationRuleCreate(t *testing.T) {
}
func TestIntegrationRuleUpdate(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
testutil.SkipIntegrationTestInShortMode(t)
// Setup Grafana and its Database
// Setup Grafana and its Database
}
testinfra.SQLiteIntegrationTest(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -1949,9 +1942,8 @@ func TestIntegrationRuleUpdate(t *testing.T) {
}
func TestIntegrationAlertAndGroupsQuery(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -2111,11 +2103,10 @@ func TestIntegrationAlertAndGroupsQuery(t *testing.T) {
}
func TestIntegrationRulerAccess(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
testutil.SkipIntegrationTestInShortMode(t)
// Setup Grafana and its Database
// Setup Grafana and its Database
}
testinfra.SQLiteIntegrationTest(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -2227,11 +2218,10 @@ func TestIntegrationRulerAccess(t *testing.T) {
}
func TestIntegrationEval(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
testutil.SkipIntegrationTestInShortMode(t)
// Setup Grafana and its Database
// Setup Grafana and its Database
}
testinfra.SQLiteIntegrationTest(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -2511,11 +2501,10 @@ func TestIntegrationEval(t *testing.T) {
}
func TestIntegrationQuota(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
testutil.SkipIntegrationTestInShortMode(t)
// Setup Grafana and its Database
// Setup Grafana and its Database
}
testinfra.SQLiteIntegrationTest(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -2726,9 +2715,8 @@ func TestIntegrationQuota(t *testing.T) {
}
func TestIntegrationDeleteFolderWithRules(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
opts := testinfra.GrafanaOpts{
@@ -2895,11 +2883,10 @@ func TestIntegrationDeleteFolderWithRules(t *testing.T) {
}
func TestIntegrationAlertRuleCRUD(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
testutil.SkipIntegrationTestInShortMode(t)
// Setup Grafana and its Database
// Setup Grafana and its Database
}
testinfra.SQLiteIntegrationTest(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -4180,11 +4167,10 @@ func TestIntegrationAlertRuleCRUD(t *testing.T) {
}
func TestIntegrationRulePause(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
testutil.SkipIntegrationTestInShortMode(t)
// Setup Grafana and its Database
// Setup Grafana and its Database
}
testinfra.SQLiteIntegrationTest(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -4314,11 +4300,10 @@ func TestIntegrationRulePause(t *testing.T) {
}
func TestIntegrationHysteresisRule(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
testutil.SkipIntegrationTestInShortMode(t)
// Setup Grafana and its Database. Scheduler is set to evaluate every 1 second
// Setup Grafana and its Database. Scheduler is set to evaluate every 1 second
}
testinfra.SQLiteIntegrationTest(t)
dir, p := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -4392,9 +4377,8 @@ func TestIntegrationHysteresisRule(t *testing.T) {
}
func TestIntegrationRuleNotificationSettings(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
dir, p := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -4663,9 +4647,7 @@ func TestIntegrationRuleNotificationSettings(t *testing.T) {
}
func TestIntegrationRuleUpdateAllDatabases(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableLegacyAlerting: true,
@@ -4718,9 +4700,8 @@ func TestIntegrationRuleUpdateAllDatabases(t *testing.T) {
}
func TestIntegrationRuleVersions(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
dir, p := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -4810,9 +4791,8 @@ func TestIntegrationRuleVersions(t *testing.T) {
}
func TestIntegrationRuleSoftDelete(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
dir, p := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -4923,9 +4903,8 @@ func TestIntegrationRuleSoftDelete(t *testing.T) {
}
func TestIntegrationRulePermanentlyDelete(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
testinfra.SQLiteIntegrationTest(t)
dir, p := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
@@ -21,6 +21,7 @@ import (
"github.com/grafana/grafana/pkg/tests"
"github.com/grafana/grafana/pkg/tests/testinfra"
"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 TestIntegrationAnnotations(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableAnonymous: true,
@@ -19,6 +19,7 @@ import (
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/tests/testinfra"
"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 TestIntegrationAzureMonitor(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
t.Skip("skipping integration test due to flakiness")
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableAnonymous: true,
@@ -13,12 +13,12 @@ import (
"github.com/grafana/grafana/pkg/services/datasources"
"github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/util/testutil"
)
func TestIntegrationCreateCorrelation(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
ctx := NewTestEnv(t)
adminUser := ctx.createUser(user.CreateUserCommand{
@@ -13,12 +13,12 @@ import (
"github.com/grafana/grafana/pkg/services/datasources"
"github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/util/testutil"
)
func TestIntegrationDeleteCorrelation(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
ctx := NewTestEnv(t)
adminUser := ctx.createUser(user.CreateUserCommand{
@@ -13,12 +13,12 @@ import (
"github.com/grafana/grafana/pkg/services/datasources"
"github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/util/testutil"
)
func TestIntegrationCreateOrUpdateCorrelation(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
ctx := NewTestEnv(t)
adminUser := ctx.createUser(user.CreateUserCommand{
@@ -15,12 +15,12 @@ import (
"github.com/grafana/grafana/pkg/services/datasources"
"github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/util/testutil"
)
func TestIntegrationReadCorrelation(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
ctx := NewTestEnv(t)
adminUser := ctx.createUser(user.CreateUserCommand{
@@ -13,12 +13,12 @@ import (
"github.com/grafana/grafana/pkg/services/datasources"
"github.com/grafana/grafana/pkg/services/org"
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/util/testutil"
)
func TestIntegrationUpdateCorrelation(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
ctx := NewTestEnv(t)
adminUser := ctx.createUser(user.CreateUserCommand{
@@ -28,6 +28,7 @@ import (
"github.com/grafana/grafana/pkg/tests/testinfra"
"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) {
@@ -35,9 +36,7 @@ func TestMain(m *testing.M) {
}
func TestIntegrationDashboardServiceValidation(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableAnonymous: true,
@@ -984,9 +983,7 @@ func postDashboard(t *testing.T, grafanaListedAddr, user, password string, paylo
}
func TestIntegrationDashboardServicePermissions(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableAnonymous: true,
@@ -17,6 +17,7 @@ import (
"github.com/grafana/grafana/pkg/services/datasources"
"github.com/grafana/grafana/pkg/tests/testinfra"
"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 TestIntegrationElasticsearch(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableAnonymous: true,
})
+8 -18
View File
@@ -13,6 +13,7 @@ import (
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/tests"
"github.com/grafana/grafana/pkg/tests/testinfra"
"github.com/grafana/grafana/pkg/util/testutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
@@ -36,9 +37,7 @@ func setFolderPermissions(t *testing.T, grafanaListedAddr string, folderUID stri
}
func TestIntegrationFolderServiceGetFolder(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
dir, p := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableLegacyAlerting: true,
@@ -107,9 +106,7 @@ func TestIntegrationFolderServiceGetFolder(t *testing.T) {
}
func TestIntegrationUpdateFolder(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableAnonymous: true,
@@ -198,9 +195,8 @@ func TestIntegrationCreateFolder(t *testing.T) {
}
func TestIntegrationNestedFolders(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableAnonymous: true,
EnableQuota: true,
@@ -348,9 +344,7 @@ func TestIntegrationNestedFolders(t *testing.T) {
}
func TestIntegrationSharedWithMe(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
dir, p := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableLegacyAlerting: true,
@@ -401,9 +395,7 @@ func TestIntegrationSharedWithMe(t *testing.T) {
}
func TestIntegrationBasicRoles(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
dir, p := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableLegacyAlerting: true,
@@ -538,9 +530,7 @@ func TestIntegrationBasicRoles(t *testing.T) {
}
func TestIntegrationFineGrainedPermissions(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
dir, p := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableLegacyAlerting: true,
+3 -3
View File
@@ -17,6 +17,7 @@ import (
"github.com/grafana/grafana/pkg/services/datasources"
"github.com/grafana/grafana/pkg/tests/testinfra"
"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 TestIntegrationGraphite(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableAnonymous: true,
})
+2 -3
View File
@@ -19,6 +19,7 @@ import (
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/tests/testinfra"
"github.com/grafana/grafana/pkg/tests/testsuite"
"github.com/grafana/grafana/pkg/util/testutil"
)
func TestMain(m *testing.M) {
@@ -27,10 +28,8 @@ func TestMain(m *testing.M) {
func TestIntegrationInflux(t *testing.T) {
t.Skip("skipping due to flaky test")
testutil.SkipIntegrationTestInShortMode(t)
if testing.Short() {
t.Skip("skipping integration test")
}
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableAnonymous: true,
})
+3 -3
View File
@@ -17,6 +17,7 @@ import (
"github.com/grafana/grafana/pkg/services/datasources"
"github.com/grafana/grafana/pkg/tests/testinfra"
"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 TestIntegrationLoki(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableAnonymous: true,
})
+3 -3
View File
@@ -17,6 +17,7 @@ import (
"github.com/grafana/grafana/pkg/services/datasources"
"github.com/grafana/grafana/pkg/tests/testinfra"
"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 TestIntegrationOpenTSDB(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableAnonymous: true,
})
+3 -6
View File
@@ -29,6 +29,7 @@ import (
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/tests/testinfra"
"github.com/grafana/grafana/pkg/tests/testsuite"
"github.com/grafana/grafana/pkg/util/testutil"
)
const (
@@ -44,9 +45,7 @@ func TestMain(m *testing.M) {
}
func TestIntegrationPlugins(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
dir, cfgPath := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
PluginAdminEnabled: true,
@@ -144,9 +143,7 @@ func TestIntegrationPlugins(t *testing.T) {
}
func TestIntegrationPluginAssets(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
type testCase struct {
desc string
@@ -26,6 +26,7 @@ import (
"github.com/grafana/grafana/pkg/services/datasources"
"github.com/grafana/grafana/pkg/tests/testinfra"
"github.com/grafana/grafana/pkg/tests/testsuite"
"github.com/grafana/grafana/pkg/util/testutil"
)
const loginCookieName = "grafana_session"
@@ -35,9 +36,7 @@ func TestMain(m *testing.M) {
}
func TestIntegrationBackendPlugins(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
oauthToken := &oauth2.Token{
TokenType: "bearer",
+3 -3
View File
@@ -16,6 +16,7 @@ import (
"github.com/grafana/grafana/pkg/services/datasources"
"github.com/grafana/grafana/pkg/tests/testinfra"
"github.com/grafana/grafana/pkg/tests/testsuite"
"github.com/grafana/grafana/pkg/util/testutil"
)
func TestMain(m *testing.M) {
@@ -23,9 +24,8 @@ func TestMain(m *testing.M) {
}
func TestIntegrationPrometheus(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
testutil.SkipIntegrationTestInShortMode(t)
dir, path := testinfra.CreateGrafDir(t, testinfra.GrafanaOpts{
DisableAnonymous: true,
})
+3 -3
View File
@@ -20,6 +20,7 @@ import (
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/tests/testinfra"
"github.com/grafana/grafana/pkg/tests/testsuite"
"github.com/grafana/grafana/pkg/util/testutil"
)
func TestMain(m *testing.M) {
@@ -27,9 +28,8 @@ func TestMain(m *testing.M) {
}
func TestIntegrationAdminStats(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
testutil.SkipIntegrationTestInShortMode(t)
t.Run("with unified alerting enabled", func(t *testing.T) {
url := grafanaSetup(t, testinfra.GrafanaOpts{
DisableLegacyAlerting: true,