From 32fd42430b1d18b67deb7320637dacf909352ac4 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Fri, 18 Mar 2022 14:46:38 -0700 Subject: [PATCH] all: use cibuild.On Signed-off-by: Josh Bleecher Snyder --- ssh/tailssh/tailssh_test.go | 9 +++------ tstest/archtest/qemu_test.go | 4 +++- util/cibuild/cibuild.go | 4 +++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ssh/tailssh/tailssh_test.go b/ssh/tailssh/tailssh_test.go index 8666cee49..84bf5b772 100644 --- a/ssh/tailssh/tailssh_test.go +++ b/ssh/tailssh/tailssh_test.go @@ -26,6 +26,7 @@ import ( "tailscale.com/net/tsdial" "tailscale.com/tailcfg" "tailscale.com/types/logger" + "tailscale.com/util/cibuild" "tailscale.com/util/lineread" "tailscale.com/wgengine" ) @@ -245,9 +246,7 @@ func TestSSH(t *testing.T) { } t.Run("env", func(t *testing.T) { - if os.Getenv("CI") == "true" { - // CI env variable is set by GitHub. - // https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables + if cibuild.On() { t.Skip("Skipping for now; see https://github.com/tailscale/tailscale/issues/4051") } cmd := execSSH("LANG=foo env") @@ -292,9 +291,7 @@ func TestSSH(t *testing.T) { }) t.Run("stdin", func(t *testing.T) { - if os.Getenv("CI") == "true" { - // CI env variable is set by GitHub. - // https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables + if cibuild.On() { t.Skip("Skipping for now; see https://github.com/tailscale/tailscale/issues/4051") } cmd := execSSH("cat") diff --git a/tstest/archtest/qemu_test.go b/tstest/archtest/qemu_test.go index 6e3ecc0a7..bac221877 100644 --- a/tstest/archtest/qemu_test.go +++ b/tstest/archtest/qemu_test.go @@ -16,6 +16,8 @@ import ( "runtime" "strings" "testing" + + "tailscale.com/util/cibuild" ) func TestInQemu(t *testing.T) { @@ -33,7 +35,7 @@ func TestInQemu(t *testing.T) { {"mips64le", "mips64el"}, {"386", "386"}, } - inCI := os.Getenv("CI") == "true" + inCI := cibuild.On() for _, arch := range arches { arch := arch t.Run(arch.Goarch, func(t *testing.T) { diff --git a/util/cibuild/cibuild.go b/util/cibuild/cibuild.go index b2d4af20c..95b92244a 100644 --- a/util/cibuild/cibuild.go +++ b/util/cibuild/cibuild.go @@ -9,5 +9,7 @@ import "os" // On reports whether the current binary is executing on a CI system. func On() bool { - return os.Getenv("GITHUB_ACTIONS") != "" + // CI env variable is set by GitHub. + // https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables + return os.Getenv("GITHUB_ACTIONS") != "" || os.Getenv("CI") == "true" }