Repository navigation
test: run verbosely through gotestsum and list skipped tests in the job summary - #1124
Open
Philip Lombardi (plombardi89) wants to merge 3 commits into
Open
Philip Lombardi (plombardi89) wants to merge 3 commits into
Philip Lombardi (plombardi89) wants to merge 3 commits into
Conversation
…ob summary CI ran go test without -v, so a skipped test never appeared in its log. A test that skipped on every run, because a variable was never set or a tool was never installed, was invisible. make test now runs through gotestsum (a go.mod tool, like govulncheck). Its output matches go test -v, and it ends with every skipped and failed test and its reason. GOTEST also passes -v for the other test targets. gotestsum also writes the run as JSON to tmp/go-test.json, and the new hack/cmd/test-summary turns that into the CI job summary: the counts, a table of skipped tests with their reasons, and the failures. It reports and never judges, so it exits non-zero only when the report is unreadable or empty.
- TestWriteInventoryAsMachina was skipped with no reason since it was added. It is a pure function test and passes, so it runs again. - TestLinkManager_Integration had no body beyond its skips. Removed. - TestResourceMergeRejectsMismatchedSchema exists to flag an OpenTelemetry SDK change, but skipped when the change happened. It now fails instead. - TestOverridesValidateShippedExample skipped when the shipped example was missing. The file is tracked, so a missing file means it moved; fail.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
CI ran
go testwithout-v, so a skipped test never appeared in its log. A test that skips on every run, because a variable is never set or a tool is never installed, was invisible: it passed review and CI indefinitely. A scan found several, listed below.What changes
Tests run verbosely, and skips are listed
make testnow runs through gotestsum v1.13.0, pinned as ago.modtool like govulncheck (go tool gotestsum).go test -v, and it ends with every skipped and failed test and its reason:GOTESTalso passes-v, so the other test targets are verbose too.go test's status, so the change can't hide a failure.Skipped tests in the CI job summary
tmp/go-test.json.hack/cmd/test-summary, turns that into the Test job's summary: the counts, a table of skipped tests with their reasons, and the failures, including packages that failed outside any test (a build error or aTestMain).New dependencies:
go.modgains gotestsum and three small modules it needs (gotestdox, dnephin/pflag, google/shlex), all// indirect. No existing version moves, andgo mod tidyis stable. NOTICE collects only direct requirements, so it doesn't change.Tests that should run or fail
TestWriteInventoryAsMachina: skipped with no reason since it was added. It's a pure function test and it passes, so it runs again.TestLinkManager_Integration: deleted. Its body was only the two skips.TestResourceMergeRejectsMismatchedSchema: exists to flag an OpenTelemetry SDK change, but skipped when that change happened. It now fails instead.TestOverridesValidateShippedExample: skipped if the shipped example was missing. The file is tracked, so a missing file means it moved, and the test now fails.What the list shows today
From a full local run (46 skips). CI skips 41: it has the frontend build, and its host has no leftover node artifacts.
make test:TestEnvtestMachineAllocation{RefPolicy,BootstrapTokenPolicy}(deploy/machine-ops) andTestEnvtest{Allocation,Capacity}MinimalMain(pkg/machineops/controller) run in no CI job.racer-envtestjob runs them.TestMediaRealToolsOptional(metalman ISO packaging): no CI job installs its tools.Making the envtest and ISO tests run in CI is not in this PR.
Checked and left alone
The scan also covered the 28 places where a test does
if err != nil { return }. None hides a failure:Testing
CI=1 make testpasses through the new path: 15,955 tests, 46 skipped. Runningtest-summaryon that report gives the same counts.hack/cmd/test-summarytests use a realgo test -jsonskip as captured. They cover:OutputType;make fmtandmake lintare clean.go mod tidymakes no change.Notes
make testoutput is now verbose too, as asked. The skip and failure summary is the last thing printed.