PoC: replace using testing.Short in storage/unified package with integration test skip method (#107887)

* PoC: check if testing.Short is called from integration tests only.

* Rename helper function.

* Fix logic.

* Remove skipping of integration tests from non-integration tests.

* Remove skipping of integration tests from non-integration tests.

* Fix import.
This commit is contained in:
Peter Štibraný
2025-07-09 15:32:10 +00:00
committed by GitHub
parent 5108225785
commit 9d2eadcfd2
7 changed files with 21 additions and 26 deletions
+13 -1
View File
@@ -5,10 +5,13 @@ import (
"crypto/tls"
"net/url"
"os"
"strings"
"testing"
"github.com/go-openapi/strfmt"
goapi "github.com/grafana/grafana-openapi-client-go/client"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/infra/db"
"github.com/grafana/grafana/pkg/infra/tracing"
"github.com/grafana/grafana/pkg/services/accesscontrol/resourcepermissions"
@@ -19,9 +22,18 @@ import (
"github.com/grafana/grafana/pkg/services/user"
"github.com/grafana/grafana/pkg/services/user/userimpl"
"github.com/grafana/grafana/pkg/setting"
"github.com/stretchr/testify/require"
)
func SkipIntegrationTestInShortMode(t testing.TB) {
t.Helper()
if !strings.HasPrefix(t.Name(), "TestIntegration") {
t.Fatal("test is not an integration test")
}
if testing.Short() {
t.Skip("skipping integration test in short mode")
}
}
func CreateUser(t *testing.T, db db.DB, cfg *setting.Cfg, cmd user.CreateUserCommand) int64 {
t.Helper()