From 72f736134d741b5825b8952a1e33f37a79e4acfb Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 28 Jan 2026 08:41:38 -0800 Subject: [PATCH] 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 --- cmd/testwrapper/flakytest/flakytest.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 +}