mirror of
https://github.com/tailscale/tailscale.git
synced 2026-03-26 10:11:05 -04:00
feature/featuretags: skip TestAllOmitBuildTagsDeclared when not in a git repo
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>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
0d8d3831b9
commit
ac19bd5e7a
@@ -5,9 +5,7 @@
|
||||
|
||||
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 != nil {
|
||||
t.Fatal(err)
|
||||
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.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()
|
||||
if err != nil {
|
||||
if _, err := exec.LookPath("git"); err != nil {
|
||||
t.Skipf("git not found in PATH; skipping test")
|
||||
}
|
||||
t.Fatalf("git grep failed: %v\nOutput:\n%s", err, out)
|
||||
}
|
||||
rx := regexp.MustCompile(`\bts_omit_[\w_]+\b`)
|
||||
|
||||
Reference in New Issue
Block a user