mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Rename integration tests (#49438)
* Chore: Rename integration tests * Remove one Integration Co-authored-by: Ida Furjesova <ida.furjesova@grafana.com>
This commit is contained in:
@@ -172,7 +172,7 @@ func runTests(createCases func() []fsTestCase, t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFsStorage(t *testing.T) {
|
func TestIntegrationFsStorage(t *testing.T) {
|
||||||
//skipTest := true
|
//skipTest := true
|
||||||
emptyContents := make([]byte, 0)
|
emptyContents := make([]byte, 0)
|
||||||
pngImage, _ := base64.StdEncoding.DecodeString(pngImageBase64)
|
pngImage, _ := base64.StdEncoding.DecodeString(pngImageBase64)
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ func (t *TestCase) Value() string {
|
|||||||
return fmt.Sprintf("%d:%s:%s:%d", t.OrgId, t.Namespace, t.Key, t.Revision)
|
return fmt.Sprintf("%d:%s:%s:%d", t.OrgId, t.Namespace, t.Key, t.Revision)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestKVStore(t *testing.T) {
|
func TestIntegrationKVStore(t *testing.T) {
|
||||||
kv := createTestableKVStore(t)
|
kv := createTestableKVStore(t)
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestServerLok(t *testing.T) {
|
func TestIntegrationServerLok(t *testing.T) {
|
||||||
sl := createTestableServerLock(t)
|
sl := createTestableServerLock(t)
|
||||||
|
|
||||||
counter := 0
|
counter := 0
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestEngineTimeouts(t *testing.T) {
|
func TestIntegrationEngineTimeouts(t *testing.T) {
|
||||||
usMock := &usagestats.UsageStatsMock{T: t}
|
usMock := &usagestats.UsageStatsMock{T: t}
|
||||||
tracer, err := tracing.InitializeTracerForTest()
|
tracer, err := tracing.InitializeTracerForTest()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/services/sqlstore"
|
"github.com/grafana/grafana/pkg/services/sqlstore"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDashboardFolderDataAccess(t *testing.T) {
|
func TestIntegrationDashboardFolderDataAccess(t *testing.T) {
|
||||||
t.Run("Testing DB", func(t *testing.T) {
|
t.Run("Testing DB", func(t *testing.T) {
|
||||||
var sqlStore *sqlstore.SQLStore
|
var sqlStore *sqlstore.SQLStore
|
||||||
var folder, dashInRoot, childDash *models.Dashboard
|
var folder, dashInRoot, childDash *models.Dashboard
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDashboardProvisioningTest(t *testing.T) {
|
func TestIntegrationDashboardProvisioningTest(t *testing.T) {
|
||||||
sqlStore := sqlstore.InitTestDB(t)
|
sqlStore := sqlstore.InitTestDB(t)
|
||||||
dashboardStore := ProvideDashboardStore(sqlStore)
|
dashboardStore := ProvideDashboardStore(sqlStore)
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/setting"
|
"github.com/grafana/grafana/pkg/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDashboardDataAccess(t *testing.T) {
|
func TestIntegrationDashboardDataAccess(t *testing.T) {
|
||||||
var sqlStore *sqlstore.SQLStore
|
var sqlStore *sqlstore.SQLStore
|
||||||
var savedFolder, savedDash, savedDash2 *models.Dashboard
|
var savedFolder, savedDash, savedDash2 *models.Dashboard
|
||||||
var dashboardStore *DashboardStore
|
var dashboardStore *DashboardStore
|
||||||
@@ -479,7 +479,7 @@ func TestDashboardDataAccess(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDashboardDataAccessGivenPluginWithImportedDashboards(t *testing.T) {
|
func TestIntegrationDashboardDataAccessGivenPluginWithImportedDashboards(t *testing.T) {
|
||||||
sqlStore := sqlstore.InitTestDB(t)
|
sqlStore := sqlstore.InitTestDB(t)
|
||||||
dashboardStore := ProvideDashboardStore(sqlStore)
|
dashboardStore := ProvideDashboardStore(sqlStore)
|
||||||
pluginId := "test-app"
|
pluginId := "test-app"
|
||||||
@@ -498,7 +498,7 @@ func TestDashboardDataAccessGivenPluginWithImportedDashboards(t *testing.T) {
|
|||||||
require.Equal(t, len(query.Result), 2)
|
require.Equal(t, len(query.Result), 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDashboard_SortingOptions(t *testing.T) {
|
func TestIntegrationDashboard_SortingOptions(t *testing.T) {
|
||||||
sqlStore := sqlstore.InitTestDB(t)
|
sqlStore := sqlstore.InitTestDB(t)
|
||||||
dashboardStore := ProvideDashboardStore(sqlStore)
|
dashboardStore := ProvideDashboardStore(sqlStore)
|
||||||
|
|
||||||
@@ -545,7 +545,7 @@ func TestDashboard_SortingOptions(t *testing.T) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDashboard_Filter(t *testing.T) {
|
func TestIntegrationDashboard_Filter(t *testing.T) {
|
||||||
sqlStore := sqlstore.InitTestDB(t)
|
sqlStore := sqlstore.InitTestDB(t)
|
||||||
dashboardStore := ProvideDashboardStore(sqlStore)
|
dashboardStore := ProvideDashboardStore(sqlStore)
|
||||||
insertTestDashboard(t, dashboardStore, "Alfa", 1, 0, false)
|
insertTestDashboard(t, dashboardStore, "Alfa", 1, 0, false)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDashboardAclDataAccess(t *testing.T) {
|
func TestIntegrationDashboardAclDataAccess(t *testing.T) {
|
||||||
var sqlStore *sqlstore.SQLStore
|
var sqlStore *sqlstore.SQLStore
|
||||||
var currentUser models.User
|
var currentUser models.User
|
||||||
var savedFolder, childDash *models.Dashboard
|
var savedFolder, childDash *models.Dashboard
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import (
|
|||||||
|
|
||||||
const testOrgID int64 = 1
|
const testOrgID int64 = 1
|
||||||
|
|
||||||
func TestIntegratedDashboardService(t *testing.T) {
|
func TestIntegrationIntegratedDashboardService(t *testing.T) {
|
||||||
t.Run("Given saved folders and dashboards in organization A", func(t *testing.T) {
|
t.Run("Given saved folders and dashboards in organization A", func(t *testing.T) {
|
||||||
// Basic validation tests
|
// Basic validation tests
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/setting"
|
"github.com/grafana/grafana/pkg/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDashboardService(t *testing.T) {
|
func TestIntegrationDashboardService(t *testing.T) {
|
||||||
t.Run("Dashboard service tests", func(t *testing.T) {
|
t.Run("Dashboard service tests", func(t *testing.T) {
|
||||||
fakeStore := m.FakeDashboardStore{}
|
fakeStore := m.FakeDashboardStore{}
|
||||||
defer fakeStore.AssertExpectations(t)
|
defer fakeStore.AssertExpectations(t)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import (
|
|||||||
var orgID = int64(1)
|
var orgID = int64(1)
|
||||||
var user = &models.SignedInUser{UserId: 1}
|
var user = &models.SignedInUser{UserId: 1}
|
||||||
|
|
||||||
func TestProvideFolderService(t *testing.T) {
|
func TestIntegrationProvideFolderService(t *testing.T) {
|
||||||
t.Run("should register scope resolvers", func(t *testing.T) {
|
t.Run("should register scope resolvers", func(t *testing.T) {
|
||||||
store := &dashboards.FakeDashboardStore{}
|
store := &dashboards.FakeDashboardStore{}
|
||||||
cfg := setting.NewCfg()
|
cfg := setting.NewCfg()
|
||||||
@@ -44,7 +44,7 @@ func TestProvideFolderService(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFolderService(t *testing.T) {
|
func TestIntegrationFolderService(t *testing.T) {
|
||||||
t.Run("Folder service tests", func(t *testing.T) {
|
t.Run("Folder service tests", func(t *testing.T) {
|
||||||
store := &dashboards.FakeDashboardStore{}
|
store := &dashboards.FakeDashboardStore{}
|
||||||
cfg := setting.NewCfg()
|
cfg := setting.NewCfg()
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLiveMessage(t *testing.T) {
|
func TestIntegrationLiveMessage(t *testing.T) {
|
||||||
storage := SetupTestStorage(t)
|
storage := SetupTestStorage(t)
|
||||||
|
|
||||||
getQuery := &models.GetLiveMessageQuery{
|
getQuery := &models.GetLiveMessageQuery{
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAlertManagerHash(t *testing.T) {
|
func TestIntegrationAlertManagerHash(t *testing.T) {
|
||||||
sqlStore := sqlstore.InitTestDB(t)
|
sqlStore := sqlstore.InitTestDB(t)
|
||||||
store := &DBstore{
|
store := &DBstore{
|
||||||
SQLStore: sqlStore,
|
SQLStore: sqlStore,
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ func addToken(img *store.Image) *store.Image {
|
|||||||
return img
|
return img
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSaveAndGetImage(t *testing.T) {
|
func TestIntegrationSaveAndGetImage(t *testing.T) {
|
||||||
mockTimeNow()
|
mockTimeNow()
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
_, dbstore := tests.SetupTestEnv(t, baseIntervalSeconds)
|
_, dbstore := tests.SetupTestEnv(t, baseIntervalSeconds)
|
||||||
@@ -92,7 +92,7 @@ func TestSaveAndGetImage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDeleteExpiredImages(t *testing.T) {
|
func TestIntegrationDeleteExpiredImages(t *testing.T) {
|
||||||
mockTimeNow()
|
mockTimeNow()
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)
|
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ func mockTimeNow() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAlertInstanceOperations(t *testing.T) {
|
func TestIntegrationAlertInstanceOperations(t *testing.T) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
_, dbstore := tests.SetupTestEnv(t, baseIntervalSeconds)
|
_, dbstore := tests.SetupTestEnv(t, baseIntervalSeconds)
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestPreferencesDataAccess(t *testing.T) {
|
func TestIntegrationPreferencesDataAccess(t *testing.T) {
|
||||||
ss := sqlstore.InitTestDB(t)
|
ss := sqlstore.InitTestDB(t)
|
||||||
prefStore := sqlStore{db: ss}
|
prefStore := sqlStore{db: ss}
|
||||||
orgNavbarPreferences := pref.NavbarPreference{
|
orgNavbarPreferences := pref.NavbarPreference{
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCreateQueryInQueryHistory(t *testing.T) {
|
func TestIntegrationCreateQueryInQueryHistory(t *testing.T) {
|
||||||
testScenario(t, "When users tries to create query in query history it should succeed",
|
testScenario(t, "When users tries to create query in query history it should succeed",
|
||||||
func(t *testing.T, sc scenarioContext) {
|
func(t *testing.T, sc scenarioContext) {
|
||||||
command := CreateQueryInQueryHistoryCommand{
|
command := CreateQueryInQueryHistoryCommand{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDeleteStaleQueryFromQueryHistory(t *testing.T) {
|
func TestIntegrationDeleteStaleQueryFromQueryHistory(t *testing.T) {
|
||||||
testScenarioWithQueryInQueryHistory(t, "Stale query history can be deleted",
|
testScenarioWithQueryInQueryHistory(t, "Stale query history can be deleted",
|
||||||
func(t *testing.T, sc scenarioContext) {
|
func(t *testing.T, sc scenarioContext) {
|
||||||
olderThan := time.Now().Unix() + 60
|
olderThan := time.Now().Unix() + 60
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDeleteQueryFromQueryHistory(t *testing.T) {
|
func TestIntegrationDeleteQueryFromQueryHistory(t *testing.T) {
|
||||||
testScenarioWithQueryInQueryHistory(t, "When users tries to delete query in query history that does not exist, it should fail",
|
testScenarioWithQueryInQueryHistory(t, "When users tries to delete query in query history that does not exist, it should fail",
|
||||||
func(t *testing.T, sc scenarioContext) {
|
func(t *testing.T, sc scenarioContext) {
|
||||||
resp := sc.service.deleteHandler(sc.reqContext)
|
resp := sc.service.deleteHandler(sc.reqContext)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestEnforceRowLimitInQueryHistory(t *testing.T) {
|
func TestIntegrationEnforceRowLimitInQueryHistory(t *testing.T) {
|
||||||
testScenarioWithQueryInQueryHistory(t, "Enforce limit for query_history",
|
testScenarioWithQueryInQueryHistory(t, "Enforce limit for query_history",
|
||||||
func(t *testing.T, sc scenarioContext) {
|
func(t *testing.T, sc scenarioContext) {
|
||||||
limit := 0
|
limit := 0
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMigrateQueriesToQueryHistory(t *testing.T) {
|
func TestIntegrationMigrateQueriesToQueryHistory(t *testing.T) {
|
||||||
testScenario(t, "When users tries to migrate 1 query in query history it should succeed",
|
testScenario(t, "When users tries to migrate 1 query in query history it should succeed",
|
||||||
func(t *testing.T, sc scenarioContext) {
|
func(t *testing.T, sc scenarioContext) {
|
||||||
command := MigrateQueriesToQueryHistoryCommand{
|
command := MigrateQueriesToQueryHistoryCommand{
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestPatchQueryCommentInQueryHistory(t *testing.T) {
|
func TestIntegrationPatchQueryCommentInQueryHistory(t *testing.T) {
|
||||||
testScenarioWithQueryInQueryHistory(t, "When user tries to patch comment of query in query history that does not exist, it should fail",
|
testScenarioWithQueryInQueryHistory(t, "When user tries to patch comment of query in query history that does not exist, it should fail",
|
||||||
func(t *testing.T, sc scenarioContext) {
|
func(t *testing.T, sc scenarioContext) {
|
||||||
resp := sc.service.patchCommentHandler(sc.reqContext)
|
resp := sc.service.patchCommentHandler(sc.reqContext)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetQueriesFromQueryHistory(t *testing.T) {
|
func TestIntegrationGetQueriesFromQueryHistory(t *testing.T) {
|
||||||
testScenario(t, "When users tries to get query in empty query history, it should return empty result",
|
testScenario(t, "When users tries to get query in empty query history, it should return empty result",
|
||||||
func(t *testing.T, sc scenarioContext) {
|
func(t *testing.T, sc scenarioContext) {
|
||||||
sc.reqContext.Req.Form.Add("datasourceUid", "test")
|
sc.reqContext.Req.Form.Add("datasourceUid", "test")
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestStarQueryInQueryHistory(t *testing.T) {
|
func TestIntegrationStarQueryInQueryHistory(t *testing.T) {
|
||||||
testScenarioWithQueryInQueryHistory(t, "When users tries to star query in query history that does not exists, it should fail",
|
testScenarioWithQueryInQueryHistory(t, "When users tries to star query in query history that does not exists, it should fail",
|
||||||
func(t *testing.T, sc scenarioContext) {
|
func(t *testing.T, sc scenarioContext) {
|
||||||
resp := sc.service.starHandler(sc.reqContext)
|
resp := sc.service.starHandler(sc.reqContext)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestUnstarQueryInQueryHistory(t *testing.T) {
|
func TestIntegrationUnstarQueryInQueryHistory(t *testing.T) {
|
||||||
testScenarioWithQueryInQueryHistory(t, "When users tries to unstar query in query history that does not exists, it should fail",
|
testScenarioWithQueryInQueryHistory(t, "When users tries to unstar query in query history that does not exists, it should fail",
|
||||||
func(t *testing.T, sc scenarioContext) {
|
func(t *testing.T, sc scenarioContext) {
|
||||||
resp := sc.service.starHandler(sc.reqContext)
|
resp := sc.service.starHandler(sc.reqContext)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAlertNotificationSQLAccess(t *testing.T) {
|
func TestIntegrationAlertNotificationSQLAccess(t *testing.T) {
|
||||||
var sqlStore *SQLStore
|
var sqlStore *SQLStore
|
||||||
setup := func() { sqlStore = InitTestDB(t) }
|
setup := func() { sqlStore = InitTestDB(t) }
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ func resetTimeNow() {
|
|||||||
timeNow = time.Now
|
timeNow = time.Now
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAlertingDataAccess(t *testing.T) {
|
func TestIntegrationAlertingDataAccess(t *testing.T) {
|
||||||
mockTimeNow()
|
mockTimeNow()
|
||||||
defer resetTimeNow()
|
defer resetTimeNow()
|
||||||
|
|
||||||
@@ -262,7 +262,7 @@ func TestAlertingDataAccess(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPausingAlerts(t *testing.T) {
|
func TestIntegrationPausingAlerts(t *testing.T) {
|
||||||
mockTimeNow()
|
mockTimeNow()
|
||||||
defer resetTimeNow()
|
defer resetTimeNow()
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/services/sqlstore"
|
"github.com/grafana/grafana/pkg/services/sqlstore"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAnnotations(t *testing.T) {
|
func TestIntegrationAnnotations(t *testing.T) {
|
||||||
sql := sqlstore.InitTestDB(t)
|
sql := sqlstore.InitTestDB(t)
|
||||||
repo := sqlstore.NewSQLAnnotationRepo(sql)
|
repo := sqlstore.NewSQLAnnotationRepo(sql)
|
||||||
|
|
||||||
@@ -382,7 +382,7 @@ func TestAnnotations(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAnnotationListingWithRBAC(t *testing.T) {
|
func TestIntegrationAnnotationListingWithRBAC(t *testing.T) {
|
||||||
sql := sqlstore.InitTestDB(t, sqlstore.InitTestDBOpt{})
|
sql := sqlstore.InitTestDB(t, sqlstore.InitTestDBOpt{})
|
||||||
repo := sqlstore.NewSQLAnnotationRepo(sql)
|
repo := sqlstore.NewSQLAnnotationRepo(sql)
|
||||||
dashboardStore := dashboardstore.ProvideDashboardStore(sql)
|
dashboardStore := dashboardstore.ProvideDashboardStore(sql)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/services/accesscontrol"
|
"github.com/grafana/grafana/pkg/services/accesscontrol"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestApiKeyDataAccess(t *testing.T) {
|
func TestIntegrationApiKeyDataAccess(t *testing.T) {
|
||||||
mockTimeNow()
|
mockTimeNow()
|
||||||
defer resetTimeNow()
|
defer resetTimeNow()
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ func TestApiKeyDataAccess(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestApiKeyErrors(t *testing.T) {
|
func TestIntegrationApiKeyErrors(t *testing.T) {
|
||||||
mockTimeNow()
|
mockTimeNow()
|
||||||
defer resetTimeNow()
|
defer resetTimeNow()
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ type getApiKeysTestCase struct {
|
|||||||
expectedNumKeys int
|
expectedNumKeys int
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSQLStore_GetAPIKeys(t *testing.T) {
|
func TestIntegrationSQLStore_GetAPIKeys(t *testing.T) {
|
||||||
tests := []getApiKeysTestCase{
|
tests := []getApiKeysTestCase{
|
||||||
{
|
{
|
||||||
desc: "expect all keys for wildcard scope",
|
desc: "expect all keys for wildcard scope",
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDashboardSnapshotDBAccess(t *testing.T) {
|
func TestIntegrationDashboardSnapshotDBAccess(t *testing.T) {
|
||||||
sqlstore := InitTestDB(t)
|
sqlstore := InitTestDB(t)
|
||||||
|
|
||||||
origSecret := setting.SecretKey
|
origSecret := setting.SecretKey
|
||||||
@@ -144,7 +144,7 @@ func TestDashboardSnapshotDBAccess(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDeleteExpiredSnapshots(t *testing.T) {
|
func TestIntegrationDeleteExpiredSnapshots(t *testing.T) {
|
||||||
sqlstore := InitTestDB(t)
|
sqlstore := InitTestDB(t)
|
||||||
|
|
||||||
t.Run("Testing dashboard snapshots clean up", func(t *testing.T) {
|
t.Run("Testing dashboard snapshots clean up", func(t *testing.T) {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
var theme = models.ThemeDark
|
var theme = models.ThemeDark
|
||||||
var kind = models.ThumbnailKindDefault
|
var kind = models.ThumbnailKindDefault
|
||||||
|
|
||||||
func TestSqlStorage(t *testing.T) {
|
func TestIntegrationSqlStorage(t *testing.T) {
|
||||||
|
|
||||||
var sqlStore *SQLStore
|
var sqlStore *SQLStore
|
||||||
var savedFolder *models.Dashboard
|
var savedFolder *models.Dashboard
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ func updateTestDashboard(t *testing.T, sqlStore *SQLStore, dashboard *models.Das
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetDashboardVersion(t *testing.T) {
|
func TestIntegrationGetDashboardVersion(t *testing.T) {
|
||||||
sqlStore := InitTestDB(t)
|
sqlStore := InitTestDB(t)
|
||||||
|
|
||||||
t.Run("Get a Dashboard ID and version ID", func(t *testing.T) {
|
t.Run("Get a Dashboard ID and version ID", func(t *testing.T) {
|
||||||
@@ -118,7 +118,7 @@ func TestGetDashboardVersion(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetDashboardVersions(t *testing.T) {
|
func TestIntegrationGetDashboardVersions(t *testing.T) {
|
||||||
sqlStore := InitTestDB(t)
|
sqlStore := InitTestDB(t)
|
||||||
savedDash := insertTestDashboard(t, sqlStore, "test dash 43", 1, 0, false, "diff-all")
|
savedDash := insertTestDashboard(t, sqlStore, "test dash 43", 1, 0, false, "diff-all")
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ func TestGetDashboardVersions(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDeleteExpiredVersions(t *testing.T) {
|
func TestIntegrationDeleteExpiredVersions(t *testing.T) {
|
||||||
versionsToKeep := 5
|
versionsToKeep := 5
|
||||||
versionsToWrite := 10
|
versionsToWrite := 10
|
||||||
setting.DashboardVersionsToKeep = versionsToKeep
|
setting.DashboardVersionsToKeep = versionsToKeep
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDataAccess(t *testing.T) {
|
func TestIntegrationDataAccess(t *testing.T) {
|
||||||
defaultAddDatasourceCommand := models.AddDataSourceCommand{
|
defaultAddDatasourceCommand := models.AddDataSourceCommand{
|
||||||
OrgId: 10,
|
OrgId: 10,
|
||||||
Name: "nisse",
|
Name: "nisse",
|
||||||
@@ -431,7 +431,7 @@ func TestDataAccess(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetDefaultDataSource(t *testing.T) {
|
func TestIntegrationGetDefaultDataSource(t *testing.T) {
|
||||||
InitTestDB(t)
|
InitTestDB(t)
|
||||||
|
|
||||||
t.Run("should return error if there is no default datasource", func(t *testing.T) {
|
t.Run("should return error if there is no default datasource", func(t *testing.T) {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetDBHealthQuery(t *testing.T) {
|
func TestIntegrationGetDBHealthQuery(t *testing.T) {
|
||||||
store := InitTestDB(t)
|
store := InitTestDB(t)
|
||||||
|
|
||||||
query := models.GetDBHealthQuery{}
|
query := models.GetDBHealthQuery{}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ func mockTime(mock time.Time) time.Time {
|
|||||||
return mock
|
return mock
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLoginAttempts(t *testing.T) {
|
func TestIntegrationLoginAttempts(t *testing.T) {
|
||||||
var beginningOfTime, timePlusOneMinute, timePlusTwoMinutes time.Time
|
var beginningOfTime, timePlusOneMinute, timePlusTwoMinutes time.Time
|
||||||
var sqlStore *SQLStore
|
var sqlStore *SQLStore
|
||||||
user := "user"
|
user := "user"
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestAccountDataAccess(t *testing.T) {
|
func TestIntegrationAccountDataAccess(t *testing.T) {
|
||||||
t.Run("Testing Account DB Access", func(t *testing.T) {
|
t.Run("Testing Account DB Access", func(t *testing.T) {
|
||||||
sqlStore := InitTestDB(t)
|
sqlStore := InitTestDB(t)
|
||||||
testUser := &models.SignedInUser{
|
testUser := &models.SignedInUser{
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestPlaylistDataAccess(t *testing.T) {
|
func TestIntegrationPlaylistDataAccess(t *testing.T) {
|
||||||
ss := InitTestDB(t)
|
ss := InitTestDB(t)
|
||||||
|
|
||||||
t.Run("Can create playlist", func(t *testing.T) {
|
t.Run("Can create playlist", func(t *testing.T) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestPluginSettings(t *testing.T) {
|
func TestIntegrationPluginSettings(t *testing.T) {
|
||||||
store := InitTestDB(t)
|
store := InitTestDB(t)
|
||||||
|
|
||||||
t.Run("Existing plugin settings", func(t *testing.T) {
|
t.Run("Existing plugin settings", func(t *testing.T) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestQuotaCommandsAndQueries(t *testing.T) {
|
func TestIntegrationQuotaCommandsAndQueries(t *testing.T) {
|
||||||
sqlStore := InitTestDB(t)
|
sqlStore := InitTestDB(t)
|
||||||
userId := int64(1)
|
userId := int64(1)
|
||||||
orgId := int64(0)
|
orgId := int64(0)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSQLBuilder(t *testing.T) {
|
func TestIntegrationSQLBuilder(t *testing.T) {
|
||||||
t.Run("WriteDashboardPermissionFilter", func(t *testing.T) {
|
t.Run("WriteDashboardPermissionFilter", func(t *testing.T) {
|
||||||
t.Run("user ACL", func(t *testing.T) {
|
t.Run("user ACL", func(t *testing.T) {
|
||||||
test(t,
|
test(t,
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ var sqlStoreTestCases = []sqlStoreTest{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSQLConnectionString(t *testing.T) {
|
func TestIntegrationSQLConnectionString(t *testing.T) {
|
||||||
for _, testCase := range sqlStoreTestCases {
|
for _, testCase := range sqlStoreTestCases {
|
||||||
t.Run(testCase.name, func(t *testing.T) {
|
t.Run(testCase.name, func(t *testing.T) {
|
||||||
sqlstore := &SQLStore{}
|
sqlstore := &SQLStore{}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestStatsDataAccess(t *testing.T) {
|
func TestIntegrationStatsDataAccess(t *testing.T) {
|
||||||
sqlStore := InitTestDB(t)
|
sqlStore := InitTestDB(t)
|
||||||
populateDB(t, sqlStore)
|
populateDB(t, sqlStore)
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSavingTags(t *testing.T) {
|
func TestIntegrationSavingTags(t *testing.T) {
|
||||||
ss := InitTestDB(t)
|
ss := InitTestDB(t)
|
||||||
|
|
||||||
tagPairs := []*models.Tag{
|
tagPairs := []*models.Tag{
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/services/serviceaccounts"
|
"github.com/grafana/grafana/pkg/services/serviceaccounts"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestTeamCommandsAndQueries(t *testing.T) {
|
func TestIntegrationTeamCommandsAndQueries(t *testing.T) {
|
||||||
t.Run("Testing Team commands & queries", func(t *testing.T) {
|
t.Run("Testing Team commands & queries", func(t *testing.T) {
|
||||||
sqlStore := InitTestDB(t)
|
sqlStore := InitTestDB(t)
|
||||||
testUser := &models.SignedInUser{
|
testUser := &models.SignedInUser{
|
||||||
@@ -401,7 +401,7 @@ func TestTeamCommandsAndQueries(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSQLStore_SearchTeams(t *testing.T) {
|
func TestIntegrationSQLStore_SearchTeams(t *testing.T) {
|
||||||
type searchTeamsTestCase struct {
|
type searchTeamsTestCase struct {
|
||||||
desc string
|
desc string
|
||||||
query *models.SearchTeamsQuery
|
query *models.SearchTeamsQuery
|
||||||
@@ -474,7 +474,7 @@ func TestSQLStore_SearchTeams(t *testing.T) {
|
|||||||
|
|
||||||
// TestSQLStore_GetTeamMembers_ACFilter tests the accesscontrol filtering of
|
// TestSQLStore_GetTeamMembers_ACFilter tests the accesscontrol filtering of
|
||||||
// team members based on the signed in user permissions
|
// team members based on the signed in user permissions
|
||||||
func TestSQLStore_GetTeamMembers_ACFilter(t *testing.T) {
|
func TestIntegrationSQLStore_GetTeamMembers_ACFilter(t *testing.T) {
|
||||||
testOrgID := int64(2)
|
testOrgID := int64(2)
|
||||||
userIds := make([]int64, 4)
|
userIds := make([]int64, 4)
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestTempUserCommandsAndQueries(t *testing.T) {
|
func TestIntegrationTempUserCommandsAndQueries(t *testing.T) {
|
||||||
ss := InitTestDB(t)
|
ss := InitTestDB(t)
|
||||||
cmd := models.CreateTempUserCommand{
|
cmd := models.CreateTempUserCommand{
|
||||||
OrgId: 2256,
|
OrgId: 2256,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import (
|
|||||||
|
|
||||||
var ErrProvokedError = errors.New("testing error")
|
var ErrProvokedError = errors.New("testing error")
|
||||||
|
|
||||||
func TestTransaction(t *testing.T) {
|
func TestIntegrationTransaction(t *testing.T) {
|
||||||
ss := InitTestDB(t)
|
ss := InitTestDB(t)
|
||||||
|
|
||||||
cmd := &models.AddApiKeyCommand{Key: "secret-key", Name: "key", OrgId: 1}
|
cmd := &models.AddApiKeyCommand{Key: "secret-key", Name: "key", OrgId: 1}
|
||||||
@@ -56,7 +56,7 @@ func TestTransaction(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestReuseSessionWithTransaction(t *testing.T) {
|
func TestIntegrationReuseSessionWithTransaction(t *testing.T) {
|
||||||
ss := InitTestDB(t)
|
ss := InitTestDB(t)
|
||||||
|
|
||||||
t.Run("top level transaction", func(t *testing.T) {
|
t.Run("top level transaction", func(t *testing.T) {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestUserDataAccess(t *testing.T) {
|
func TestIntegrationUserDataAccess(t *testing.T) {
|
||||||
|
|
||||||
ss := InitTestDB(t)
|
ss := InitTestDB(t)
|
||||||
user := &models.SignedInUser{
|
user := &models.SignedInUser{
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestUserStarsDataAccess(t *testing.T) {
|
func TestIntegrationUserStarsDataAccess(t *testing.T) {
|
||||||
t.Run("Testing User Stars Data Access", func(t *testing.T) {
|
t.Run("Testing User Stars Data Access", func(t *testing.T) {
|
||||||
ss := sqlstore.InitTestDB(t)
|
ss := sqlstore.InitTestDB(t)
|
||||||
starStore := sqlStore{db: ss}
|
starStore := sqlStore{db: ss}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestEntityEventsService(t *testing.T) {
|
func TestIntegrationEntityEventsService(t *testing.T) {
|
||||||
var ctx context.Context
|
var ctx context.Context
|
||||||
var service EntityEventsService
|
var service EntityEventsService
|
||||||
|
|
||||||
@@ -136,7 +136,7 @@ func TestEntityEventsService(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateDatabaseEntityId(t *testing.T) {
|
func TestIntegrationCreateDatabaseEntityId(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
entityType EntityType
|
entityType EntityType
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import (
|
|||||||
// There is also a datasource and dashboard provisioned by devenv scripts that you can
|
// There is also a datasource and dashboard provisioned by devenv scripts that you can
|
||||||
// use to verify that the generated data are visualized as expected, see
|
// use to verify that the generated data are visualized as expected, see
|
||||||
// devenv/README.md for setup instructions.
|
// devenv/README.md for setup instructions.
|
||||||
func TestMySQL(t *testing.T) {
|
func TestIntegrationMySQL(t *testing.T) {
|
||||||
// change to true to run the MySQL tests
|
// change to true to run the MySQL tests
|
||||||
runMySQLTests := false
|
runMySQLTests := false
|
||||||
// runMySqlTests := true
|
// runMySqlTests := true
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Test generateConnectionString.
|
// Test generateConnectionString.
|
||||||
func TestGenerateConnectionString(t *testing.T) {
|
func TestIntegrationGenerateConnectionString(t *testing.T) {
|
||||||
cfg := setting.NewCfg()
|
cfg := setting.NewCfg()
|
||||||
cfg.DataPath = t.TempDir()
|
cfg.DataPath = t.TempDir()
|
||||||
|
|
||||||
@@ -172,7 +172,7 @@ func TestGenerateConnectionString(t *testing.T) {
|
|||||||
// There is also a datasource and dashboard provisioned by devenv scripts that you can
|
// There is also a datasource and dashboard provisioned by devenv scripts that you can
|
||||||
// use to verify that the generated data are visualized as expected, see
|
// use to verify that the generated data are visualized as expected, see
|
||||||
// devenv/README.md for setup instructions.
|
// devenv/README.md for setup instructions.
|
||||||
func TestPostgres(t *testing.T) {
|
func TestIntegrationPostgres(t *testing.T) {
|
||||||
// change to true to run the PostgreSQL tests
|
// change to true to run the PostgreSQL tests
|
||||||
const runPostgresTests = false
|
const runPostgresTests = false
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user