Move SkipIntegrationTestInShortMode to testutil. (#110750)
* Move SkipIntegrationTestInShortMode to testutil. * make update-workspace
This commit is contained in:
@@ -2,6 +2,7 @@ package testutil
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
@@ -28,3 +29,16 @@ func init() {
|
||||
panic("importing testing libraries in runtime code is not allowed")
|
||||
}
|
||||
}
|
||||
|
||||
// SkipIntegrationTestInShortMode skips the integration test if it is running in short mode.
|
||||
// This function fails is the test is not an integration test as defined in Grafana (i.e. test
|
||||
// starting with TestIntegration prefix).
|
||||
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")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user