Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Tobler <jtobler@gitlab.com>2023-02-07 23:13:42 +0300
committerJustin Tobler <jtobler@gitlab.com>2023-02-08 20:21:31 +0300
commit7ac312d7601346bab08bad1194e0e2fc5102beb1 (patch)
tree62c4773f1b04810bf263b31cfbd446202f53cbb4
parentb7b090fbfa172af1631741da78bcc21b27223d40 (diff)
testhelper: Skip quarantined tests
Currently there is not a standardized approach to quarantining flaky tests. This change implements `testhelper.SkipQuarantinedTest` which can be invoked to skip specified tests during execution.
-rw-r--r--NOTICE2
-rw-r--r--go.mod2
-rw-r--r--internal/testhelper/testhelper.go13
3 files changed, 15 insertions, 2 deletions
diff --git a/NOTICE b/NOTICE
index 8fe111971..a71c99bec 100644
--- a/NOTICE
+++ b/NOTICE
@@ -24160,7 +24160,7 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-LICENSE - golang.org/x/exp/rand
+LICENSE - golang.org/x/exp
Copyright (c) 2009 The Go Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/go.mod b/go.mod
index 7d139e6e4..05f4cbf23 100644
--- a/go.mod
+++ b/go.mod
@@ -41,6 +41,7 @@ require (
gitlab.com/gitlab-org/labkit v1.17.0
go.uber.org/goleak v1.2.0
gocloud.dev v0.28.0
+ golang.org/x/exp v0.0.0-20221031165847-c99f073a8326
golang.org/x/sync v0.1.0
golang.org/x/sys v0.5.0
golang.org/x/time v0.3.0
@@ -180,7 +181,6 @@ require (
go.opencensus.io v0.24.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
golang.org/x/crypto v0.5.0 // indirect
- golang.org/x/exp v0.0.0-20221031165847-c99f073a8326 // indirect
golang.org/x/mod v0.6.0 // indirect
golang.org/x/net v0.5.0 // indirect
golang.org/x/oauth2 v0.2.0 // indirect
diff --git a/internal/testhelper/testhelper.go b/internal/testhelper/testhelper.go
index b24416a8f..0ad0c7a47 100644
--- a/internal/testhelper/testhelper.go
+++ b/internal/testhelper/testhelper.go
@@ -28,6 +28,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v15/internal/helper/perm"
"gitlab.com/gitlab-org/gitaly/v15/internal/metadata/featureflag"
+ "golang.org/x/exp/slices"
)
const (
@@ -383,3 +384,15 @@ func GitalyOrPraefect[Type any](gitaly, praefect Type) Type {
}
return gitaly
}
+
+// SkipQuarantinedTest skips the test if the test name has been specified as
+// quarantined. If no test names are provided the test is always skipped.
+func SkipQuarantinedTest(t *testing.T, issue string, tests ...string) {
+ if issue == "" {
+ panic("issue not specified")
+ }
+
+ if len(tests) == 0 || slices.Contains(tests, t.Name()) {
+ t.Skipf("This test has been quarantined. Please see %s for more information.", issue)
+ }
+}