Skip to content

Commit cd9e1d8

Browse files
committed
Support multiple HSes on runtime.SkipIf
1 parent 755b28a commit cd9e1d8

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

runtime/hs.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const (
99

1010
var Homeserver string
1111

12-
// Skip the test (via t.Skipf) if the homeserver being tested matches `hs`, else return.
12+
// Skip the test (via t.Skipf) if the homeserver being tested matches one of the homeservers, else return.
1313
//
1414
// The homeserver being tested is detected via the presence of a `*_blacklist` tag e.g:
1515
// go test -tags="dendrite_blacklist"
@@ -18,17 +18,20 @@ var Homeserver string
1818
// implementation is added, a respective `hs_$name.go` needs to be created in this directory. This
1919
// file pairs together the tag name with a string constant declared in this package
2020
// e.g. dendrite_blacklist == runtime.Dendrite
21-
func SkipIf(t *testing.T, hs string) {
21+
func SkipIf(t *testing.T, hses ...string) {
2222
t.Helper()
23-
if Homeserver == hs {
24-
t.Skipf("skipped on %s", hs)
23+
for _, hs := range hses {
24+
if Homeserver == hs {
25+
t.Skipf("skipped on %s", hs)
26+
return
27+
}
2528
}
2629
if Homeserver == "" {
2730
// they ran Complement without a blacklist so it's impossible to know what HS they are
2831
// running, warn them.
2932
t.Logf(
30-
"WARNING: %s called runtime.SkipIf(%s) but Complement doesn't know which HS is running as it was run without a *_blacklist tag: executing test.",
31-
t.Name(), hs,
33+
"WARNING: %s called runtime.SkipIf(%v) but Complement doesn't know which HS is running as it was run without a *_blacklist tag: executing test.",
34+
t.Name(), hses,
3235
)
3336
}
3437
}

0 commit comments

Comments
 (0)