Skip to content

test(azure_policy): add foundation test cases#698

Merged
anakrish merged 1 commit intomicrosoft:mainfrom
anakrish:azure-policy-compiler-pr-5a
Apr 28, 2026
Merged

test(azure_policy): add foundation test cases#698
anakrish merged 1 commit intomicrosoft:mainfrom
anakrish:azure-policy-compiler-pr-5a

Conversation

@anakrish
Copy link
Copy Markdown
Collaborator

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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, value LHS, exists, implicit allOf on [*], 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.

Comment thread tests/azure_policy/cases/value_conditions.yaml Outdated
Comment thread tests/azure_policy/cases/type_coercion.yaml Outdated
Comment thread tests/azure_policy/cases/type_coercion.yaml Outdated
Comment thread tests/azure_policy/cases/implicit_allof.yaml Outdated
Comment thread tests/azure_policy/cases/parse_errors.yaml
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@anakrish anakrish requested a review from Copilot April 27, 2026 21:36
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tests/azure_policy/cases/parse_errors.yaml
Comment thread tests/azure_policy/cases/template_functions_extra.yaml Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tests/azure_policy/cases/fields.yaml
Comment thread tests/azure_policy/cases/template_functions_extra.yaml Outdated
Comment thread tests/azure_policy/cases/implicit_allof.yaml Outdated
Comment thread tests/azure_policy/cases/field_wildcard_collect.yaml Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tests/azure_policy/cases/template_functions_extra.yaml
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tests/azure_policy/cases/field_wildcard_collect.yaml Outdated
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>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@anakrish anakrish merged commit 7f42115 into microsoft:main Apr 28, 2026
63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants