Skip to content

fix: populate modules from bundles for coverage reporting in bundle mode#8496

Open
sspaink wants to merge 1 commit intoopen-policy-agent:mainfrom
sspaink:fixcodecoverage
Open

fix: populate modules from bundles for coverage reporting in bundle mode#8496
sspaink wants to merge 1 commit intoopen-policy-agent:mainfrom
sspaink:fixcodecoverage

Conversation

@sspaink
Copy link
Copy Markdown
Member

@sspaink sspaink commented Apr 7, 2026

resolve: #3324

When running opa test -c -b, the coverage reporter received nil modules because cmd/test.go only populated the modules variable in the file-loading branch. This caused cover.Report() to skip the NotCovered walk, resulting in 100% coverage regardless of actual test coverage.

Extract modules from bundles via ParsedModules() when both bundle mode and coverage are enabled, so the coverage reporter can correctly identify uncovered lines.

Tested the change locally as well with the steps in the issue.

Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 7, 2026

Deploy Preview for openpolicyagent ready!

Name Link
🔨 Latest commit 3b2a2e9
🔍 Latest deploy log https://app.netlify.com/projects/openpolicyagent/deploys/69d5539821d4c40009eda110
😎 Deploy Preview https://deploy-preview-8496--openpolicyagent.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

opa test coverage does not work correctly with bundle option

1 participant