diff options
| author | Brad Fitzpatrick <bradfitz@tailscale.com> | 2026-01-28 08:41:38 -0800 |
|---|---|---|
| committer | Brad Fitzpatrick <brad@danga.com> | 2026-01-28 08:54:33 -0800 |
| commit | 72f736134d741b5825b8952a1e33f37a79e4acfb (patch) | |
| tree | 12d7bb283e1e3969edf3ec06488f76cba381016e | |
| parent | d7d12761ba8c9fc029ef4fae5e5644eb6cdae2d7 (diff) | |
| download | tailscale-72f736134d741b5825b8952a1e33f37a79e4acfb.tar.xz tailscale-72f736134d741b5825b8952a1e33f37a79e4acfb.zip | |
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>
| -rw-r--r-- | cmd/testwrapper/flakytest/flakytest.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cmd/testwrapper/flakytest/flakytest.go b/cmd/testwrapper/flakytest/flakytest.go index b98d739c6..5e1591e81 100644 --- a/cmd/testwrapper/flakytest/flakytest.go +++ b/cmd/testwrapper/flakytest/flakytest.go @@ -11,6 +11,7 @@ import ( "os" "path" "regexp" + "strconv" "sync" "testing" @@ -60,6 +61,10 @@ func Mark(t testing.TB, issue string) { // And then remove this Logf a month or so after that. 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. rootFlakesMu.Lock() defer rootFlakesMu.Unlock() @@ -80,3 +85,12 @@ func Marked(t testing.TB) bool { } return false } + +func boolEnv(k string) bool { + s := os.Getenv(k) + if s == "" { + return false + } + v, _ := strconv.ParseBool(s) + return v +} |
