forked from open-telemetry/semantic-conventions
-
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.
Add tests for rego policies (open-telemetry#1334)
Co-authored-by: Aaron Clawson <[email protected]> Co-authored-by: Liudmila Molkova <[email protected]>
- Loading branch information
1 parent
e31ed0f
commit b3902e2
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package before_resolution_test | ||
|
||
import data.before_resolution | ||
|
||
import future.keywords.if | ||
|
||
test_registry_attribute_groups if { | ||
count(before_resolution.deny) > 0 with input as {"groups": [{"id": "registry.test", "type": "foo"}]} | ||
count(before_resolution.deny) == 0 with input as {"groups": [{"id": "registry.test", "type": "attribute_group"}]} | ||
} | ||
|
||
test_attribute_ids if { | ||
# This requires a prefix for use with opa, but weaver will fill in. | ||
count(before_resolution.deny) > 0 with input as {"groups": [{"id": "not_registry", "prefix": "", "attributes": [{"id": "foo"}]}]} | ||
count(before_resolution.deny) == 0 with input as {"groups": [ | ||
{"id": "registry.test", "prefix": "", "attributes": [{"id": "foo"}]}, | ||
{"id": "not_registry", "prefix": "", "attributes": [{"ref": "foo"}]}, | ||
]} | ||
} | ||
|
||
test_attribute_refs if { | ||
count(before_resolution.deny) > 0 with input as {"groups": [{"id": "registry.foo", "attributes": [{"ref": "foo"}]}]} | ||
count(before_resolution.deny) == 0 with input as {"groups": [{"id": "not_registry", "attributes": [{"ref": "foo"}]}]} | ||
} |