Skip to content

fix(ci): capture and surface ginkgo errors in run-coverage.sh - #12765

Merged
mudler merged 3 commits into
masterfrom
fix/coverage-error-visibility
Oct 19, 2026
Merged

mudler merged 3 commits into
masterfrom
fix/coverage-error-visibility

Conversation

@mudler-agent

Copy link
Copy Markdown
Collaborator

What changed

scripts/run-coverage.sh ran ginkgo per test root with || fail=1, which swallowed the exit code. Combined with make --output-sync=target (which buffers all output and flushes at the end), the actual ginkgo error was invisible in interleaved CI logs. Every test suite passed but the script still exited 1, and the error was buried in 22 000 lines of buffered output.

Each ginkgo invocation now captures combined stdout+stderr to a per-root log file. On failure the last 80 lines are printed to stderr so the error is visible in the CI log. On success the log is replayed to stdout so test output remains visible.

Why

The tests workflow has been failing on every master push and every PR since commit 9ad78381d8 (Oct 16). All Ginkgo suites report SUCCESS! -- 0 Failed, but go run ginkgo for one root exits with code 1 and the error is completely invisible. This PR makes the error visible so the root cause can be diagnosed and fixed.

How to verify

  1. The tests CI job on this PR will either pass (if the error was environmental) or show the actual ginkgo error in the log.
  2. Locally: GINKGO_TAGS="debug auth" COVERAGE_COVERPKG="github.com/mudler/LocalAI/pkg/..." scripts/run-coverage.sh /tmp/cov /tmp/cov/merged.out 1 ./pkg/model — should run ginkgo, show test output, and merge coverprofiles.
  3. On failure: the last 80 lines of ginkgo output are printed to stderr with a run-coverage: ginkgo failed for <root> (exit N) header.

The coverage script ran ginkgo per test root with `|| fail=1`, which
swallowed the exit code. Combined with `make --output-sync=target`,
which buffers all output and flushes at the end, the actual ginkgo
error was invisible in interleaved CI logs. Every test suite passed
but the script still exited 1, and the error message was buried in
22 000 lines of buffered output.

Each ginkgo invocation now captures combined stdout+stderr to a
per-root log file. On failure the last 80 lines are printed to
stderr so the error is visible in the CI log. On success the log is
replayed to stdout so test output remains visible.

The build flags (--tags, --coverpkg) are quoted correctly so values
containing spaces (e.g. --tags="debug auth") are preserved through
eval.

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
@mudler
mudler force-pushed the fix/coverage-error-visibility branch from 7098d02 to d6fd45a Compare October 18, 2026 23:43
The previous commit added per-root log files but forgot to create
the output directory before the first ginkgo invocation. On CI the
coverage/ dir did not exist yet, so the shell redirect to
cover-pkg.out.log failed with "No such file or directory" before
ginkgo even ran.

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Commit 9ad7838 added GET /api/canvas/preview/:id as a public route
(no auth — the random id is the capability, an iframe cannot send API
key headers) but did not add it to expectedPublicRoutes in the route
auth coverage test. The test flagged the route as an anonymous-access
leak, failing the entire ./core ginkgo suite on every CI run since.

The POST /api/canvas/preview endpoint is auth-gated (returns 401 to
anonymous requests) and is intentionally absent from the allowlist.

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
@mudler
mudler merged commit 48f358d into master Oct 19, 2026
72 checks passed
@mudler
mudler deleted the fix/coverage-error-visibility branch October 19, 2026 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants