Chore: Omit integration tests if short test flag is passed (#108777)

* omit integration tests if short test flag is passed

* Update pkg/services/ngalert/models/receivers_test.go

Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>

* Update pkg/tests/api/alerting/api_ruler_test.go

Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>

* Update pkg/tests/api/alerting/api_ruler_test.go

Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>

* Update pkg/tests/api/alerting/api_ruler_test.go

Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>

* Update pkg/tests/api/alerting/api_ruler_test.go

Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>

* Update pkg/tests/api/alerting/api_ruler_test.go

Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>

* Update pkg/services/ngalert/models/receivers_test.go

Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>

* Update pkg/cmd/grafana-cli/commands/datamigrations/to_unified_storage_test.go

Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>

* Update pkg/services/ngalert/models/receivers_test.go

Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>

* fix the rest

* false positive

---------

Co-authored-by: Matheus Macabu <macabu@users.noreply.github.com>
This commit is contained in:
Serge Zaitsev
2025-07-28 13:38:54 +02:00
committed by GitHub
co-authored by Matheus Macabu
parent 1a7a7f1d99
commit a95fb3a37c
103 changed files with 830 additions and 22 deletions
@@ -26,6 +26,9 @@ func TestMain(m *testing.M) {
}
func TestIntegrationDashboardFolderStore(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
var sqlStore db.DB
var cfg *setting.Cfg
var dashboardStore dashboards.Store
@@ -727,6 +727,9 @@ func TestIntegrationNestedFolderServiceBasicOperations(t *testing.T) {
}
func TestIntegrationNestedFolderServiceFeatureToggle(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
nestedFolderStore := folder.NewFakeStore()
dashStore := dashboards.FakeDashboardStore{}
@@ -758,6 +761,9 @@ func TestIntegrationNestedFolderServiceFeatureToggle(t *testing.T) {
}
func TestIntegrationFolderServiceDualWrite(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
db, _ := sqlstore.InitTestDB(t)
cfg := setting.NewCfg()
features := featuremgmt.WithFeatures()
@@ -817,6 +823,9 @@ func TestIntegrationFolderServiceDualWrite(t *testing.T) {
}
func TestIntegrationNestedFolderService(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
t.Run("with feature flag unset", func(t *testing.T) {
t.Run("Should create a folder in both dashboard and folders tables", func(t *testing.T) {
// dash is needed here because folderSvc.Create expects SaveDashboard to return it
@@ -1691,6 +1700,9 @@ func TestIntegrationNestedFolderSharedWithMe(t *testing.T) {
}
func TestIntegrationFolderServiceGetFolder(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
db, _ := sqlstore.InitTestDB(t)
signedInAdminUser := user.SignedInUser{UserID: 1, OrgID: orgID, Permissions: map[int64]map[string][]string{
@@ -1802,6 +1814,9 @@ func TestIntegrationFolderServiceGetFolder(t *testing.T) {
}
func TestIntegrationFolderServiceGetFolders(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
db, cfg := sqlstore.InitTestDB(t)
folderStore := ProvideDashboardFolderStore(db)
@@ -1873,6 +1888,9 @@ func TestIntegrationFolderServiceGetFolders(t *testing.T) {
// TODO replace it with an API test under /pkg/tests/api/folders
// whenever the golang client with get updated to allow filtering child folders by permission
func TestIntegrationGetChildrenFilterByPermission(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
db, cfg := sqlstore.InitTestDB(t)
signedInAdminUser := user.SignedInUser{UserID: 1, OrgID: orgID, Permissions: map[int64]map[string][]string{
@@ -848,6 +848,9 @@ func TestGetFoldersFromApiServer(t *testing.T) {
}
func TestIntegrationDeleteFoldersFromApiServer(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
fakeK8sClient := new(client.MockK8sHandler)
fakeK8sClient.On("GetNamespace", mock.Anything, mock.Anything).Return("default")
dashboardK8sclient := new(client.MockK8sHandler)