cmd/testwrapper/flakytest: skip flaky tests if TS_SKIP_FLAKY_TESTS set
This is for a future test scheduler, so it can run potentially flaky tests separately, doing all the non-flaky ones together in one batch. Updates tailscale/corp#28679 Change-Id: Ic4a11f9bf394528ef75792fd622f17bc01a4ec8a Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
d7d12761ba
commit
72f736134d
@@ -11,6 +11,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@@ -60,6 +61,10 @@ func Mark(t testing.TB, issue string) {
|
|||||||
// And then remove this Logf a month or so after that.
|
// And then remove this Logf a month or so after that.
|
||||||
t.Logf("flakytest: issue tracking this flaky test: %s", issue)
|
t.Logf("flakytest: issue tracking this flaky test: %s", issue)
|
||||||
|
|
||||||
|
if boolEnv("TS_SKIP_FLAKY_TESTS") {
|
||||||
|
t.Skipf("skipping due to TS_SKIP_FLAKY_TESTS")
|
||||||
|
}
|
||||||
|
|
||||||
// Record the root test name as flakey.
|
// Record the root test name as flakey.
|
||||||
rootFlakesMu.Lock()
|
rootFlakesMu.Lock()
|
||||||
defer rootFlakesMu.Unlock()
|
defer rootFlakesMu.Unlock()
|
||||||
@@ -80,3 +85,12 @@ func Marked(t testing.TB) bool {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func boolEnv(k string) bool {
|
||||||
|
s := os.Getenv(k)
|
||||||
|
if s == "" {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
v, _ := strconv.ParseBool(s)
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user