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
@@ -45,6 +45,9 @@ type getUserPermissionsTestCase struct {
}
func TestIntegrationAccessControlStore_GetUserPermissions(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
tests := []getUserPermissionsTestCase{
{
desc: "should successfully get user, team and builtin permissions",
@@ -159,6 +162,9 @@ type getTeamsPermissionsTestCase struct {
}
func TestIntegrationAccessControlStore_GetTeamsPermissions(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
tests := []getTeamsPermissionsTestCase{
{
desc: "should successfully get team permissions",
@@ -231,6 +237,9 @@ func TestIntegrationAccessControlStore_GetTeamsPermissions(t *testing.T) {
}
func TestIntegrationAccessControlStore_DeleteUserPermissions(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
t.Run("expect permissions in all orgs to be deleted", func(t *testing.T) {
store, permissionsStore, usrSvc, teamSvc, _, sql := setupTestEnv(t)
user, _ := createUserAndTeam(t, sql, usrSvc, teamSvc, 1)
@@ -313,6 +322,9 @@ func TestIntegrationAccessControlStore_DeleteUserPermissions(t *testing.T) {
}
func TestIntegrationAccessControlStore_DeleteTeamPermissions(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
t.Run("expect permissions related to team to be deleted", func(t *testing.T) {
store, permissionsStore, usrSvc, teamSvc, _, sql := setupTestEnv(t)
user, team := createUserAndTeam(t, sql, usrSvc, teamSvc, 1)
@@ -493,6 +505,9 @@ func setupTestEnv(t testing.TB) (*database.AccessControlStore, rs.Store, user.Se
}
func TestIntegrationAccessControlStore_SearchUsersPermissions(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
ctx := context.Background()
readTeamPerm := func(teamID string) rs.SetResourcePermissionCommand {
return rs.SetResourcePermissionCommand{
@@ -768,6 +783,9 @@ func TestIntegrationAccessControlStore_SearchUsersPermissions(t *testing.T) {
}
func TestIntegrationAccessControlStore_GetUsersBasicRoles(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
ctx := context.Background()
tests := []struct {
name string