Conversation
klihub
added this pull request to stack #796
September 16, 2026 11:44
Add a coverage package which serves the coverage data of a plugin built with go build -cover over the instrumentation HTTP server: the meta-data, a snapshot of the counters, and the ID of the binary tying the two together. The ID is the one the go runtime names the files it writes to $GOCOVERDIR with, dug out of the meta-data header, so that data served over HTTP and data dumped at exit merge as they are. This is how we get the coverage of a plugin which is still running, or which never gets to exit gracefully. Serve it from the resource manager, so from the nri-resource-policy-* plugins, and only with the test APIs enabled. runtime/coverage works in a binary built with -cover and never in a test binary, so the tests build a helper to check that what we serve is what go tool covdata expects. Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
COVER=1 builds the resource-manager-based plugins with coverage instrumentation. Instrument our own packages only, and with atomic counters: the plugins are concurrent, and clearing the counters at runtime does not work without them. Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
Collect the coverage data of the plugins the tests exercise, and report the coverage of each plugin and the total at the end of a run. The tests clear the counters when they launch a plugin and ask it for a dump once done. make e2e-tests builds the plugins with COVER=1 so that a run has something to collect; collecting never fails a test. go tool covdata percent cannot report per plugin, and prints a package which has no statements without a percentage and without a line break, running the next package into it, so calculate the numbers from the profile instead, weighted by statements the way go tool cover does. Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
klihub
force-pushed
the
e2e-coverage
branch
from
September 16, 2026 13:22
5db1949 to
61bba6f
Compare
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.
Make test/e2e/run_tests.sh collect go coverage data of the plugins the tests
exercise, and report per-plugin and total coverage at the end of a run.
make e2e-testsbuilds the resource-manager-based plugins withgo build -cover(make COVER=1 build images).instrumentation HTTP server, so a plugin which never exits gracefully is
covered too. What is served and what a plugin dumps at exit merge as they are.
HTML report and summary.json.
reset_coverage=1discards earlier data first.Verified on a full run of both suites: 55/55 PASS, balloons 78.6%,
topology-aware 68.0%, 59% of all instrumented packages.
Port forwarding to the plugin needs the vm-wait-pod-regexp fix from the PR below.