-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix when resource test returns '_inDesiredState', that takes precedence #676
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR fixes the issue where a resource’s _inDesiredState property is ignored in the test process and addresses a resource string placeholder replacement.
- Introduces a new InDesiredState struct in dsctest to clearly encapsulate the in‐desired‐state information.
- Adjusts command_resource.rs to prioritize the _inDesiredState value over synthetic diff comparison.
- Adds a new subcommand and CLI support for the in-desired-state test along with a corresponding JSON schema and localized message updates.
Reviewed Changes
File | Description |
---|---|
tools/dsctest/src/in_desired_state.rs | Added InDesiredState struct to hold resource state and a supporting field. |
dsc_lib/src/dscresources/command_resource.rs | Updated invoke_test to consider _inDesiredState for determining desired state. |
tools/dsctest/src/main.rs | Introduced InDesiredState subcommand and handling of its JSON input. |
tools/dsctest/src/args.rs | Extended CLI argument parsing for the new in-desired-state subcommand. |
dsc_lib/locales/en-us.toml | Fixed string placeholder for the executable in error messages. |
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
tools/dsctest/src/in_desired_state.rs:12
- [nitpick] The field name 'value' is ambiguous; consider renaming it to better reflect its purpose, such as 'state_description' or another descriptive term.
pub value: String,
3a89a0c
to
74f4b69
Compare
Was thinking about this and originally I figured that if a resource returned |
@tgauth please continue the review |
PR Summary
Even when a resource implement
test
returnsstate
and contains_inDesiredState
property, that value isn't being used and a synthetic comparison still occurs.With this change, whether a resource returns
state
orstateAndDiff
and contains_inDesiredState
, then that value will be used regardless if there are any differing properties. Diff of properties will still occur for information purposes even if_inDesiredState = true
Also fixed a resource string issue where the placeholder wasn't being replaced correctly.
PR Context
Fix #674