test(azure_policy): add foundation test cases#698
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a set of YAML scenario files under tests/azure_policy/cases/ to serve as “foundation” test vectors for the Azure Policy compiler/evaluator (to be exercised by the companion test-runner PR). The cases cover conditions/operators, expression/template-function evaluation, count semantics, effects/details, policy-definition envelope parsing, and various edge/corner cases (casing, coercion, deep nesting, parse errors).
Changes:
- Add YAML test suites for core condition/evaluation semantics (operators, logical combinators,
valueLHS, exists, implicitallOfon[*], type coercion). - Add YAML test suites for ARM template-expression/function support (core functions + extra string/collection/numeric + datetime/IP).
- Add YAML test suites for policy-rule/effect compilation (effects, effect details, modify alias-modifiability checks, policy definition envelope parsing, parse error scenarios, complex policies).
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/azure_policy/cases/value_conditions.yaml | Scenarios for value-LHS conditions (literals, expressions, arrays, combinators). |
| tests/azure_policy/cases/type_coercion.yaml | Scenarios for string↔number/bool coercion, null/undefined, and Unicode comparisons. |
| tests/azure_policy/cases/template_functions_extra.yaml | Additional ARM template function coverage (string/collection/numeric). |
| tests/azure_policy/cases/template_functions_datetime_ip.yaml | Datetime functions (utcNow, epoch conversion, addDays) + ipRangeContains. |
| tests/azure_policy/cases/template_functions.yaml | Baseline ARM template function coverage (split, empty, first/last, int/string/bool, etc.). |
| tests/azure_policy/cases/policy_definition.yaml | Scenarios for parsing/evaluating full policy definition envelopes (wrapped/unwrapped). |
| tests/azure_policy/cases/parse_errors.yaml | Negative parsing scenarios for malformed policy JSON / invalid constructs. |
| tests/azure_policy/cases/operators.yaml | Coverage for Azure Policy condition operators with field-based conditions. |
| tests/azure_policy/cases/modifiable_check.yaml | Modify-effect alias “Modifiable” validation scenarios (using an aliases file). |
| tests/azure_policy/cases/logical_combinators.yaml | Scenarios for allOf/anyOf/not and nested combinations. |
| tests/azure_policy/cases/implicit_allof.yaml | Scenarios for implicit “all elements must match” semantics for field[*] outside count. |
| tests/azure_policy/cases/fields.yaml | Scenarios for built-in fields + tag access syntaxes and nested field paths. |
| tests/azure_policy/cases/field_wildcard_collect.yaml | Scenarios for field('path[*]') collection returning arrays (including missing-array handling). |
| tests/azure_policy/cases/expressions.yaml | Scenarios for ARM template expressions across field/value/effect positions and contexts. |
| tests/azure_policy/cases/exists.yaml | Comprehensive exists operator scenarios (nulls, missing, objects/arrays, deep paths). |
| tests/azure_policy/cases/effects.yaml | Scenarios for effect kinds (simple and cross-resource), parameterized effects, casing. |
| tests/azure_policy/cases/effect_details.yaml | Scenarios validating structured effect-result details shapes and expression evaluation within details. |
| tests/azure_policy/cases/deep_nesting.yaml | Stress/edge scenarios for deep nesting, nested expressions, nested counts, missing-field operator behavior. |
| tests/azure_policy/cases/complex_policies.yaml | Higher-level realistic policy scenarios combining multiple features end-to-end. |
| tests/azure_policy/cases/casing.yaml | Extensive case-insensitivity and casing semantics scenarios (ARM key casing vs policy value folding). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c40112c to
0db0331
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 24 out of 24 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 24 out of 24 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
0db0331 to
4c260e2
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 24 out of 24 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 24 out of 24 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4c260e2 to
293f406
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 24 out of 24 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
YAML-driven test cases for the core Azure Policy compiler. These cover alias resolution, field conditions, logical operators, type coercion, count expressions, template functions, effect compilation, and policy definition parsing. 24 files, each a self-contained scenario exercised by the test runner in the companion code PR. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
293f406 to
4a31962
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 24 out of 24 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
YAML-driven test cases for the core Azure Policy compiler. These cover alias resolution, field conditions, logical operators, type coercion, count expressions, template functions, effect compilation, and policy definition parsing.
24 files, each a self-contained scenario exercised by the test runner in the companion code PR.
Part 1 of 3 — split from #695 to enable Copilot review on each PR individually.