This test was failing on Alpine's CI which had 'git' but wasn't in a git repo: 036b6a1262 (commitcomment-180001647) Updates #12614 Change-Id: Ic1b8856aaf020788a2a57e48738851e13ea85a93 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
036b6a1262 (commitcomment-180001647)
@ -5,9 +5,7 @@ package featuretags
import (
"maps"
"os"
"os/exec"
"path/filepath"
"regexp"
"slices"
"strings"
@ -91,19 +89,18 @@ func TestRequiredBy(t *testing.T) {
// Verify that all "ts_omit_foo" build tags are declared in featuretags.go
func TestAllOmitBuildTagsDeclared(t *testing.T) {
dir, err := os.Getwd()
if _, err := exec.LookPath("git"); err != nil {
t.Skipf("git not found in PATH; skipping test")
}
root, err := exec.Command("git", "rev-parse", "--show-toplevel").Output()
if err != nil {
t.Fatal(err)
t.Skipf("not in a git repository; skipping test")
root := filepath.Join(dir, "..", "..")
cmd := exec.Command("git", "grep", "ts_omit_")
cmd.Dir = root
cmd.Dir = strings.TrimSpace(string(root))
out, err := cmd.CombinedOutput()
t.Fatalf("git grep failed: %v\nOutput:\n%s", err, out)
rx := regexp.MustCompile(`\bts_omit_[\w_]+\b`)