Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opa test --bench fails with "eval_cancel_error: caller cancelled query execution" #3107

Closed
anderseknert opened this issue Jan 29, 2021 · 1 comment · Fixed by #3425
Closed
Assignees

Comments

@anderseknert
Copy link
Member

Expected Behavior

opa test --bench testing.rego to report the result of benchmarking a simple policy.

Actual Behavior

$ opa test --bench testing.rego
data.testing.test_allow_is_true: ERROR (5.000137933s)
  eval_cancel_error: caller cancelled query execution
--------------------------------------------------------------------------------
ERROR: 1/1

Steps to Reproduce the Problem

testing.rego

package testing

allow {
	true
}

test_allow_is_true {
	allow
}
$ opa test --bench testing.rego

Additional Info

Setting the --timeout flag to 30s provides the benchmark result. Two things stand out to me here:

  1. If no explicit --timeout is provided, I believe the default should be to run until finished.
  2. If a --timeout is provided and exceeded, a human readable message should be printed.
@tsandall
Copy link
Member

I think we can fix this easily by making the timeout default dynamic. If --bench is not specified, the 5s timeout is fine (that's more than enough time a query to return). If --bench is specified, we can just crank the timeout to 30s as that would give the Go benchmark runner enough time to find a stable measurement.

srenatus added a commit to srenatus/opa that referenced this issue Apr 30, 2021
Fixes open-policy-agent#3107.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
@srenatus srenatus self-assigned this Apr 30, 2021
srenatus added a commit that referenced this issue Apr 30, 2021
Fixes #3107.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants