Skip to content

Conversation

@matt-FFFFFF
Copy link
Member

This PR replaces #225 to enable CI/CD checks with required secrets.

Original PR by @kewalaka


This pull request improves error handling and test coverage for the addPolicyAndRoleAssets method in alzlib.go, ensuring that duplicate policy and policy set definition versions are handled correctly. The changes refactor how errors are accumulated and reported, and add targeted unit tests for duplicate version scenarios.

Error handling improvements:

  • Refactored error accumulation in addPolicyAndRoleAssets to use multierror.Append for both policy definitions and policy set definitions, ensuring errors are wrapped with descriptive context and reported correctly.

Testing enhancements:

  • Added the TestAddPolicyAndRoleAssetsAllowsDuplicateVersions unit test to verify that adding duplicate versions of policy and policy set definitions works as expected, both when overwriting is allowed and disallowed.
  • Introduced helper functions testPolicyDefinition and testPolicySetDefinition to simplify test setup for policy assets.

fixes: Azure/terraform-provider-alz#188
& Azure/terraform-provider-alz#189

@codecov-commenter
Copy link

codecov-commenter commented Nov 20, 2025

Codecov Report

❌ Patch coverage is 20.00000% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.98%. Comparing base (95f707a) to head (bba7879).

Files with missing lines Patch % Lines
alzlib.go 20.00% 4 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #226      +/-   ##
==========================================
+ Coverage   49.37%   49.98%   +0.61%     
==========================================
  Files          49       49              
  Lines        4794     3929     -865     
==========================================
- Hits         2367     1964     -403     
+ Misses       2164     1702     -462     
  Partials      263      263              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@jaredfholgate jaredfholgate left a comment

Choose a reason for hiding this comment

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

LGTM

@matt-FFFFFF matt-FFFFFF added this pull request to the merge queue Nov 20, 2025
Merged via the queue into main with commit 6dcea25 Nov 20, 2025
8 checks passed
@matt-FFFFFF matt-FFFFFF deleted the fork-pr-225-main branch November 20, 2025 11:50
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.

[Bug] Bump from 0.19 to 0.20 causes format error

5 participants