[confcom] Add more thorough tests for --with-containers#9428
Merged
kairu-ms merged 12 commits intoAzure:mainfrom Nov 20, 2025
Merged
[confcom] Add more thorough tests for --with-containers#9428kairu-ms merged 12 commits intoAzure:mainfrom
--with-containers#9428kairu-ms merged 12 commits intoAzure:mainfrom
Conversation
️✔️Azure CLI Extensions Breaking Change Test
|
Collaborator
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances test coverage for the --with-containers flag by adding comprehensive tests for all samples and refactoring the policy model to use Pydantic dataclasses with explicit ordering semantics.
Key changes:
- Migrated policy data model from standard Python dataclasses to Pydantic dataclasses with custom ordering support
- Added container definition (
.rego) files for each sample directory to support--with-containerstesting - Implemented OPA (Open Policy Agent) integration for policy deserialization and comparison
- Added parameterized test that validates policy generation from container definitions for all samples
Reviewed Changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
setup.py |
Version bump to 1.4.2, added pydantic dependency, and OPA binary download during installation |
HISTORY.rst |
Added release notes for version 1.4.2 describing pydantic migration |
samples/aci/*/container*.rego |
Added 20+ container definition files as test inputs for --with-containers testing |
azext_confcom/lib/policy.py |
Migrated from dataclasses to Pydantic with OrderlessField for collections where order is semantically irrelevant |
azext_confcom/lib/orderless_dataclasses.py |
New custom Pydantic dataclass wrapper that sorts orderless fields for serialization and comparison |
azext_confcom/lib/opa.py |
New OPA binary downloader and executor for policy evaluation |
azext_confcom/lib/binaries.py |
New utility for managing binary directory location |
azext_confcom/lib/serialization.py |
New policy serialization/deserialization utilities using OPA |
azext_confcom/security_policy.py |
Updated to use Pydantic's TypeAdapter for container serialization |
azext_confcom/tests/latest/test_confcom_acipolicygen_arm.py |
Added comprehensive parameterized test and renamed existing test for clarity |
13 tasks
This was referenced Nov 18, 2025
6 tasks
kairu-ms
approved these changes
Nov 20, 2025
5 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The existing tests for
--with-containersare okay but don't tests the full range of inputs we have insamples/.How
--with-containersto getpolicy.rego--with-containersto producepolicy.regoThis checklist is used to make sure that common guidelines for a pull request are followed.
Related command
General Guidelines
azdev style <YOUR_EXT>locally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally? (pip install wheel==0.30.0required)