Skip to content

Conversation

@charlieegan3
Copy link
Contributor

Following: #7821 I think we can avoid using the async running of exec when we know the bundle server is ready to go.

I saw some more issues from these tests in
https://github.com/open-policy-agent/opa/actions/runs/16905415883/job/47894071103?pr=7825 and am trying to make them more reliable this way.

I left the async that's needed in TestExecWithBundleRegoVersion where runExec does not complete, here we just wait for the messages and then stop, but now we shutdown the goroutine nicely.

return err == nil && resp.StatusCode == 200
})

_ = runExec(params)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I felt it was ok to just check the logged errors since we're in the cmd package. For me, it made the tests easier to follow.

@netlify
Copy link

netlify bot commented Aug 12, 2025

Deploy Preview for openpolicyagent ready!

Name Link
🔨 Latest commit 9b630a4
🔍 Latest deploy log https://app.netlify.com/projects/openpolicyagent/deploys/68af21446803c200081fc723
😎 Deploy Preview https://deploy-preview-7835--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.

Copy link
Member

@philipaconrad philipaconrad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a good cleanup to me! Sorry I didn't notice the review request sooner-- it got buried in the general notification spam. 🙃

@charlieegan3
Copy link
Contributor Author

Thanks for the review, I was mega slow to get back to this after a trip last week so I'll sort it out later.

@charlieegan3 charlieegan3 force-pushed the cmd-exec-test branch 4 times, most recently from 14bb17a to 27bad57 Compare August 27, 2025 14:52
Copy link
Contributor

@johanfylling johanfylling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

cmd/exec_test.go Outdated

// when bundles fail to parse, OPA never signals the ready channel, causing
// runExec to hang indefinitely. WithContext allows us to cancel the context
// when when we have the required errors logged.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] when hiccup.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, fixed that too!

Following: open-policy-agent#7821
I think we can avoid using the async running of exec when we know the
bundle server is ready to go.

I saw some more issues from these tests in
https://github.com/open-policy-agent/opa/actions/runs/16905415883/job/47894071103?pr=7825
and am trying to make them more reliable this way.

Signed-off-by: Charlie Egan <[email protected]>
@charlieegan3 charlieegan3 merged commit 46c9c3b into open-policy-agent:main Aug 27, 2025
31 checks passed
@charlieegan3 charlieegan3 deleted the cmd-exec-test branch August 27, 2025 15:30
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.

3 participants