You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
authored
Use JSON Schema defaults in synthetic test get_diff (#1670)
* Use JSON Schema defaults in synthetic test get_diff
Update get_diff() to accept an optional JSON Schema parameter via the new
get_diff_with_schema() function. When a property exists in the expected
(desired) state but is missing from the actual state, the function now
checks the schema for a 'default' value for that property. If the expected
value matches the schema default, it is not reported as differing.
This improves synthetic test accuracy for resources that don't return
properties whose values match the schema-defined defaults.
- Add get_diff_with_schema() with optional schema parameter
- Keep get_diff() as a convenience wrapper (no schema)
- Update invoke_synthetic_test to retrieve and pass the resource schema
- Update DscResource synthetic test path for adapted resources
- Add get_schema_default() helper to extract defaults from JSON Schema
- Add Test/SchemaDefault test resource and dsctest subcommand
- Add Rust unit tests for schema default comparison logic
- Add Pester integration tests for end-to-end validation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Address PR feedback: restrict visibility and avoid redundant serialization
- Change get_diff_with_schema from pub to pub(crate) since it is only
used within the dsc-lib crate
- Read schema from RESOURCE_SCHEMAS cache directly (returns Value) instead
of round-tripping through get_schema -> String -> from_str. Only calls
get_schema to populate the cache on a miss.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Add FirewallRuleList Pester tests for schema default fix (#1666)
Add tests verifying that unspecifiedRulesAction set to the schema default
value 'ignore' is no longer reported as drift in synthetic test. Non-default
values ('disable', 'remove') are still correctly flagged.
Tests require elevation to create/remove firewall rules and are skipped
when not running as Administrator.
Fixes#1666
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Fix CI: skip firewall schema default tests when NetSecurity module unavailable
Move -Skip to Describe block and check for Get-NetFirewallRule cmdlet
availability in BeforeDiscovery. This prevents BeforeAll/AfterAll from
running on CI runners without the NetSecurity module.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Apply suggestions from code review
Co-authored-by: Mikey Lombardi (He/Him) <michael.t.lombardi@gmail.com>
---------
Co-authored-by: Steve Lee (POWERSHELL HE/HIM) (from Dev Box) <slee@ntdev.microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Mikey Lombardi (He/Him) <michael.t.lombardi@gmail.com>
0 commit comments