From 683ca2c5b7470a9840ebf6d2fd5248302b419af4 Mon Sep 17 00:00:00 2001 From: Tri Lam Date: Mon, 18 May 2026 21:36:41 -0700 Subject: [PATCH] [ci] deflake journald mock test + warn locally when shellcheck missing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two small fixes for the lessons that surfaced during this session's linter-gate work: 1. components/receivers/kernelevents/journald_test.go: TestJournaldSource_StreamsMockOutput's 2s deadline was tight on loaded macOS / CI runners — subprocess spawn + fixture read + goroutine schedule could miss it. Flaked on 5 of 5 PRs that exercised the full suite (#55, #60, #62, #63, #64). Bumped to 5s. The non-flake budget for "no record ever emitted" regressions stays well under the deadline; 5s just absorbs runner jitter. 2. Makefile actionlint target: actionlint silently skips run-block shellcheck when shellcheck isn't on PATH (macOS doesn't ship it by default). PR #62 passed `make actionlint` locally and then failed CI on 4 shellcheck findings. Added a presence check that prints brew/apt install hints; the underlying lint still runs. Verification: `make ci` exit 0 (no flake this run). Co-Authored-By: Claude Opus 4.7 (1M context) Signed-off-by: Tri Lam --- Makefile | 5 +++++ components/receivers/kernelevents/journald_test.go | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index cab961f5..c6a548b7 100644 --- a/Makefile +++ b/Makefile @@ -197,6 +197,11 @@ register-lint: ## Verify `func Register*` symbols live only under components/** @scripts/register-lint.sh actionlint: ## Lint GitHub Actions workflow files (syntax + embedded shellcheck for run: blocks). + @if ! command -v shellcheck >/dev/null 2>&1; then \ + echo "WARNING: shellcheck not on PATH; actionlint will skip run-block shellcheck."; \ + echo " macOS: brew install shellcheck"; \ + echo " Linux: apt-get install shellcheck"; \ + fi go tool actionlint no-autoupdate-check: ## Enforce RFC-0008: cmd/, components/, internal/, pkg/ contain no in-binary auto-update mechanism. Also runs the gate's own regression test against fixtures. diff --git a/components/receivers/kernelevents/journald_test.go b/components/receivers/kernelevents/journald_test.go index a84d4fd8..b3604e58 100644 --- a/components/receivers/kernelevents/journald_test.go +++ b/components/receivers/kernelevents/journald_test.go @@ -36,8 +36,8 @@ func TestJournaldSource_StreamsMockOutput(t *testing.T) { case rec := <-out: require.Equal(t, 3, rec.priority, "Xid is err-level") require.Contains(t, rec.body, "Xid (PCI:0000:65:00.0): 79") - case <-time.After(2 * time.Second): - t.Fatal("no record from mock journalctl within 2s") + case <-time.After(5 * time.Second): + t.Fatal("no record from mock journalctl within 5s") } }