-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
topdown: fix re-wrapping of ndb_cache errors (#5543)
Errors happening in the "cache hit" code path for NDBCache calls would come from the iterators called with the function call results retrieved from the cache. Now, these errors include the sentinel "early exit" errors, which would ordinarily be suppressed further up the call stack. However, since the iter()-returned errors had been wrapped into topdown.Halt{}, they were not picked up by the suppression mechanisms. Now, those iter-derived errors are no longer wrapped into Halt, and the code section that suggests that they should be has gotten a new comment explaining what's going on there. To improve our blinds spots in testing, the Rego Yaml tests are now also run with NDBCache enabled. No further assertions are added, those are tested elsewhere, but it would have caught this problem. Hence it seems worthwhile to spend the extra 3s in tests. Signed-off-by: Stephan Renatus <stephan@styra.com>
- Loading branch information
Showing
3 changed files
with
49 additions
and
18 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
test/cases/testdata/withkeyword/test-with-and-ndbcache-issue.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
cases: | ||
- modules: | ||
- | | ||
package rules | ||
p { | ||
time.now_ns(now) | ||
} | ||
q { p with data.x as 7 } | ||
note: "with: ndb_cache-issue" | ||
query: data.rules = x | ||
want_result: | ||
- x: | ||
p: true | ||
q: true |
This file contains 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
This file contains 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