forked from open-policy-agent/opa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
builtins/graph.reachable_path: fix subpath issue (open-policy-agent#5231
) Fixes open-policy-agent#4666. Signed-off-by: fred.allen@workiva.com <fred.allen@workiva.com>
- Loading branch information
1 parent
9677a09
commit b41fc6b
Showing
2 changed files
with
148 additions
and
11 deletions.
There are no files selected for viewing
128 changes: 128 additions & 0 deletions
128
test/cases/testdata/reachable/test-reachable-paths-1022.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,128 @@ | ||
cases: | ||
- data: {} | ||
input_term: '{ | ||
"graph": { | ||
"one": ["two","five"], | ||
"two": ["four"], | ||
"three": [""], | ||
"four": ["three"], | ||
"five": ["seven","six"], | ||
"six": ["nine"], | ||
"seven": ["eight"], | ||
"eight": [""], | ||
"nine": [""], | ||
}, | ||
"initial": {"one"} | ||
}' | ||
modules: | ||
- | | ||
package reachable | ||
p = result { | ||
graph.reachable_paths(input.graph, input.initial, result) | ||
} | ||
note: reachable_paths/cycle_1022_1 | ||
query: data.reachable.p = x | ||
want_result: | ||
- x: | ||
- - one | ||
- five | ||
- seven | ||
- eight | ||
|
||
- - one | ||
- five | ||
- six | ||
- nine | ||
|
||
- - one | ||
- two | ||
- four | ||
- three | ||
|
||
- data: {} | ||
input_term: '{ | ||
"graph": { | ||
"one": {"two","five"}, | ||
"two": {"four"}, | ||
"three": {""}, | ||
"four": {"three"}, | ||
"five": {"seven","six"}, | ||
"six": {"nine"}, | ||
"seven": {"eight"}, | ||
"eight": {""}, | ||
"nine": {""}, | ||
}, | ||
"initial": {"one"} | ||
}' | ||
modules: | ||
- | | ||
package reachable | ||
p = result { | ||
graph.reachable_paths(input.graph, input.initial, result) | ||
} | ||
note: reachable_paths/cycle_1022_2 | ||
query: data.reachable.p = x | ||
want_result: | ||
- x: | ||
- - one | ||
- five | ||
- seven | ||
- eight | ||
|
||
- - one | ||
- five | ||
- six | ||
- nine | ||
|
||
- - one | ||
- two | ||
- four | ||
- three | ||
|
||
- data: {} | ||
input_term: '{ | ||
"graph": { | ||
"one": ["two","five"], | ||
"two": ["four"], | ||
"three": [""], | ||
"four": ["three"], | ||
"five": ["seven","six"], | ||
"six": ["nine","seven"], | ||
"seven": ["eight"], | ||
"eight": ["three"], | ||
"nine": [""], | ||
}, | ||
"initial": {"one"} | ||
}' | ||
modules: | ||
- | | ||
package reachable | ||
p = result { | ||
graph.reachable_paths(input.graph, input.initial, result) | ||
} | ||
note: reachable_paths/cycle_1022_3 | ||
query: data.reachable.p = x | ||
want_result: | ||
- x: | ||
- - one | ||
- five | ||
- seven | ||
- eight | ||
- three | ||
|
||
- - one | ||
- five | ||
- six | ||
|
||
- - one | ||
- five | ||
- six | ||
- nine | ||
|
||
- - one | ||
- two | ||
- four | ||
- three |
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