Documentation
¶
Overview ¶
Package e2egate parses `go test -json` event streams and decides whether the run satisfies the e2e execution gate: at least one test must have actually executed (passed or failed), and no package may declare tests yet have all of them skipped — that pattern indicates require.Docker / PG / RMQ gates were not opened, producing a misleading green CI.
The parser is invoked from the command line as a stdin pipe consumer:
go test -tags=e2e -json ./tests/e2e/... | tee /tmp/e2e.json | e2egate
On gate failure, exit code 1 with reasons on stderr. On success, exit 0 with empty stdout/stderr. The pipeline-friendly tee preserves the raw event stream for log archival.
ref: cmd/internal/test2json — event schema (Action, Package, Test, Output, Elapsed)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PackageStat ¶
type PackageStat struct {
// Executed counts pass + fail tests.
Executed int
// Skipped counts skipped tests.
Skipped int
// BuildFailed is true when the package emitted a build failure (no
// test events; package-level "fail" action with build-failed output).
BuildFailed bool
// Action is the package-level terminal action ("pass", "fail", "skip").
Action string
}
PackageStat tracks per-package test counters and the terminal action emitted for the package event (Test == "").
type Result ¶
type Result struct {
// TotalExecuted is the count of test-level events that terminated with
// pass or fail (i.e., the test actually ran a body).
TotalExecuted int
// TotalSkipped is the count of test-level events that terminated with
// skip (including conditional t.Skip).
TotalSkipped int
// Packages keyed by import path; each tracks per-package counters.
Packages map[string]*PackageStat
// Reasons holds gate-failure messages (one per triggered rule); empty
// when the gate passes.
Reasons []string
}
Result is the aggregated outcome of a `go test -json` run.