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:
Kat Yang 2022-05-24 05:04:03 -04:00 committed by GitHub
parent 7bcc151ae6
commit 50c2b4682a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
51 changed files with 69 additions and 69 deletions

View File

@ -172,7 +172,7 @@ func runTests(createCases func() []fsTestCase, t *testing.T) {
}
}
func TestFsStorage(t *testing.T) {
func TestIntegrationFsStorage(t *testing.T) {
//skipTest := true
emptyContents := make([]byte, 0)
pngImage, _ := base64.StdEncoding.DecodeString(pngImageBase64)

View File

@ -39,7 +39,7 @@ func (t *TestCase) Value() string {
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)
ctx := context.Background()

View File

@ -11,7 +11,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestServerLok(t *testing.T) {
func TestIntegrationServerLok(t *testing.T) {
sl := createTestableServerLock(t)
counter := 0

View File

@ -20,7 +20,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestEngineTimeouts(t *testing.T) {
func TestIntegrationEngineTimeouts(t *testing.T) {
usMock := &usagestats.UsageStatsMock{T: t}
tracer, err := tracing.InitializeTracerForTest()
require.NoError(t, err)

View File

@ -14,7 +14,7 @@ import (
"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) {
var sqlStore *sqlstore.SQLStore
var folder, dashInRoot, childDash *models.Dashboard

View File

@ -16,7 +16,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestDashboardProvisioningTest(t *testing.T) {
func TestIntegrationDashboardProvisioningTest(t *testing.T) {
sqlStore := sqlstore.InitTestDB(t)
dashboardStore := ProvideDashboardStore(sqlStore)

View File

@ -24,7 +24,7 @@ import (
"github.com/grafana/grafana/pkg/setting"
)
func TestDashboardDataAccess(t *testing.T) {
func TestIntegrationDashboardDataAccess(t *testing.T) {
var sqlStore *sqlstore.SQLStore
var savedFolder, savedDash, savedDash2 *models.Dashboard
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)
dashboardStore := ProvideDashboardStore(sqlStore)
pluginId := "test-app"
@ -498,7 +498,7 @@ func TestDashboardDataAccessGivenPluginWithImportedDashboards(t *testing.T) {
require.Equal(t, len(query.Result), 2)
}
func TestDashboard_SortingOptions(t *testing.T) {
func TestIntegrationDashboard_SortingOptions(t *testing.T) {
sqlStore := sqlstore.InitTestDB(t)
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)
dashboardStore := ProvideDashboardStore(sqlStore)
insertTestDashboard(t, dashboardStore, "Alfa", 1, 0, false)

View File

@ -17,7 +17,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestDashboardAclDataAccess(t *testing.T) {
func TestIntegrationDashboardAclDataAccess(t *testing.T) {
var sqlStore *sqlstore.SQLStore
var currentUser models.User
var savedFolder, childDash *models.Dashboard

View File

@ -25,7 +25,7 @@ import (
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) {
// Basic validation tests

View File

@ -19,7 +19,7 @@ import (
"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) {
fakeStore := m.FakeDashboardStore{}
defer fakeStore.AssertExpectations(t)

View File

@ -25,7 +25,7 @@ import (
var orgID = int64(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) {
store := &dashboards.FakeDashboardStore{}
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) {
store := &dashboards.FakeDashboardStore{}
cfg := setting.NewCfg()

View File

@ -12,7 +12,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestLiveMessage(t *testing.T) {
func TestIntegrationLiveMessage(t *testing.T) {
storage := SetupTestStorage(t)
getQuery := &models.GetLiveMessageQuery{

View File

@ -14,7 +14,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestAlertManagerHash(t *testing.T) {
func TestIntegrationAlertManagerHash(t *testing.T) {
sqlStore := sqlstore.InitTestDB(t)
store := &DBstore{
SQLStore: sqlStore,

View File

@ -39,7 +39,7 @@ func addToken(img *store.Image) *store.Image {
return img
}
func TestSaveAndGetImage(t *testing.T) {
func TestIntegrationSaveAndGetImage(t *testing.T) {
mockTimeNow()
ctx := context.Background()
_, 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()
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)
defer cancel()

View File

@ -27,7 +27,7 @@ func mockTimeNow() {
}
}
func TestAlertInstanceOperations(t *testing.T) {
func TestIntegrationAlertInstanceOperations(t *testing.T) {
ctx := context.Background()
_, dbstore := tests.SetupTestEnv(t, baseIntervalSeconds)

View File

@ -15,7 +15,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestPreferencesDataAccess(t *testing.T) {
func TestIntegrationPreferencesDataAccess(t *testing.T) {
ss := sqlstore.InitTestDB(t)
prefStore := sqlStore{db: ss}
orgNavbarPreferences := pref.NavbarPreference{

View File

@ -10,7 +10,7 @@ import (
"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",
func(t *testing.T, sc scenarioContext) {
command := CreateQueryInQueryHistoryCommand{

View File

@ -12,7 +12,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestDeleteStaleQueryFromQueryHistory(t *testing.T) {
func TestIntegrationDeleteStaleQueryFromQueryHistory(t *testing.T) {
testScenarioWithQueryInQueryHistory(t, "Stale query history can be deleted",
func(t *testing.T, sc scenarioContext) {
olderThan := time.Now().Unix() + 60

View File

@ -12,7 +12,7 @@ import (
"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",
func(t *testing.T, sc scenarioContext) {
resp := sc.service.deleteHandler(sc.reqContext)

View File

@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestEnforceRowLimitInQueryHistory(t *testing.T) {
func TestIntegrationEnforceRowLimitInQueryHistory(t *testing.T) {
testScenarioWithQueryInQueryHistory(t, "Enforce limit for query_history",
func(t *testing.T, sc scenarioContext) {
limit := 0

View File

@ -12,7 +12,7 @@ import (
"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",
func(t *testing.T, sc scenarioContext) {
command := MigrateQueriesToQueryHistoryCommand{

View File

@ -10,7 +10,7 @@ import (
"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",
func(t *testing.T, sc scenarioContext) {
resp := sc.service.patchCommentHandler(sc.reqContext)

View File

@ -12,7 +12,7 @@ import (
"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",
func(t *testing.T, sc scenarioContext) {
sc.reqContext.Req.Form.Add("datasourceUid", "test")

View File

@ -10,7 +10,7 @@ import (
"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",
func(t *testing.T, sc scenarioContext) {
resp := sc.service.starHandler(sc.reqContext)

View File

@ -10,7 +10,7 @@ import (
"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",
func(t *testing.T, sc scenarioContext) {
resp := sc.service.starHandler(sc.reqContext)

View File

@ -16,7 +16,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestAlertNotificationSQLAccess(t *testing.T) {
func TestIntegrationAlertNotificationSQLAccess(t *testing.T) {
var sqlStore *SQLStore
setup := func() { sqlStore = InitTestDB(t) }

View File

@ -28,7 +28,7 @@ func resetTimeNow() {
timeNow = time.Now
}
func TestAlertingDataAccess(t *testing.T) {
func TestIntegrationAlertingDataAccess(t *testing.T) {
mockTimeNow()
defer resetTimeNow()
@ -262,7 +262,7 @@ func TestAlertingDataAccess(t *testing.T) {
})
}
func TestPausingAlerts(t *testing.T) {
func TestIntegrationPausingAlerts(t *testing.T) {
mockTimeNow()
defer resetTimeNow()

View File

@ -20,7 +20,7 @@ import (
"github.com/grafana/grafana/pkg/services/sqlstore"
)
func TestAnnotations(t *testing.T) {
func TestIntegrationAnnotations(t *testing.T) {
sql := sqlstore.InitTestDB(t)
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{})
repo := sqlstore.NewSQLAnnotationRepo(sql)
dashboardStore := dashboardstore.ProvideDashboardStore(sql)

View File

@ -16,7 +16,7 @@ import (
"github.com/grafana/grafana/pkg/services/accesscontrol"
)
func TestApiKeyDataAccess(t *testing.T) {
func TestIntegrationApiKeyDataAccess(t *testing.T) {
mockTimeNow()
defer resetTimeNow()
@ -137,7 +137,7 @@ func TestApiKeyDataAccess(t *testing.T) {
})
}
func TestApiKeyErrors(t *testing.T) {
func TestIntegrationApiKeyErrors(t *testing.T) {
mockTimeNow()
defer resetTimeNow()
@ -173,7 +173,7 @@ type getApiKeysTestCase struct {
expectedNumKeys int
}
func TestSQLStore_GetAPIKeys(t *testing.T) {
func TestIntegrationSQLStore_GetAPIKeys(t *testing.T) {
tests := []getApiKeysTestCase{
{
desc: "expect all keys for wildcard scope",

View File

@ -17,7 +17,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestDashboardSnapshotDBAccess(t *testing.T) {
func TestIntegrationDashboardSnapshotDBAccess(t *testing.T) {
sqlstore := InitTestDB(t)
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)
t.Run("Testing dashboard snapshots clean up", func(t *testing.T) {

View File

@ -14,7 +14,7 @@ import (
var theme = models.ThemeDark
var kind = models.ThumbnailKindDefault
func TestSqlStorage(t *testing.T) {
func TestIntegrationSqlStorage(t *testing.T) {
var sqlStore *SQLStore
var savedFolder *models.Dashboard

View File

@ -78,7 +78,7 @@ func updateTestDashboard(t *testing.T, sqlStore *SQLStore, dashboard *models.Das
require.NoError(t, err)
}
func TestGetDashboardVersion(t *testing.T) {
func TestIntegrationGetDashboardVersion(t *testing.T) {
sqlStore := InitTestDB(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)
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
versionsToWrite := 10
setting.DashboardVersionsToKeep = versionsToKeep

View File

@ -19,7 +19,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestDataAccess(t *testing.T) {
func TestIntegrationDataAccess(t *testing.T) {
defaultAddDatasourceCommand := models.AddDataSourceCommand{
OrgId: 10,
Name: "nisse",
@ -431,7 +431,7 @@ func TestDataAccess(t *testing.T) {
})
}
func TestGetDefaultDataSource(t *testing.T) {
func TestIntegrationGetDefaultDataSource(t *testing.T) {
InitTestDB(t)
t.Run("should return error if there is no default datasource", func(t *testing.T) {

View File

@ -11,7 +11,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestGetDBHealthQuery(t *testing.T) {
func TestIntegrationGetDBHealthQuery(t *testing.T) {
store := InitTestDB(t)
query := models.GetDBHealthQuery{}

View File

@ -18,7 +18,7 @@ func mockTime(mock time.Time) time.Time {
return mock
}
func TestLoginAttempts(t *testing.T) {
func TestIntegrationLoginAttempts(t *testing.T) {
var beginningOfTime, timePlusOneMinute, timePlusTwoMinutes time.Time
var sqlStore *SQLStore
user := "user"

View File

@ -17,7 +17,7 @@ import (
"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) {
sqlStore := InitTestDB(t)
testUser := &models.SignedInUser{

View File

@ -11,7 +11,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestPlaylistDataAccess(t *testing.T) {
func TestIntegrationPlaylistDataAccess(t *testing.T) {
ss := InitTestDB(t)
t.Run("Can create playlist", func(t *testing.T) {

View File

@ -13,7 +13,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestPluginSettings(t *testing.T) {
func TestIntegrationPluginSettings(t *testing.T) {
store := InitTestDB(t)
t.Run("Existing plugin settings", func(t *testing.T) {

View File

@ -13,7 +13,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestQuotaCommandsAndQueries(t *testing.T) {
func TestIntegrationQuotaCommandsAndQueries(t *testing.T) {
sqlStore := InitTestDB(t)
userId := int64(1)
orgId := int64(0)

View File

@ -16,7 +16,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestSQLBuilder(t *testing.T) {
func TestIntegrationSQLBuilder(t *testing.T) {
t.Run("WriteDashboardPermissionFilter", func(t *testing.T) {
t.Run("user ACL", func(t *testing.T) {
test(t,

View File

@ -77,7 +77,7 @@ var sqlStoreTestCases = []sqlStoreTest{
},
}
func TestSQLConnectionString(t *testing.T) {
func TestIntegrationSQLConnectionString(t *testing.T) {
for _, testCase := range sqlStoreTestCases {
t.Run(testCase.name, func(t *testing.T) {
sqlstore := &SQLStore{}

View File

@ -13,7 +13,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestStatsDataAccess(t *testing.T) {
func TestIntegrationStatsDataAccess(t *testing.T) {
sqlStore := InitTestDB(t)
populateDB(t, sqlStore)

View File

@ -12,7 +12,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestSavingTags(t *testing.T) {
func TestIntegrationSavingTags(t *testing.T) {
ss := InitTestDB(t)
tagPairs := []*models.Tag{

View File

@ -16,7 +16,7 @@ import (
"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) {
sqlStore := InitTestDB(t)
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 {
desc string
query *models.SearchTeamsQuery
@ -474,7 +474,7 @@ func TestSQLStore_SearchTeams(t *testing.T) {
// TestSQLStore_GetTeamMembers_ACFilter tests the accesscontrol filtering of
// 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)
userIds := make([]int64, 4)

View File

@ -13,7 +13,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestTempUserCommandsAndQueries(t *testing.T) {
func TestIntegrationTempUserCommandsAndQueries(t *testing.T) {
ss := InitTestDB(t)
cmd := models.CreateTempUserCommand{
OrgId: 2256,

View File

@ -15,7 +15,7 @@ import (
var ErrProvokedError = errors.New("testing error")
func TestTransaction(t *testing.T) {
func TestIntegrationTransaction(t *testing.T) {
ss := InitTestDB(t)
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)
t.Run("top level transaction", func(t *testing.T) {

View File

@ -14,7 +14,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestUserDataAccess(t *testing.T) {
func TestIntegrationUserDataAccess(t *testing.T) {
ss := InitTestDB(t)
user := &models.SignedInUser{

View File

@ -12,7 +12,7 @@ import (
"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) {
ss := sqlstore.InitTestDB(t)
starStore := sqlStore{db: ss}

View File

@ -13,7 +13,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestEntityEventsService(t *testing.T) {
func TestIntegrationEntityEventsService(t *testing.T) {
var ctx context.Context
var service EntityEventsService
@ -136,7 +136,7 @@ func TestEntityEventsService(t *testing.T) {
})
}
func TestCreateDatabaseEntityId(t *testing.T) {
func TestIntegrationCreateDatabaseEntityId(t *testing.T) {
tests := []struct {
name string
entityType EntityType

View File

@ -28,7 +28,7 @@ import (
// 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
// devenv/README.md for setup instructions.
func TestMySQL(t *testing.T) {
func TestIntegrationMySQL(t *testing.T) {
// change to true to run the MySQL tests
runMySQLTests := false
// runMySqlTests := true

View File

@ -25,7 +25,7 @@ import (
)
// Test generateConnectionString.
func TestGenerateConnectionString(t *testing.T) {
func TestIntegrationGenerateConnectionString(t *testing.T) {
cfg := setting.NewCfg()
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
// use to verify that the generated data are visualized as expected, see
// devenv/README.md for setup instructions.
func TestPostgres(t *testing.T) {
func TestIntegrationPostgres(t *testing.T) {
// change to true to run the PostgreSQL tests
const runPostgresTests = false