mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-14 23:17:29 +00:00
tstest/tstest: add t.Parallel that can be disabled by TS_SERIAL_TESTS=true
Updates #9841 Change-Id: I1b8f4d6e34ac8540e3b0455a7c79bd400e2721b7 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
4dec0c6eb9
commit
6ca8650c7b
@@ -13,6 +13,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"tailscale.com/envknob"
|
||||
"tailscale.com/logtail/backoff"
|
||||
"tailscale.com/types/logger"
|
||||
)
|
||||
@@ -74,3 +75,12 @@ func Shard(t testing.TB) {
|
||||
t.Skipf("skipping shard %d/%d (process has TS_TEST_SHARD=%q)", shard, shards, e)
|
||||
}
|
||||
}
|
||||
|
||||
var serializeParallel = envknob.RegisterBool("TS_SERIAL_TESTS")
|
||||
|
||||
// Parallel calls t.Parallel, unless TS_SERIAL_TESTS is set true.
|
||||
func Parallel(t *testing.T) {
|
||||
if !serializeParallel() {
|
||||
t.Parallel()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user