diff --git a/.drone.yml b/.drone.yml index 59af3003bb4..0a933bbc87f 100644 --- a/.drone.yml +++ b/.drone.yml @@ -141,7 +141,7 @@ steps: image: grafana/build-container:1.5.5 name: lint-backend - commands: - - ./bin/grabpl test-backend --edition oss + - go test -short -covermode=atomic -timeout=30m ./pkg/... depends_on: - wire-install image: grafana/build-container:1.5.5 @@ -812,7 +812,7 @@ steps: image: grafana/build-container:1.5.5 name: lint-backend - commands: - - ./bin/grabpl test-backend --edition oss + - go test -short -covermode=atomic -timeout=30m ./pkg/... depends_on: - wire-install image: grafana/build-container:1.5.5 @@ -1884,7 +1884,7 @@ steps: image: grafana/build-container:1.5.5 name: lint-frontend - commands: - - ./bin/grabpl test-backend --edition oss + - go test -short -covermode=atomic -timeout=30m ./pkg/... depends_on: - wire-install image: grafana/build-container:1.5.5 @@ -3666,7 +3666,7 @@ steps: image: grafana/build-container:1.5.5 name: lint-frontend - commands: - - ./bin/grabpl test-backend --edition oss + - go test -short -covermode=atomic -timeout=30m ./pkg/... depends_on: - wire-install image: grafana/build-container:1.5.5 @@ -4683,6 +4683,6 @@ kind: secret name: gcp_upload_artifacts_key --- kind: signature -hmac: 0abf901971b403a4cf5887d1051ec4a656335a23d9a92809a71312d115b4862f +hmac: df6f9fbc1fe40e3ecad762194eeb466ded8aa92cc0ee13a77ea5142d9a3a4749 ... diff --git a/pkg/infra/filestorage/fs_integration_test.go b/pkg/infra/filestorage/fs_integration_test.go index 48cc7285051..f2ea34e0479 100644 --- a/pkg/infra/filestorage/fs_integration_test.go +++ b/pkg/infra/filestorage/fs_integration_test.go @@ -170,6 +170,9 @@ func runTests(createCases func() []fsTestCase, t *testing.T) { } func TestIntegrationFsStorage(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } //skipTest := true emptyContents := make([]byte, 0) pngImage, _ := base64.StdEncoding.DecodeString(pngImageBase64) diff --git a/pkg/infra/kvstore/kvstore_test.go b/pkg/infra/kvstore/kvstore_test.go index 8467f31e4df..78350342ccf 100644 --- a/pkg/infra/kvstore/kvstore_test.go +++ b/pkg/infra/kvstore/kvstore_test.go @@ -37,6 +37,9 @@ func (t *TestCase) Value() string { } func TestIntegrationKVStore(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } kv := createTestableKVStore(t) ctx := context.Background() diff --git a/pkg/infra/serverlock/serverlock_integration_test.go b/pkg/infra/serverlock/serverlock_integration_test.go index 9e839645c19..49e45de280b 100644 --- a/pkg/infra/serverlock/serverlock_integration_test.go +++ b/pkg/infra/serverlock/serverlock_integration_test.go @@ -9,6 +9,9 @@ import ( ) func TestIntegrationServerLok(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } sl := createTestableServerLock(t) counter := 0 diff --git a/pkg/services/alerting/engine_integration_test.go b/pkg/services/alerting/engine_integration_test.go index c0a11f41280..fc1b35036c7 100644 --- a/pkg/services/alerting/engine_integration_test.go +++ b/pkg/services/alerting/engine_integration_test.go @@ -18,6 +18,9 @@ import ( ) func TestIntegrationEngineTimeouts(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } usMock := &usagestats.UsageStatsMock{T: t} tracer, err := tracing.InitializeTracerForTest() require.NoError(t, err) diff --git a/pkg/services/dashboards/database/acl_test.go b/pkg/services/dashboards/database/acl_test.go index 2e823bc57b0..800fcdd9d81 100644 --- a/pkg/services/dashboards/database/acl_test.go +++ b/pkg/services/dashboards/database/acl_test.go @@ -10,6 +10,9 @@ import ( ) func TestIntegrationDashboardAclDataAccess(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } var sqlStore *sqlstore.SQLStore var currentUser models.User var savedFolder, childDash *models.Dashboard diff --git a/pkg/services/dashboards/database/database_folder_test.go b/pkg/services/dashboards/database/database_folder_test.go index dbca6013052..ebf06887b0d 100644 --- a/pkg/services/dashboards/database/database_folder_test.go +++ b/pkg/services/dashboards/database/database_folder_test.go @@ -12,6 +12,9 @@ import ( ) func TestIntegrationDashboardFolderDataAccess(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } t.Run("Testing DB", func(t *testing.T) { var sqlStore *sqlstore.SQLStore var folder, dashInRoot, childDash *models.Dashboard diff --git a/pkg/services/dashboards/database/database_provisioning_test.go b/pkg/services/dashboards/database/database_provisioning_test.go index 1b9d3813df6..f882ca64cc3 100644 --- a/pkg/services/dashboards/database/database_provisioning_test.go +++ b/pkg/services/dashboards/database/database_provisioning_test.go @@ -14,6 +14,9 @@ import ( ) func TestIntegrationDashboardProvisioningTest(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } sqlStore := sqlstore.InitTestDB(t) dashboardStore := ProvideDashboardStore(sqlStore) diff --git a/pkg/services/dashboards/database/database_test.go b/pkg/services/dashboards/database/database_test.go index fedd4cd3726..ecb8e1aeaf4 100644 --- a/pkg/services/dashboards/database/database_test.go +++ b/pkg/services/dashboards/database/database_test.go @@ -21,6 +21,9 @@ import ( ) func TestIntegrationDashboardDataAccess(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } var sqlStore *sqlstore.SQLStore var savedFolder, savedDash, savedDash2 *models.Dashboard var dashboardStore *DashboardStore @@ -476,6 +479,9 @@ func TestIntegrationDashboardDataAccess(t *testing.T) { } func TestIntegrationDashboardDataAccessGivenPluginWithImportedDashboards(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } sqlStore := sqlstore.InitTestDB(t) dashboardStore := ProvideDashboardStore(sqlStore) pluginId := "test-app" @@ -495,6 +501,9 @@ func TestIntegrationDashboardDataAccessGivenPluginWithImportedDashboards(t *test } func TestIntegrationDashboard_SortingOptions(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } sqlStore := sqlstore.InitTestDB(t) dashboardStore := ProvideDashboardStore(sqlStore) @@ -541,6 +550,9 @@ func TestIntegrationDashboard_SortingOptions(t *testing.T) { } func TestIntegrationDashboard_Filter(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } sqlStore := sqlstore.InitTestDB(t) dashboardStore := ProvideDashboardStore(sqlStore) insertTestDashboard(t, dashboardStore, "Alfa", 1, 0, false) diff --git a/pkg/services/dashboards/service/dashboard_service_integration_test.go b/pkg/services/dashboards/service/dashboard_service_integration_test.go index fb7c6101323..0cf92da3839 100644 --- a/pkg/services/dashboards/service/dashboard_service_integration_test.go +++ b/pkg/services/dashboards/service/dashboard_service_integration_test.go @@ -22,6 +22,9 @@ import ( const testOrgID int64 = 1 func TestIntegrationIntegratedDashboardService(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } t.Run("Given saved folders and dashboards in organization A", func(t *testing.T) { // Basic validation tests diff --git a/pkg/services/dashboards/service/dashboard_service_test.go b/pkg/services/dashboards/service/dashboard_service_test.go index 65a05ed8d2e..dc9dc3cfefc 100644 --- a/pkg/services/dashboards/service/dashboard_service_test.go +++ b/pkg/services/dashboards/service/dashboard_service_test.go @@ -17,6 +17,9 @@ import ( ) func TestIntegrationDashboardService(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } t.Run("Dashboard service tests", func(t *testing.T) { fakeStore := m.FakeDashboardStore{} defer fakeStore.AssertExpectations(t) diff --git a/pkg/services/dashboards/service/folder_service_test.go b/pkg/services/dashboards/service/folder_service_test.go index 16d811ba2a6..f0869be2ea4 100644 --- a/pkg/services/dashboards/service/folder_service_test.go +++ b/pkg/services/dashboards/service/folder_service_test.go @@ -23,6 +23,9 @@ var orgID = int64(1) var user = &models.SignedInUser{UserId: 1} func TestIntegrationProvideFolderService(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } t.Run("should register scope resolvers", func(t *testing.T) { cfg := setting.NewCfg() ac := acmock.New() @@ -34,6 +37,9 @@ func TestIntegrationProvideFolderService(t *testing.T) { } func TestIntegrationFolderService(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } t.Run("Folder service tests", func(t *testing.T) { store := &dashboards.FakeDashboardStore{} cfg := setting.NewCfg() diff --git a/pkg/services/dashboardversion/dashverimpl/store_test.go b/pkg/services/dashboardversion/dashverimpl/store_test.go index 845856b8e0b..de11a60ca8a 100644 --- a/pkg/services/dashboardversion/dashverimpl/store_test.go +++ b/pkg/services/dashboardversion/dashverimpl/store_test.go @@ -16,6 +16,9 @@ import ( ) func TestIntegrationGetDashboardVersion(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } ss := sqlstore.InitTestDB(t) dashVerStore := sqlStore{db: ss} @@ -59,6 +62,9 @@ func TestIntegrationGetDashboardVersion(t *testing.T) { } func TestIntegrationDeleteExpiredVersions(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } versionsToWrite := 10 ss := sqlstore.InitTestDB(t) dashVerStore := sqlStore{db: ss} @@ -80,6 +86,9 @@ func TestIntegrationDeleteExpiredVersions(t *testing.T) { } func TestIntegrationListDashboardVersions(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } ss := sqlstore.InitTestDB(t) dashVerStore := sqlStore{db: ss, dialect: ss.Dialect} savedDash := insertTestDashboard(t, ss, "test dash 43", 1, 0, false, "diff-all") diff --git a/pkg/services/live/database/tests/storage_test.go b/pkg/services/live/database/tests/storage_test.go index 8f57af305b6..2a583a86ca9 100644 --- a/pkg/services/live/database/tests/storage_test.go +++ b/pkg/services/live/database/tests/storage_test.go @@ -10,6 +10,9 @@ import ( ) func TestIntegrationLiveMessage(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } storage := SetupTestStorage(t) getQuery := &models.GetLiveMessageQuery{ diff --git a/pkg/services/ngalert/store/alertmanager_test.go b/pkg/services/ngalert/store/alertmanager_test.go index 575ff4415e7..b28d238bdfb 100644 --- a/pkg/services/ngalert/store/alertmanager_test.go +++ b/pkg/services/ngalert/store/alertmanager_test.go @@ -12,6 +12,9 @@ import ( ) func TestIntegrationAlertManagerHash(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } sqlStore := sqlstore.InitTestDB(t) store := &DBstore{ SQLStore: sqlStore, diff --git a/pkg/services/ngalert/store/image_test.go b/pkg/services/ngalert/store/image_test.go index d7f84fb91c6..d026888cf10 100644 --- a/pkg/services/ngalert/store/image_test.go +++ b/pkg/services/ngalert/store/image_test.go @@ -38,6 +38,9 @@ func addToken(img *models.Image) *models.Image { } func TestIntegrationSaveAndGetImage(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } mockTimeNow() ctx := context.Background() _, dbstore := tests.SetupTestEnv(t, baseIntervalSeconds) @@ -91,6 +94,9 @@ func TestIntegrationSaveAndGetImage(t *testing.T) { } func TestIntegrationGetImages(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } mockTimeNow() ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() @@ -141,6 +147,9 @@ func TestIntegrationGetImages(t *testing.T) { } func TestIntegrationDeleteExpiredImages(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } mockTimeNow() ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute) defer cancel() diff --git a/pkg/services/ngalert/store/instance_database_test.go b/pkg/services/ngalert/store/instance_database_test.go index c305cce7e02..a194aac0351 100644 --- a/pkg/services/ngalert/store/instance_database_test.go +++ b/pkg/services/ngalert/store/instance_database_test.go @@ -25,6 +25,9 @@ func mockTimeNow() { } func TestIntegrationAlertInstanceOperations(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } ctx := context.Background() _, dbstore := tests.SetupTestEnv(t, baseIntervalSeconds) diff --git a/pkg/services/preference/prefimpl/store_test.go b/pkg/services/preference/prefimpl/store_test.go index 361663860d7..374454be7b0 100644 --- a/pkg/services/preference/prefimpl/store_test.go +++ b/pkg/services/preference/prefimpl/store_test.go @@ -13,6 +13,9 @@ import ( ) func TestIntegrationPreferencesDataAccess(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } ss := sqlstore.InitTestDB(t) prefStore := sqlStore{db: ss} orgNavbarPreferences := pref.NavbarPreference{ diff --git a/pkg/services/queryhistory/queryhistory_create_test.go b/pkg/services/queryhistory/queryhistory_create_test.go index 00f891359eb..a04d967a64f 100644 --- a/pkg/services/queryhistory/queryhistory_create_test.go +++ b/pkg/services/queryhistory/queryhistory_create_test.go @@ -8,6 +8,9 @@ import ( ) func TestIntegrationCreateQueryInQueryHistory(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } testScenario(t, "When users tries to create query in query history it should succeed", func(t *testing.T, sc scenarioContext) { command := CreateQueryInQueryHistoryCommand{ diff --git a/pkg/services/queryhistory/queryhistory_delete_stale_test.go b/pkg/services/queryhistory/queryhistory_delete_stale_test.go index 84fbfd7e317..4d1a5e1a271 100644 --- a/pkg/services/queryhistory/queryhistory_delete_stale_test.go +++ b/pkg/services/queryhistory/queryhistory_delete_stale_test.go @@ -10,6 +10,9 @@ import ( ) func TestIntegrationDeleteStaleQueryFromQueryHistory(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } testScenarioWithQueryInQueryHistory(t, "Stale query history can be deleted", func(t *testing.T, sc scenarioContext) { olderThan := time.Now().Unix() + 60 diff --git a/pkg/services/queryhistory/queryhistory_delete_test.go b/pkg/services/queryhistory/queryhistory_delete_test.go index bf8ff11d45c..379f3f7dc79 100644 --- a/pkg/services/queryhistory/queryhistory_delete_test.go +++ b/pkg/services/queryhistory/queryhistory_delete_test.go @@ -10,6 +10,9 @@ import ( ) func TestIntegrationDeleteQueryFromQueryHistory(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } 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) diff --git a/pkg/services/queryhistory/queryhistory_enforce_limit_test.go b/pkg/services/queryhistory/queryhistory_enforce_limit_test.go index 85ef244dfae..4db257c32d2 100644 --- a/pkg/services/queryhistory/queryhistory_enforce_limit_test.go +++ b/pkg/services/queryhistory/queryhistory_enforce_limit_test.go @@ -8,6 +8,9 @@ import ( ) func TestIntegrationEnforceRowLimitInQueryHistory(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } testScenarioWithQueryInQueryHistory(t, "Enforce limit for query_history", func(t *testing.T, sc scenarioContext) { limit := 0 diff --git a/pkg/services/queryhistory/queryhistory_migrate_test.go b/pkg/services/queryhistory/queryhistory_migrate_test.go index c323f51e44f..dc4156dbc37 100644 --- a/pkg/services/queryhistory/queryhistory_migrate_test.go +++ b/pkg/services/queryhistory/queryhistory_migrate_test.go @@ -10,6 +10,9 @@ import ( ) func TestIntegrationMigrateQueriesToQueryHistory(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } testScenario(t, "When users tries to migrate 1 query in query history it should succeed", func(t *testing.T, sc scenarioContext) { command := MigrateQueriesToQueryHistoryCommand{ diff --git a/pkg/services/queryhistory/queryhistory_patch_test.go b/pkg/services/queryhistory/queryhistory_patch_test.go index 2d299b992d5..14e0dabe37f 100644 --- a/pkg/services/queryhistory/queryhistory_patch_test.go +++ b/pkg/services/queryhistory/queryhistory_patch_test.go @@ -8,6 +8,9 @@ import ( ) func TestIntegrationPatchQueryCommentInQueryHistory(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } 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) diff --git a/pkg/services/queryhistory/queryhistory_search_test.go b/pkg/services/queryhistory/queryhistory_search_test.go index d40291094ee..24ca3f67f11 100644 --- a/pkg/services/queryhistory/queryhistory_search_test.go +++ b/pkg/services/queryhistory/queryhistory_search_test.go @@ -10,6 +10,9 @@ import ( ) func TestIntegrationGetQueriesFromQueryHistory(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } 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") diff --git a/pkg/services/queryhistory/queryhistory_star_test.go b/pkg/services/queryhistory/queryhistory_star_test.go index 96980cadb9d..a5fab3430c9 100644 --- a/pkg/services/queryhistory/queryhistory_star_test.go +++ b/pkg/services/queryhistory/queryhistory_star_test.go @@ -8,6 +8,9 @@ import ( ) func TestIntegrationStarQueryInQueryHistory(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } 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) diff --git a/pkg/services/queryhistory/queryhistory_unstar_test.go b/pkg/services/queryhistory/queryhistory_unstar_test.go index c9a7c0159ab..eff47541fdc 100644 --- a/pkg/services/queryhistory/queryhistory_unstar_test.go +++ b/pkg/services/queryhistory/queryhistory_unstar_test.go @@ -8,6 +8,9 @@ import ( ) func TestIntegrationUnstarQueryInQueryHistory(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } 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) diff --git a/pkg/services/sqlstore/alert_notification_test.go b/pkg/services/sqlstore/alert_notification_test.go index ceb18ae11fa..6bc2e4a83d2 100644 --- a/pkg/services/sqlstore/alert_notification_test.go +++ b/pkg/services/sqlstore/alert_notification_test.go @@ -14,6 +14,9 @@ import ( ) func TestIntegrationAlertNotificationSQLAccess(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } var sqlStore *SQLStore setup := func() { sqlStore = InitTestDB(t) } diff --git a/pkg/services/sqlstore/alert_test.go b/pkg/services/sqlstore/alert_test.go index 51d23fa060d..cb5beb3ddb3 100644 --- a/pkg/services/sqlstore/alert_test.go +++ b/pkg/services/sqlstore/alert_test.go @@ -26,6 +26,9 @@ func resetTimeNow() { } func TestIntegrationAlertingDataAccess(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } mockTimeNow() defer resetTimeNow() @@ -260,6 +263,9 @@ func TestIntegrationAlertingDataAccess(t *testing.T) { } func TestIntegrationPausingAlerts(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } mockTimeNow() defer resetTimeNow() diff --git a/pkg/services/sqlstore/annotation_test.go b/pkg/services/sqlstore/annotation_test.go index bb62758231f..d6c1c50b6c1 100644 --- a/pkg/services/sqlstore/annotation_test.go +++ b/pkg/services/sqlstore/annotation_test.go @@ -18,6 +18,9 @@ import ( ) func TestIntegrationAnnotations(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } sql := sqlstore.InitTestDB(t) repo := sqlstore.NewSQLAnnotationRepo(sql) @@ -380,6 +383,9 @@ func TestIntegrationAnnotations(t *testing.T) { } func TestIntegrationAnnotationListingWithRBAC(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } sql := sqlstore.InitTestDB(t, sqlstore.InitTestDBOpt{}) repo := sqlstore.NewSQLAnnotationRepo(sql) dashboardStore := dashboardstore.ProvideDashboardStore(sql) diff --git a/pkg/services/sqlstore/apikey_test.go b/pkg/services/sqlstore/apikey_test.go index 6be90afeb9d..260f319ecda 100644 --- a/pkg/services/sqlstore/apikey_test.go +++ b/pkg/services/sqlstore/apikey_test.go @@ -14,6 +14,9 @@ import ( ) func TestIntegrationApiKeyDataAccess(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } mockTimeNow() defer resetTimeNow() @@ -135,6 +138,9 @@ func TestIntegrationApiKeyDataAccess(t *testing.T) { } func TestIntegrationApiKeyErrors(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } mockTimeNow() defer resetTimeNow() @@ -171,6 +177,9 @@ type getApiKeysTestCase struct { } func TestIntegrationSQLStore_GetAPIKeys(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } tests := []getApiKeysTestCase{ { desc: "expect all keys for wildcard scope", diff --git a/pkg/services/sqlstore/dashboard_snapshot_test.go b/pkg/services/sqlstore/dashboard_snapshot_test.go index e5ad58c69db..008dd8cbdc3 100644 --- a/pkg/services/sqlstore/dashboard_snapshot_test.go +++ b/pkg/services/sqlstore/dashboard_snapshot_test.go @@ -15,6 +15,9 @@ import ( ) func TestIntegrationDashboardSnapshotDBAccess(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } sqlstore := InitTestDB(t) origSecret := setting.SecretKey @@ -142,6 +145,9 @@ func TestIntegrationDashboardSnapshotDBAccess(t *testing.T) { } func TestIntegrationDeleteExpiredSnapshots(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } sqlstore := InitTestDB(t) t.Run("Testing dashboard snapshots clean up", func(t *testing.T) { diff --git a/pkg/services/sqlstore/dashboard_thumbs_test.go b/pkg/services/sqlstore/dashboard_thumbs_test.go index af7f364d2c4..61cfc7e6bf0 100644 --- a/pkg/services/sqlstore/dashboard_thumbs_test.go +++ b/pkg/services/sqlstore/dashboard_thumbs_test.go @@ -16,6 +16,9 @@ var theme = models.ThemeDark var kind = models.ThumbnailKindDefault func TestIntegrationSqlStorage(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } var sqlStore *SQLStore var savedFolder *models.Dashboard diff --git a/pkg/services/sqlstore/datasource_test.go b/pkg/services/sqlstore/datasource_test.go index 9d6fccf1eed..8c350fbe0fb 100644 --- a/pkg/services/sqlstore/datasource_test.go +++ b/pkg/services/sqlstore/datasource_test.go @@ -17,6 +17,9 @@ import ( ) func TestIntegrationDataAccess(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } defaultAddDatasourceCommand := models.AddDataSourceCommand{ OrgId: 10, Name: "nisse", @@ -429,6 +432,9 @@ func TestIntegrationDataAccess(t *testing.T) { } func TestIntegrationGetDefaultDataSource(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } InitTestDB(t) t.Run("should return error if there is no default datasource", func(t *testing.T) { diff --git a/pkg/services/sqlstore/health_test.go b/pkg/services/sqlstore/health_test.go index 5028842d033..4873ec37fbf 100644 --- a/pkg/services/sqlstore/health_test.go +++ b/pkg/services/sqlstore/health_test.go @@ -9,6 +9,9 @@ import ( ) func TestIntegrationGetDBHealthQuery(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } store := InitTestDB(t) query := models.GetDBHealthQuery{} diff --git a/pkg/services/sqlstore/login_attempt_test.go b/pkg/services/sqlstore/login_attempt_test.go index c2b2d797246..4d6d123278a 100644 --- a/pkg/services/sqlstore/login_attempt_test.go +++ b/pkg/services/sqlstore/login_attempt_test.go @@ -16,6 +16,9 @@ func mockTime(mock time.Time) time.Time { } func TestIntegrationLoginAttempts(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } var beginningOfTime, timePlusOneMinute, timePlusTwoMinutes time.Time var sqlStore *SQLStore user := "user" diff --git a/pkg/services/sqlstore/org_test.go b/pkg/services/sqlstore/org_test.go index 6665850e0d3..f4360d06bbc 100644 --- a/pkg/services/sqlstore/org_test.go +++ b/pkg/services/sqlstore/org_test.go @@ -16,6 +16,9 @@ import ( ) func TestIntegrationAccountDataAccess(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } t.Run("Testing Account DB Access", func(t *testing.T) { sqlStore := InitTestDB(t) testUser := &models.SignedInUser{ diff --git a/pkg/services/sqlstore/playlist_test.go b/pkg/services/sqlstore/playlist_test.go index 0c5d4d45ecd..168245b7869 100644 --- a/pkg/services/sqlstore/playlist_test.go +++ b/pkg/services/sqlstore/playlist_test.go @@ -9,6 +9,9 @@ import ( ) func TestIntegrationPlaylistDataAccess(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } ss := InitTestDB(t) t.Run("Can create playlist", func(t *testing.T) { diff --git a/pkg/services/sqlstore/plugin_setting_test.go b/pkg/services/sqlstore/plugin_setting_test.go index 100bf12868d..2899afb6aa2 100644 --- a/pkg/services/sqlstore/plugin_setting_test.go +++ b/pkg/services/sqlstore/plugin_setting_test.go @@ -11,6 +11,9 @@ import ( ) func TestIntegrationPluginSettings(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } store := InitTestDB(t) t.Run("Existing plugin settings", func(t *testing.T) { diff --git a/pkg/services/sqlstore/quota_test.go b/pkg/services/sqlstore/quota_test.go index ccb26eade0f..79b37903359 100644 --- a/pkg/services/sqlstore/quota_test.go +++ b/pkg/services/sqlstore/quota_test.go @@ -11,6 +11,9 @@ import ( ) func TestIntegrationQuotaCommandsAndQueries(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } sqlStore := InitTestDB(t) userId := int64(1) orgId := int64(0) diff --git a/pkg/services/sqlstore/sqlbuilder_test.go b/pkg/services/sqlstore/sqlbuilder_test.go index d86cadd0e1b..0da337cea16 100644 --- a/pkg/services/sqlstore/sqlbuilder_test.go +++ b/pkg/services/sqlstore/sqlbuilder_test.go @@ -14,6 +14,9 @@ import ( ) func TestIntegrationSQLBuilder(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } t.Run("WriteDashboardPermissionFilter", func(t *testing.T) { t.Run("user ACL", func(t *testing.T) { test(t, diff --git a/pkg/services/sqlstore/sqlstore_test.go b/pkg/services/sqlstore/sqlstore_test.go index 0ba0b60ec63..0b04716f7a8 100644 --- a/pkg/services/sqlstore/sqlstore_test.go +++ b/pkg/services/sqlstore/sqlstore_test.go @@ -75,6 +75,9 @@ var sqlStoreTestCases = []sqlStoreTest{ } func TestIntegrationSQLConnectionString(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } for _, testCase := range sqlStoreTestCases { t.Run(testCase.name, func(t *testing.T) { sqlstore := &SQLStore{} diff --git a/pkg/services/sqlstore/stats_integration_test.go b/pkg/services/sqlstore/stats_integration_test.go index ae3542bdd58..674c2674e91 100644 --- a/pkg/services/sqlstore/stats_integration_test.go +++ b/pkg/services/sqlstore/stats_integration_test.go @@ -9,6 +9,9 @@ import ( ) func TestIntegration_GetAdminStats(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } sqlStore := InitTestDB(t) query := models.GetAdminStatsQuery{} diff --git a/pkg/services/sqlstore/stats_test.go b/pkg/services/sqlstore/stats_test.go index 8d5a08dff28..0fa194e01bc 100644 --- a/pkg/services/sqlstore/stats_test.go +++ b/pkg/services/sqlstore/stats_test.go @@ -11,6 +11,9 @@ import ( ) func TestIntegrationStatsDataAccess(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } sqlStore := InitTestDB(t) populateDB(t, sqlStore) diff --git a/pkg/services/sqlstore/tags_test.go b/pkg/services/sqlstore/tags_test.go index d7187a49f3b..e076c402592 100644 --- a/pkg/services/sqlstore/tags_test.go +++ b/pkg/services/sqlstore/tags_test.go @@ -10,6 +10,9 @@ import ( ) func TestIntegrationSavingTags(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } ss := InitTestDB(t) tagPairs := []*models.Tag{ diff --git a/pkg/services/sqlstore/team_test.go b/pkg/services/sqlstore/team_test.go index 5dd4e2256fb..aff06437b73 100644 --- a/pkg/services/sqlstore/team_test.go +++ b/pkg/services/sqlstore/team_test.go @@ -14,6 +14,9 @@ import ( ) func TestIntegrationTeamCommandsAndQueries(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } t.Run("Testing Team commands & queries", func(t *testing.T) { sqlStore := InitTestDB(t) testUser := &models.SignedInUser{ @@ -405,6 +408,9 @@ func TestIntegrationTeamCommandsAndQueries(t *testing.T) { } func TestIntegrationSQLStore_SearchTeams(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } type searchTeamsTestCase struct { desc string query *models.SearchTeamsQuery @@ -478,6 +484,9 @@ func TestIntegrationSQLStore_SearchTeams(t *testing.T) { // TestSQLStore_GetTeamMembers_ACFilter tests the accesscontrol filtering of // team members based on the signed in user permissions func TestIntegrationSQLStore_GetTeamMembers_ACFilter(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } testOrgID := int64(2) userIds := make([]int64, 4) diff --git a/pkg/services/sqlstore/temp_user_test.go b/pkg/services/sqlstore/temp_user_test.go index 04fd9b79263..fee989c22de 100644 --- a/pkg/services/sqlstore/temp_user_test.go +++ b/pkg/services/sqlstore/temp_user_test.go @@ -11,6 +11,9 @@ import ( ) func TestIntegrationTempUserCommandsAndQueries(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } ss := InitTestDB(t) cmd := models.CreateTempUserCommand{ OrgId: 2256, diff --git a/pkg/services/sqlstore/transactions_test.go b/pkg/services/sqlstore/transactions_test.go index bbf0be3c240..6d1a48ce9e8 100644 --- a/pkg/services/sqlstore/transactions_test.go +++ b/pkg/services/sqlstore/transactions_test.go @@ -13,6 +13,9 @@ import ( var ErrProvokedError = errors.New("testing error") func TestIntegrationTransaction(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } ss := InitTestDB(t) cmd := &models.AddApiKeyCommand{Key: "secret-key", Name: "key", OrgId: 1} @@ -54,6 +57,9 @@ func TestIntegrationTransaction(t *testing.T) { } func TestIntegrationReuseSessionWithTransaction(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } ss := InitTestDB(t) t.Run("top level transaction", func(t *testing.T) { diff --git a/pkg/services/sqlstore/user_test.go b/pkg/services/sqlstore/user_test.go index 5377eec1635..a1a941797c7 100644 --- a/pkg/services/sqlstore/user_test.go +++ b/pkg/services/sqlstore/user_test.go @@ -11,6 +11,9 @@ import ( ) func TestIntegrationUserDataAccess(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } ss := InitTestDB(t) user := &models.SignedInUser{ OrgId: 1, diff --git a/pkg/services/star/starimpl/store_test.go b/pkg/services/star/starimpl/store_test.go index 7b5070a89ea..6b10acf4164 100644 --- a/pkg/services/star/starimpl/store_test.go +++ b/pkg/services/star/starimpl/store_test.go @@ -10,6 +10,9 @@ import ( ) func TestIntegrationUserStarsDataAccess(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } t.Run("Testing User Stars Data Access", func(t *testing.T) { ss := sqlstore.InitTestDB(t) starStore := sqlStore{db: ss} diff --git a/pkg/services/store/entity_events_test.go b/pkg/services/store/entity_events_test.go index 4919dc3e1d3..ba81b8832b5 100644 --- a/pkg/services/store/entity_events_test.go +++ b/pkg/services/store/entity_events_test.go @@ -11,6 +11,9 @@ import ( ) func TestIntegrationEntityEventsService(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } var ctx context.Context var service EntityEventsService @@ -135,6 +138,9 @@ func TestIntegrationEntityEventsService(t *testing.T) { } func TestIntegrationCreateDatabaseEntityId(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } tests := []struct { name string entityType EntityType diff --git a/pkg/tsdb/mysql/mysql_test.go b/pkg/tsdb/mysql/mysql_test.go index 6499e1437f7..4d67e06fdd6 100644 --- a/pkg/tsdb/mysql/mysql_test.go +++ b/pkg/tsdb/mysql/mysql_test.go @@ -26,6 +26,9 @@ import ( // use to verify that the generated data are visualized as expected, see // devenv/README.md for setup instructions. func TestIntegrationMySQL(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } // change to true to run the MySQL tests runMySQLTests := false // runMySqlTests := true diff --git a/pkg/tsdb/postgres/postgres_test.go b/pkg/tsdb/postgres/postgres_test.go index c7724d086cd..f7092eb2d24 100644 --- a/pkg/tsdb/postgres/postgres_test.go +++ b/pkg/tsdb/postgres/postgres_test.go @@ -23,6 +23,9 @@ import ( // Test generateConnectionString. func TestIntegrationGenerateConnectionString(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } cfg := setting.NewCfg() cfg.DataPath = t.TempDir() @@ -170,6 +173,9 @@ func TestIntegrationGenerateConnectionString(t *testing.T) { // use to verify that the generated data are visualized as expected, see // devenv/README.md for setup instructions. func TestIntegrationPostgres(t *testing.T) { + if testing.Short() { + t.Skip("skipping integration test") + } // change to true to run the PostgreSQL tests const runPostgresTests = false diff --git a/scripts/drone/steps/lib.star b/scripts/drone/steps/lib.star index 60d87b9d393..0f48a2c97ef 100644 --- a/scripts/drone/steps/lib.star +++ b/scripts/drone/steps/lib.star @@ -502,16 +502,28 @@ def build_plugins_step(edition, sign=False): def test_backend_step(edition): - return { - 'name': 'test-backend' + enterprise2_suffix(edition), - 'image': build_image, - 'depends_on': [ - 'wire-install', - ], - 'commands': [ - './bin/grabpl test-backend --edition {}'.format(edition), - ], - } + if edition == 'oss': + return { + 'name': 'test-backend' + enterprise2_suffix(edition), + 'image': build_image, + 'depends_on': [ + 'wire-install', + ], + 'commands': [ + 'go test -short -covermode=atomic -timeout=30m ./pkg/...', + ], + } + else: + return { + 'name': 'test-backend' + enterprise2_suffix(edition), + 'image': build_image, + 'depends_on': [ + 'wire-install', + ], + 'commands': [ + './bin/grabpl test-backend --edition {}'.format(edition), + ], + } def test_backend_integration_step(edition): if edition == 'oss':