diff --git a/.drone.yml b/.drone.yml index f916240230c..dfc0ea8a49b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -137,7 +137,7 @@ steps: image: grafana/build-container:1.5.4 name: test-backend - commands: - - ./bin/grabpl integration-tests --edition oss + - go test -run Integration -covermode=atomic -timeout=30m ./pkg/... depends_on: - wire-install image: grafana/build-container:1.5.4 @@ -815,7 +815,7 @@ steps: image: grafana/build-container:1.5.4 name: test-backend - commands: - - ./bin/grabpl integration-tests --edition oss + - go test -run Integration -covermode=atomic -timeout=30m ./pkg/... depends_on: - wire-install image: grafana/build-container:1.5.4 @@ -1911,7 +1911,7 @@ steps: image: grafana/build-container:1.5.4 name: test-backend - commands: - - ./bin/grabpl integration-tests --edition oss + - go test -run Integration -covermode=atomic -timeout=30m ./pkg/... depends_on: - wire-install image: grafana/build-container:1.5.4 @@ -3707,7 +3707,7 @@ steps: image: grafana/build-container:1.5.4 name: test-backend - commands: - - ./bin/grabpl integration-tests --edition oss + - go test -run Integration -covermode=atomic -timeout=30m ./pkg/... depends_on: - wire-install image: grafana/build-container:1.5.4 @@ -4725,6 +4725,6 @@ kind: secret name: gcp_upload_artifacts_key --- kind: signature -hmac: f4586777ea98ff85fec51ae5bf344bf549871f73aab2b6ff6611ce979b5bbfa1 +hmac: 766806dc9d5e5585e86671ded45d0048cab66c5dc9aaacb5ecb79b8e6754db18 ... diff --git a/pkg/infra/filestorage/fs_integration_test.go b/pkg/infra/filestorage/fs_integration_test.go index 2d12d79ded7..48cc7285051 100644 --- a/pkg/infra/filestorage/fs_integration_test.go +++ b/pkg/infra/filestorage/fs_integration_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package filestorage import ( diff --git a/pkg/infra/filestorage/test_utils.go b/pkg/infra/filestorage/test_utils.go index d938465a784..657e3cb9e0e 100644 --- a/pkg/infra/filestorage/test_utils.go +++ b/pkg/infra/filestorage/test_utils.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package filestorage import ( @@ -137,7 +134,6 @@ type queryListFiles struct { type queryListFoldersInput struct { path string - paging *Paging options *ListOptions } @@ -200,7 +196,7 @@ func handleCommand(t *testing.T, ctx context.Context, cmd interface{}, cmdName s } func runChecks(t *testing.T, stepName string, path string, output interface{}, checks []interface{}) { - if checks == nil || len(checks) == 0 { + if len(checks) == 0 { return } @@ -254,7 +250,6 @@ func runChecks(t *testing.T, stepName string, path string, output interface{}, c default: t.Fatalf("unrecognized output %s", interfaceName(output)) } - } func formatPathStructure(files []*File) string { @@ -360,5 +355,4 @@ func executeTestStep(t *testing.T, ctx context.Context, step interface{}, stepNu default: t.Fatalf("unrecognized step %s", name) } - } diff --git a/pkg/infra/kvstore/kvstore_test.go b/pkg/infra/kvstore/kvstore_test.go index 452fd374f39..8467f31e4df 100644 --- a/pkg/infra/kvstore/kvstore_test.go +++ b/pkg/infra/kvstore/kvstore_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package kvstore import ( diff --git a/pkg/infra/serverlock/serverlock_integration_test.go b/pkg/infra/serverlock/serverlock_integration_test.go index 82cfecb3fc8..9e839645c19 100644 --- a/pkg/infra/serverlock/serverlock_integration_test.go +++ b/pkg/infra/serverlock/serverlock_integration_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package serverlock import ( diff --git a/pkg/services/alerting/engine_integration_test.go b/pkg/services/alerting/engine_integration_test.go index 2be99c375a8..c0a11f41280 100644 --- a/pkg/services/alerting/engine_integration_test.go +++ b/pkg/services/alerting/engine_integration_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package alerting import ( @@ -81,7 +78,11 @@ func (handler *FakeCommonTimeoutHandler) Eval(evalContext *EvalContext) { url := srv.URL + path res, err := sendRequest(evalContext.Ctx, url, handler.TransportTimeoutDuration) if res != nil { - defer res.Body.Close() + defer func() { + if err := res.Body.Close(); err != nil { + logger.Warn("Error", "err", err) + } + }() } if err != nil { @@ -106,7 +107,11 @@ func (handler *FakeCommonTimeoutHandler) handle(evalContext *EvalContext) error url := srv.URL + path res, err := sendRequest(evalContext.Ctx, url, handler.TransportTimeoutDuration) if res != nil { - defer res.Body.Close() + defer func() { + if err := res.Body.Close(); err != nil { + logger.Warn("Error", "err", err) + } + }() } if err != nil { diff --git a/pkg/services/dashboards/database/acl_test.go b/pkg/services/dashboards/database/acl_test.go index 255efaa694d..159ccb90fc1 100644 --- a/pkg/services/dashboards/database/acl_test.go +++ b/pkg/services/dashboards/database/acl_test.go @@ -1,17 +1,13 @@ -//go:build integration -// +build integration - package database import ( "context" "testing" - "github.com/stretchr/testify/require" - "github.com/grafana/grafana/pkg/models" "github.com/grafana/grafana/pkg/services/sqlstore" "github.com/grafana/grafana/pkg/setting" + "github.com/stretchr/testify/require" ) func TestIntegrationDashboardAclDataAccess(t *testing.T) { @@ -85,7 +81,6 @@ func TestIntegrationDashboardAclDataAccess(t *testing.T) { }) t.Run("Given a dashboard folder and a user", func(t *testing.T) { - t.Run("Given dashboard folder permission", func(t *testing.T) { setup(t) err := updateDashboardAcl(t, dashboardStore, savedFolder.Id, models.DashboardAcl{ diff --git a/pkg/services/dashboards/database/database_folder_test.go b/pkg/services/dashboards/database/database_folder_test.go index f163f132e98..9fc099c1251 100644 --- a/pkg/services/dashboards/database/database_folder_test.go +++ b/pkg/services/dashboards/database/database_folder_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package database import ( diff --git a/pkg/services/dashboards/database/database_provisioning_test.go b/pkg/services/dashboards/database/database_provisioning_test.go index 7ef1524490d..1b9d3813df6 100644 --- a/pkg/services/dashboards/database/database_provisioning_test.go +++ b/pkg/services/dashboards/database/database_provisioning_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package database import ( diff --git a/pkg/services/dashboards/database/database_test.go b/pkg/services/dashboards/database/database_test.go index 7ad04c3e053..5a73c2b3710 100644 --- a/pkg/services/dashboards/database/database_test.go +++ b/pkg/services/dashboards/database/database_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package database import ( @@ -246,7 +243,7 @@ func TestIntegrationDashboardDataAccess(t *testing.T) { require.NoError(t, err) require.Equal(t, len(res), 0) - sqlStore.WithDbSession(context.Background(), func(sess *sqlstore.DBSession) error { + err = sqlStore.WithDbSession(context.Background(), func(sess *sqlstore.DBSession) error { var existingRuleID int64 exists, err := sess.Table("alert_rule").Where("namespace_uid = (SELECT uid FROM dashboard WHERE id = ?)", savedFolder.Id).Cols("id").Get(&existingRuleID) require.NoError(t, err) @@ -259,6 +256,7 @@ func TestIntegrationDashboardDataAccess(t *testing.T) { return nil }) + require.NoError(t, err) }) t.Run("Should return error if no dashboard is found for update when dashboard id is greater than zero", func(t *testing.T) { @@ -541,7 +539,6 @@ func TestIntegrationDashboard_SortingOptions(t *testing.T) { require.Len(t, results, 2) assert.Equal(t, dashB.Id, results[0].ID) assert.Equal(t, dashA.Id, results[1].ID) - } func TestIntegrationDashboard_Filter(t *testing.T) { @@ -583,11 +580,10 @@ func TestIntegrationDashboard_Filter(t *testing.T) { require.NoError(t, err) require.Len(t, results, 1) assert.Equal(t, dashB.Id, results[0].ID) - } func insertTestRule(t *testing.T, sqlStore *sqlstore.SQLStore, foderOrgID int64, folderUID string) { - sqlStore.WithDbSession(context.Background(), func(sess *sqlstore.DBSession) error { + err := sqlStore.WithDbSession(context.Background(), func(sess *sqlstore.DBSession) error { type alertQuery struct { RefID string DatasourceUID string @@ -656,6 +652,7 @@ func insertTestRule(t *testing.T, sqlStore *sqlstore.SQLStore, foderOrgID int64, require.NoError(t, err) return err }) + require.NoError(t, err) } func CreateUser(t *testing.T, sqlStore *sqlstore.SQLStore, name string, role string, isAdmin bool) models.User { diff --git a/pkg/services/dashboards/service/dashboard_service_integration_test.go b/pkg/services/dashboards/service/dashboard_service_integration_test.go index 650703067f9..cc1f4bfc948 100644 --- a/pkg/services/dashboards/service/dashboard_service_integration_test.go +++ b/pkg/services/dashboards/service/dashboard_service_integration_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package service import ( @@ -14,7 +11,6 @@ import ( "github.com/grafana/grafana/pkg/models" accesscontrolmock "github.com/grafana/grafana/pkg/services/accesscontrol/mock" "github.com/grafana/grafana/pkg/services/alerting" - "github.com/grafana/grafana/pkg/services/dashboards" dashbboardservice "github.com/grafana/grafana/pkg/services/dashboards" "github.com/grafana/grafana/pkg/services/dashboards/database" "github.com/grafana/grafana/pkg/services/featuremgmt" @@ -797,7 +793,7 @@ func TestIntegrationIntegratedDashboardService(t *testing.T) { type permissionScenarioContext struct { dashboardGuardianMock *guardian.FakeDashboardGuardian sqlStore *sqlstore.SQLStore - dashboardStore dashboards.Store + dashboardStore dashbboardservice.Store savedFolder *models.Dashboard savedDashInFolder *models.Dashboard otherSavedFolder *models.Dashboard diff --git a/pkg/services/dashboards/service/dashboard_service_test.go b/pkg/services/dashboards/service/dashboard_service_test.go index 68e1b466c4c..65a05ed8d2e 100644 --- a/pkg/services/dashboards/service/dashboard_service_test.go +++ b/pkg/services/dashboards/service/dashboard_service_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package service import ( @@ -187,7 +184,6 @@ func TestIntegrationDashboardService(t *testing.T) { }) t.Run("Given non provisioned dashboard", func(t *testing.T) { - t.Run("DeleteProvisionedDashboard should delete the dashboard", func(t *testing.T) { args := &models.DeleteDashboardCommand{OrgId: 1, Id: 1, ForceDeleteFolderRules: false} fakeStore.On("DeleteDashboard", mock.Anything, args).Return(nil).Once() @@ -205,7 +201,3 @@ func TestIntegrationDashboardService(t *testing.T) { }) }) } - -type Result struct { - deleteWasCalled bool -} diff --git a/pkg/services/dashboards/service/folder_service_test.go b/pkg/services/dashboards/service/folder_service_test.go index 2c839b5dfd0..acd181286e6 100644 --- a/pkg/services/dashboards/service/folder_service_test.go +++ b/pkg/services/dashboards/service/folder_service_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package service import ( diff --git a/pkg/services/dashboardversion/dashverimpl/store_test.go b/pkg/services/dashboardversion/dashverimpl/store_test.go index 89c44a8bf40..ce27aa6b479 100644 --- a/pkg/services/dashboardversion/dashverimpl/store_test.go +++ b/pkg/services/dashboardversion/dashverimpl/store_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package dashverimpl import ( @@ -148,6 +145,7 @@ func insertTestDashboard(t *testing.T, sqlStore *sqlstore.SQLStore, title string return nil }) + require.NoError(t, err) return dash } diff --git a/pkg/services/live/database/tests/storage_test.go b/pkg/services/live/database/tests/storage_test.go index 89d41b118b1..8f57af305b6 100644 --- a/pkg/services/live/database/tests/storage_test.go +++ b/pkg/services/live/database/tests/storage_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package tests import ( diff --git a/pkg/services/ngalert/store/alertmanager_test.go b/pkg/services/ngalert/store/alertmanager_test.go index 83c85ca4631..575ff4415e7 100644 --- a/pkg/services/ngalert/store/alertmanager_test.go +++ b/pkg/services/ngalert/store/alertmanager_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package store import ( diff --git a/pkg/services/ngalert/store/image_test.go b/pkg/services/ngalert/store/image_test.go index 52d6772c6c8..d7f84fb91c6 100644 --- a/pkg/services/ngalert/store/image_test.go +++ b/pkg/services/ngalert/store/image_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package store_test import ( diff --git a/pkg/services/ngalert/store/instance_database_test.go b/pkg/services/ngalert/store/instance_database_test.go index 94f1b681ab1..c305cce7e02 100644 --- a/pkg/services/ngalert/store/instance_database_test.go +++ b/pkg/services/ngalert/store/instance_database_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package store_test import ( diff --git a/pkg/services/preference/prefimpl/store_test.go b/pkg/services/preference/prefimpl/store_test.go index 5597d0ad72e..361663860d7 100644 --- a/pkg/services/preference/prefimpl/store_test.go +++ b/pkg/services/preference/prefimpl/store_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package prefimpl import ( diff --git a/pkg/services/queryhistory/queryhistory_create_test.go b/pkg/services/queryhistory/queryhistory_create_test.go index 9f8eda379de..00f891359eb 100644 --- a/pkg/services/queryhistory/queryhistory_create_test.go +++ b/pkg/services/queryhistory/queryhistory_create_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package queryhistory import ( diff --git a/pkg/services/queryhistory/queryhistory_delete_stale_test.go b/pkg/services/queryhistory/queryhistory_delete_stale_test.go index db8d4708afe..84fbfd7e317 100644 --- a/pkg/services/queryhistory/queryhistory_delete_stale_test.go +++ b/pkg/services/queryhistory/queryhistory_delete_stale_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package queryhistory import ( diff --git a/pkg/services/queryhistory/queryhistory_delete_test.go b/pkg/services/queryhistory/queryhistory_delete_test.go index 1cc45f75c84..bf8ff11d45c 100644 --- a/pkg/services/queryhistory/queryhistory_delete_test.go +++ b/pkg/services/queryhistory/queryhistory_delete_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package queryhistory import ( diff --git a/pkg/services/queryhistory/queryhistory_enforce_limit_test.go b/pkg/services/queryhistory/queryhistory_enforce_limit_test.go index bb69e8d02f9..85ef244dfae 100644 --- a/pkg/services/queryhistory/queryhistory_enforce_limit_test.go +++ b/pkg/services/queryhistory/queryhistory_enforce_limit_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package queryhistory import ( diff --git a/pkg/services/queryhistory/queryhistory_migrate_test.go b/pkg/services/queryhistory/queryhistory_migrate_test.go index 327fb0df083..c323f51e44f 100644 --- a/pkg/services/queryhistory/queryhistory_migrate_test.go +++ b/pkg/services/queryhistory/queryhistory_migrate_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package queryhistory import ( diff --git a/pkg/services/queryhistory/queryhistory_patch_test.go b/pkg/services/queryhistory/queryhistory_patch_test.go index 909cd507940..2d299b992d5 100644 --- a/pkg/services/queryhistory/queryhistory_patch_test.go +++ b/pkg/services/queryhistory/queryhistory_patch_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package queryhistory import ( diff --git a/pkg/services/queryhistory/queryhistory_search_test.go b/pkg/services/queryhistory/queryhistory_search_test.go index 3a17bfaaf48..d40291094ee 100644 --- a/pkg/services/queryhistory/queryhistory_search_test.go +++ b/pkg/services/queryhistory/queryhistory_search_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package queryhistory import ( diff --git a/pkg/services/queryhistory/queryhistory_star_test.go b/pkg/services/queryhistory/queryhistory_star_test.go index b873b573440..96980cadb9d 100644 --- a/pkg/services/queryhistory/queryhistory_star_test.go +++ b/pkg/services/queryhistory/queryhistory_star_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package queryhistory import ( diff --git a/pkg/services/queryhistory/queryhistory_test.go b/pkg/services/queryhistory/queryhistory_test.go index b88c3161309..395be6b0489 100644 --- a/pkg/services/queryhistory/queryhistory_test.go +++ b/pkg/services/queryhistory/queryhistory_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package queryhistory import ( diff --git a/pkg/services/queryhistory/queryhistory_unstar_test.go b/pkg/services/queryhistory/queryhistory_unstar_test.go index 65c88f250c1..c9a7c0159ab 100644 --- a/pkg/services/queryhistory/queryhistory_unstar_test.go +++ b/pkg/services/queryhistory/queryhistory_unstar_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package queryhistory import ( diff --git a/pkg/services/sqlstore/alert_notification_test.go b/pkg/services/sqlstore/alert_notification_test.go index 0ffdde8f4d3..ceb18ae11fa 100644 --- a/pkg/services/sqlstore/alert_notification_test.go +++ b/pkg/services/sqlstore/alert_notification_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package sqlstore import ( diff --git a/pkg/services/sqlstore/alert_test.go b/pkg/services/sqlstore/alert_test.go index 714bead0d44..51d23fa060d 100644 --- a/pkg/services/sqlstore/alert_test.go +++ b/pkg/services/sqlstore/alert_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package sqlstore import ( diff --git a/pkg/services/sqlstore/annotation_test.go b/pkg/services/sqlstore/annotation_test.go index d04ab88d6df..bb62758231f 100644 --- a/pkg/services/sqlstore/annotation_test.go +++ b/pkg/services/sqlstore/annotation_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package sqlstore_test import ( diff --git a/pkg/services/sqlstore/apikey_test.go b/pkg/services/sqlstore/apikey_test.go index 7b6631141f3..6be90afeb9d 100644 --- a/pkg/services/sqlstore/apikey_test.go +++ b/pkg/services/sqlstore/apikey_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package sqlstore import ( diff --git a/pkg/services/sqlstore/dashboard_snapshot_test.go b/pkg/services/sqlstore/dashboard_snapshot_test.go index e048028027b..e5ad58c69db 100644 --- a/pkg/services/sqlstore/dashboard_snapshot_test.go +++ b/pkg/services/sqlstore/dashboard_snapshot_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package sqlstore import ( diff --git a/pkg/services/sqlstore/dashboard_thumbs_test.go b/pkg/services/sqlstore/dashboard_thumbs_test.go index 9d2466e1812..b6fb79911a4 100644 --- a/pkg/services/sqlstore/dashboard_thumbs_test.go +++ b/pkg/services/sqlstore/dashboard_thumbs_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package sqlstore import ( @@ -15,7 +12,6 @@ var theme = models.ThemeDark var kind = models.ThumbnailKindDefault func TestIntegrationSqlStorage(t *testing.T) { - var sqlStore *SQLStore var savedFolder *models.Dashboard diff --git a/pkg/services/sqlstore/dashboard_version_test.go b/pkg/services/sqlstore/dashboard_version_test.go index 33675984e8c..315170c25d6 100644 --- a/pkg/services/sqlstore/dashboard_version_test.go +++ b/pkg/services/sqlstore/dashboard_version_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package sqlstore import ( @@ -108,20 +105,3 @@ func TestIntegrationGetDashboardVersions(t *testing.T) { require.Equal(t, 2, len(query.Result)) }) } - -func getDashboard(t *testing.T, sqlStore *SQLStore, dashboard *models.Dashboard) error { - t.Helper() - return sqlStore.WithDbSession(context.Background(), func(sess *DBSession) error { - has, err := sess.Get(dashboard) - - if err != nil { - return err - } else if !has { - return models.ErrDashboardNotFound - } - - dashboard.SetId(dashboard.Id) - dashboard.SetUid(dashboard.Uid) - return nil - }) -} diff --git a/pkg/services/sqlstore/datasource_test.go b/pkg/services/sqlstore/datasource_test.go index dc1df547a75..9d6fccf1eed 100644 --- a/pkg/services/sqlstore/datasource_test.go +++ b/pkg/services/sqlstore/datasource_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package sqlstore import ( diff --git a/pkg/services/sqlstore/health_test.go b/pkg/services/sqlstore/health_test.go index 7cb4629d888..5028842d033 100644 --- a/pkg/services/sqlstore/health_test.go +++ b/pkg/services/sqlstore/health_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package sqlstore import ( diff --git a/pkg/services/sqlstore/login_attempt_test.go b/pkg/services/sqlstore/login_attempt_test.go index 00bce863185..c2b2d797246 100644 --- a/pkg/services/sqlstore/login_attempt_test.go +++ b/pkg/services/sqlstore/login_attempt_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package sqlstore import ( diff --git a/pkg/services/sqlstore/org_test.go b/pkg/services/sqlstore/org_test.go index 0acecf03971..9c498def546 100644 --- a/pkg/services/sqlstore/org_test.go +++ b/pkg/services/sqlstore/org_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package sqlstore import ( @@ -465,6 +462,7 @@ func insertTestDashboard(t *testing.T, sqlStore *SQLStore, title string, orgId i return nil }) + require.NoError(t, err) return dash } diff --git a/pkg/services/sqlstore/playlist_test.go b/pkg/services/sqlstore/playlist_test.go index 1c4546bfe52..0c5d4d45ecd 100644 --- a/pkg/services/sqlstore/playlist_test.go +++ b/pkg/services/sqlstore/playlist_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package sqlstore import ( diff --git a/pkg/services/sqlstore/plugin_setting_test.go b/pkg/services/sqlstore/plugin_setting_test.go index 6aedd3285aa..100bf12868d 100644 --- a/pkg/services/sqlstore/plugin_setting_test.go +++ b/pkg/services/sqlstore/plugin_setting_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package sqlstore import ( diff --git a/pkg/services/sqlstore/quota_test.go b/pkg/services/sqlstore/quota_test.go index f795c4dcce7..ccb26eade0f 100644 --- a/pkg/services/sqlstore/quota_test.go +++ b/pkg/services/sqlstore/quota_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package sqlstore import ( diff --git a/pkg/services/sqlstore/sqlbuilder_test.go b/pkg/services/sqlstore/sqlbuilder_test.go index 6b185611b46..d86cadd0e1b 100644 --- a/pkg/services/sqlstore/sqlbuilder_test.go +++ b/pkg/services/sqlstore/sqlbuilder_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package sqlstore import ( diff --git a/pkg/services/sqlstore/sqlstore_test.go b/pkg/services/sqlstore/sqlstore_test.go index b9a8b9ec88f..0ba0b60ec63 100644 --- a/pkg/services/sqlstore/sqlstore_test.go +++ b/pkg/services/sqlstore/sqlstore_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package sqlstore import ( diff --git a/pkg/services/sqlstore/stats_integration_test.go b/pkg/services/sqlstore/stats_integration_test.go index 03e89945a10..ae3542bdd58 100644 --- a/pkg/services/sqlstore/stats_integration_test.go +++ b/pkg/services/sqlstore/stats_integration_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package sqlstore import ( diff --git a/pkg/services/sqlstore/stats_test.go b/pkg/services/sqlstore/stats_test.go index 90f8698e6b0..8d5a08dff28 100644 --- a/pkg/services/sqlstore/stats_test.go +++ b/pkg/services/sqlstore/stats_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package sqlstore import ( diff --git a/pkg/services/sqlstore/tags_test.go b/pkg/services/sqlstore/tags_test.go index 28bee4d048c..d7187a49f3b 100644 --- a/pkg/services/sqlstore/tags_test.go +++ b/pkg/services/sqlstore/tags_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package sqlstore import ( diff --git a/pkg/services/sqlstore/team_test.go b/pkg/services/sqlstore/team_test.go index f20e3840bf4..00684bef797 100644 --- a/pkg/services/sqlstore/team_test.go +++ b/pkg/services/sqlstore/team_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package sqlstore import ( @@ -396,7 +393,6 @@ func TestIntegrationTeamCommandsAndQueries(t *testing.T) { // should not receive service account from query require.Equal(t, len(teamMembersQuery.Result), 1) }) - }) }) } @@ -480,7 +476,6 @@ func TestIntegrationSQLStore_GetTeamMembers_ACFilter(t *testing.T) { // Seed 2 teams with 2 members setup := func(store *SQLStore) { - team1, errCreateTeam := store.CreateTeam("group1 name", "test1@example.org", testOrgID) require.NoError(t, errCreateTeam) team2, errCreateTeam := store.CreateTeam("group2 name", "test2@example.org", testOrgID) diff --git a/pkg/services/sqlstore/temp_user_test.go b/pkg/services/sqlstore/temp_user_test.go index 117d2157307..04fd9b79263 100644 --- a/pkg/services/sqlstore/temp_user_test.go +++ b/pkg/services/sqlstore/temp_user_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package sqlstore import ( diff --git a/pkg/services/sqlstore/transactions_test.go b/pkg/services/sqlstore/transactions_test.go index 77e1b6d76af..bbf0be3c240 100644 --- a/pkg/services/sqlstore/transactions_test.go +++ b/pkg/services/sqlstore/transactions_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package sqlstore import ( diff --git a/pkg/services/sqlstore/user_test.go b/pkg/services/sqlstore/user_test.go index 31a3d1b9893..662fd67e11d 100644 --- a/pkg/services/sqlstore/user_test.go +++ b/pkg/services/sqlstore/user_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package sqlstore import ( @@ -15,7 +12,6 @@ import ( ) func TestIntegrationUserDataAccess(t *testing.T) { - ss := InitTestDB(t) user := &models.SignedInUser{ OrgId: 1, @@ -364,7 +360,6 @@ func TestIntegrationUserDataAccess(t *testing.T) { ss = InitTestDB(t) t.Run("Testing DB - enable all users", func(t *testing.T) { - users := createFiveTestUsers(t, ss, func(i int) *models.CreateUserCommand { return &models.CreateUserCommand{ Email: fmt.Sprint("user", i, "@test.com"), @@ -452,7 +447,6 @@ func TestIntegrationUserDataAccess(t *testing.T) { }) t.Run("Testing DB - grafana admin users", func(t *testing.T) { - ss = InitTestDB(t) createUserCmd := models.CreateUserCommand{ diff --git a/pkg/services/star/starimpl/store_test.go b/pkg/services/star/starimpl/store_test.go index 476004b26db..7b5070a89ea 100644 --- a/pkg/services/star/starimpl/store_test.go +++ b/pkg/services/star/starimpl/store_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package starimpl import ( diff --git a/pkg/services/store/entity_events_test.go b/pkg/services/store/entity_events_test.go index df1e827f873..4919dc3e1d3 100644 --- a/pkg/services/store/entity_events_test.go +++ b/pkg/services/store/entity_events_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package store import ( @@ -78,6 +75,7 @@ func TestIntegrationEntityEventsService(t *testing.T) { }) require.NoError(t, err) firstEv, err := service.GetLastEvent(ctx) + require.NoError(t, err) firstEvId := firstEv.Id err = service.SaveEvent(ctx, SaveEventCmd{ diff --git a/pkg/tsdb/mysql/mysql_test.go b/pkg/tsdb/mysql/mysql_test.go index 4dd65ee5338..6499e1437f7 100644 --- a/pkg/tsdb/mysql/mysql_test.go +++ b/pkg/tsdb/mysql/mysql_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package mysql import ( diff --git a/pkg/tsdb/postgres/postgres_test.go b/pkg/tsdb/postgres/postgres_test.go index b3087c9df27..c7724d086cd 100644 --- a/pkg/tsdb/postgres/postgres_test.go +++ b/pkg/tsdb/postgres/postgres_test.go @@ -1,6 +1,3 @@ -//go:build integration -// +build integration - package postgres import ( diff --git a/scripts/drone/steps/lib.star b/scripts/drone/steps/lib.star index 559e058cb9e..3025e337056 100644 --- a/scripts/drone/steps/lib.star +++ b/scripts/drone/steps/lib.star @@ -510,18 +510,30 @@ def test_backend_step(edition): ], } - def test_backend_integration_step(edition): - return { - 'name': 'test-backend-integration' + enterprise2_suffix(edition), - 'image': build_image, - 'depends_on': [ - 'wire-install', - ], - 'commands': [ - './bin/grabpl integration-tests --edition {}'.format(edition), - ], - } + if edition == 'oss': + return { + 'name': 'test-backend-integration', + 'image': build_image, + 'depends_on': [ + 'wire-install', + ], + 'commands': [ + 'go test -run Integration -covermode=atomic -timeout=30m ./pkg/...', + ], + } + else: + return { + 'name': 'test-backend-integration' + enterprise2_suffix(edition), + 'image': build_image, + 'depends_on': [ + 'wire-install', + ], + 'commands': [ + './bin/grabpl integration-tests --edition {}'.format(edition), + ], + } + def test_frontend_step():