From 3c800dcd71f1f8e0b2f24d175a48c2bc6576629c Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Mon, 13 Jul 2026 20:21:29 +0000 Subject: [PATCH] .github/workflows: fix natlab test discovery with fully-excluded files The Discover tests step runs under set -euo pipefail, so when every Test function in a file is filtered out by the exclude regex (as with vnetperf_test.go, whose TestVnetPerf* tests need special invocation), the final grep -vE produces no output and exits 1, failing the whole step. Tolerate empty results from both greps so such files simply contribute no matrix entries. Same for a hypothetical future test file containing only helpers and no Test functions. Updates tailscale/corp#44805 Signed-off-by: Brad Fitzpatrick Change-Id: If20c9a1de37e97b1553bd7d5559e2b876a45c19b --- .github/workflows/natlab-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/natlab-test.yml b/.github/workflows/natlab-test.yml index 60f4070a8..fa64fafc5 100644 --- a/.github/workflows/natlab-test.yml +++ b/.github/workflows/natlab-test.yml @@ -108,9 +108,9 @@ jobs: pkg="./${pkg_dir}/" for f in "${pkg_dir}"/*_test.go; do [ -e "$f" ] || continue - grep -hE '^func Test[A-Z][A-Za-z0-9_]*\(t \*testing\.T\)' "$f" \ + { grep -hE '^func Test[A-Z][A-Za-z0-9_]*\(t \*testing\.T\)' "$f" || true; } \ | sed -E 's/^func (Test[A-Za-z0-9_]+).*/\1/' \ - | grep -vE "$exclude" \ + | { grep -vE "$exclude" || true; } \ | while read -r t; do jq -nc --arg pkg "$pkg" --arg test "$t" \ '{pkg: $pkg, test: $test}' >> "$tmp"