Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
5be5564
Add integration test stage for DSCv3
johlju May 2, 2025
9156e8f
Fix pipeline
johlju May 2, 2025
b54be59
Test environment scope
johlju May 2, 2025
a36a927
run stage directly
johlju May 2, 2025
ce90271
Run stage after build
johlju May 2, 2025
c4819eb
Test remembering env variable
johlju May 2, 2025
136c41f
set process env from user env
johlju May 2, 2025
edef6ba
Fix pipeline
johlju May 2, 2025
0b901fd
Output SqlServerDsc resources
johlju May 2, 2025
733b7f8
Add prereq to test
johlju May 3, 2025
703e5e9
First try running get
johlju May 3, 2025
0826c39
try another way
johlju May 3, 2025
4048ade
yet another try
johlju May 3, 2025
fd005a2
fix trace level
johlju May 3, 2025
73ac125
Fix test fails on error
johlju May 3, 2025
5949f81
change trace level
johlju May 3, 2025
95cc217
Use latest preview
johlju May 8, 2025
9cffe4b
Fix running in pwsh
johlju May 8, 2025
2aa15e1
Output json files
johlju May 8, 2025
327b5fd
fix more debug output
johlju May 8, 2025
b203f53
fix typo
johlju May 8, 2025
dd98247
Fix test
johlju May 8, 2025
2cee3b6
Fix test
johlju May 8, 2025
cfd3f4e
Update DSCv3 installation command to include prerelease versions
johlju May 23, 2025
e88148e
Enhance integration tests by ensuring temporary folder creation and i…
johlju May 23, 2025
2cc1be7
Add DebugDscEngine resource for testing and debugging purposes with c…
johlju May 23, 2025
d8ed330
Add integration tests for DebugDscEngine resource to validate configu…
johlju May 23, 2025
4a5512f
Update integration test execution order for DSCv3_DebugDscEngine
johlju May 23, 2025
2171d3b
Update integration test tags for DebugDscEngine to include PowerBI
johlju May 23, 2025
76d224c
Comment out warning message in error handling for Import-SqlDscPrefer…
johlju May 23, 2025
3d6dae0
Add verbose logging for DebugDscEngine resource integration tests
johlju May 24, 2025
2dea008
Add PowerShell version verification in BeforeAll block for integratio…
johlju May 24, 2025
782b5d4
Fix verbose logging to output complete PowerShell version in integrat…
johlju May 24, 2025
948846c
Improve verbose logging to format result output in DebugDscEngine int…
johlju May 24, 2025
d9cec62
Enhance verbose logging to include environment variables and format P…
johlju May 24, 2025
d997dc4
Improve verbose logging to format result output as JSON in DebugDscEn…
johlju May 24, 2025
acbe5c2
Enhance verbose logging to include detailed result output in DebugDsc…
johlju May 24, 2025
a071efe
Enhance verbose logging to clarify environment variable output in Deb…
johlju May 24, 2025
17ca172
Remove verbose output of environment variables in Get() method of Deb…
johlju May 24, 2025
ec74e67
Refactor Get() method to output sorted environment variables in Debug…
johlju May 24, 2025
4e7396b
debug verbose stream
johlju Jun 5, 2025
a953e4c
Remove verbose output of environment variables in Get() method of Deb…
johlju Jun 5, 2025
bd71499
debug integ test
johlju Jun 5, 2025
3aecf14
Add Integration Test stage for DSCv3 Resources - DEBUG
johlju Jun 7, 2025
378c891
Fix script extension in Reporting Services Integration Test command
johlju Jun 7, 2025
59ef77a
Refactor integration tests for DebugDscEngine: remove redundant test …
johlju Jun 7, 2025
8220f0a
Remove verbose output of environment variables in BeforeAll block of …
johlju Jun 7, 2025
aad3617
Add step to retrieve and display available DSCv3 resources in pipeline
johlju Jun 7, 2025
0d7db9c
DEBUG 1
johlju Jun 7, 2025
4fc02f4
DEBUG 2
johlju Jun 7, 2025
f892a24
DEBUG 3
johlju Jun 7, 2025
ff10725
DEBUG 4
johlju Jun 7, 2025
eabc453
DEBUG 5
johlju Jun 7, 2025
007529f
DEBUG 6
johlju Jun 7, 2025
2749f11
DEBUG 7
johlju Jun 7, 2025
4f7c9a3
DEBUG 8
johlju Jun 7, 2025
3a880d5
Refactor DSCv3 installation script to enable verbose output and resou…
johlju Jul 11, 2025
258b398
Enhance DSCv3 installation script with detailed resource listing and …
johlju Jul 11, 2025
a331093
Refactor DSCv3 integration tests to streamline result handling and en…
johlju Jul 12, 2025
8fc3e4e
Remove DEBUG stage for DSCv3 integration tests to streamline pipeline…
johlju Jul 12, 2025
61e5c18
Update integration tests to assert specific error messages for missin…
johlju Jul 12, 2025
032ef21
Refactor integration tests to improve error handling and output for D…
johlju Jul 12, 2025
5a446e5
Refactor verbose output in integration tests to remove redundant text…
johlju Jul 12, 2025
0f682b0
Enhance verbose output in integration tests to include detailed resul…
johlju Jul 12, 2025
4a3e371
Enable PSDscRunAsCredential context in integration tests and define t…
johlju Jul 12, 2025
94308a5
Add TODO comment to remove skip for PSDscRunAsCredential context when…
johlju Jul 12, 2025
1bdb4c6
Add mocked warning message for testing purposes in Get() method of De…
johlju Jul 12, 2025
f0fc658
Remove mocked warning message from Get() method in DebugDscEngine class
johlju Jul 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
"analyzersettings",
"sqlcmd",
"PBIRS",
"SSRS"
"SSRS",
"PSDSC"
],
"cSpell.ignorePaths": [
".git"
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added new instructions for GitHub Copilot that might assist when developing
command and private functions in the module. More instructions should be
added as needed to help generated code and tests.
- Add integration test in DSCv3.
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Phrase reads awkwardly; align wording with CHANGELOG style

Most entries use the plural “tests” and specify scope (“… tests for …”).
Consider re-phrasing to match:

-- Add integration test in DSCv3.
+- Add integration tests for DSCv3.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- Add integration test in DSCv3.
- Add integration test in DSCv3.
+ Add integration tests for DSCv3.
🤖 Prompt for AI Agents
In CHANGELOG.md at line 81, the phrase "Add integration test in DSCv3." reads
awkwardly and does not match the style of other entries. Change the wording to
use the plural "tests" and specify the scope, for example, rephrase it to "Add
integration tests for DSCv3" to align with the existing CHANGELOG style.


### Changed

Expand Down
93 changes: 93 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,99 @@ stages:
testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml'
testRunTitle: 'Integration RS ($(TEST_CONFIGURATION) / $(JOB_VMIMAGE))'

- stage: Integration_Test_DSCv3_Resources_PowerBIReportServer
displayName: 'Integration Test DSCv3 Resources - Power BI Report Server'
#dependsOn: Quality_Test_and_Unit_Test
dependsOn: Build
jobs:
- job: Test_Integration
displayName: 'Integration'
strategy:
matrix:
PowerBI_WIN2019:
JOB_VMIMAGE: 'windows-2019'
TEST_CONFIGURATION: 'Integration_PowerBI'
PowerBI_WIN2022:
JOB_VMIMAGE: 'windows-2022'
TEST_CONFIGURATION: 'Integration_PowerBI'
PowerBI_WIN2025:
JOB_VMIMAGE: 'windows-2025'
TEST_CONFIGURATION: 'Integration_PowerBI'
pool:
vmImage: $(JOB_VMIMAGE)
timeoutInMinutes: 0
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download Build Artifact'
inputs:
buildType: 'current'
artifactName: $(buildArtifactName)
targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)'
- task: PowerShell@2
name: configureWinRM
displayName: 'Configure WinRM'
inputs:
targetType: 'inline'
script: 'winrm quickconfig -quiet'
pwsh: false
- powershell: |
Import-Module -Name ./tests/TestHelpers/CommonTestHelper.psm1
Remove-PowerShellModuleFromCI -Name @('SqlServer', 'SQLPS')
Remove-Module -Name CommonTestHelper
name: cleanCIWorker
displayName: 'Clean CI worker'
- pwsh: |
Install-PSResource -Name 'PSDSC' -Repository 'PSGallery' -TrustRepository -Quiet -Confirm:$false
#Install-DscExe -Force -Verbose
Install-DscExe -IncludePrerelease -Force -Verbose
name: installDSCv3
displayName: 'Install DSCv3'
- pwsh: |
# Install-DscExe installs in the path $env:LOCALAPPDATA\dsc
$env:PATH += '{0}{1}' -f [System.IO.Path]::PathSeparator, (Join-Path -Path $env:LOCALAPPDATA -ChildPath 'dsc')
# Make the built module available to the current session.
./build.ps1 -Tasks noop
Get-Module -Name SqlServerDsc -ListAvailable
# Output DSCv3 version
dsc --version
# Get the list of available resources.
'Native resources:'
dsc resource list
'Resources using adapter Microsoft.Windows/WindowsPowerShell:'
dsc resource list --adapter Microsoft.Windows/WindowsPowerShell

Get-ChildItem -Path (Join-Path -Path $env:LOCALAPPDATA -ChildPath 'dsc') -Recurse -Filter '*.json'
$cacheFile = Join-Path -Path $env:LOCALAPPDATA -ChildPath 'dsc/WindowsPSAdapterCache.json'
$getConfig = Get-Content -Path $cacheFile -Raw | ConvertFrom-Json
Write-Verbose -Message "WindowsPSAdapterCache.json content:`n $($getConfig | ConvertTo-Json -Depth 10)" -Verbose
name: getDSCv3AvailableResources
displayName: 'Get DSCv3 Available Resources'
- pwsh: |
# Install-DscExe installed in the path $env:LOCALAPPDATA\dsc
$env:PATH += '{0}{1}' -f [System.IO.Path]::PathSeparator, (Join-Path -Path $env:LOCALAPPDATA -ChildPath 'dsc')
./build.ps1 -Tasks test -CodeCoverageThreshold 0 -PesterTag $(TEST_CONFIGURATION) -PesterPath @(
# Run the integration tests in a specific group order.
# Prerequisites
# TODO: Move the prerequisites tests to generic folder than Commands
'tests/Integration/Resources/DSCv3_DebugDscEngine.Integration.Tests.ps1'
'tests/Integration/Commands/Prerequisites.Integration.Tests.ps1'
# Group 1
#'tests/Integration/Resources/DSC_SqlSetup.Integration.Tests.ps1'
# Group 2
'tests/Integration/Resources/DSCv3_SqlRSSetup.Integration.Tests.ps1'
# Group 3
#'tests/Integration/Resources/DSC_SqlRS.Integration.Tests.ps1'
)
name: test
displayName: 'Run Reporting Services Integration Test'
- task: PublishTestResults@2
displayName: 'Publish Test Results'
condition: succeededOrFailed()
inputs:
testResultsFormat: 'NUnit'
testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml'
testRunTitle: 'Integration RS ($(TEST_CONFIGURATION) / $(JOB_VMIMAGE))'

- stage: Integration_Test_Resources_ReportingServices_dbatools
displayName: 'Integration Test Resources - Reporting Services (dbatools)'
dependsOn: Integration_Test_Resources_SqlServer
Expand Down
256 changes: 256 additions & 0 deletions source/Classes/020.DebugDscEngine.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,256 @@
<#
.SYNOPSIS
The `DebugDscEngine` DSC resource is used for debugging and testing
purposes to demonstrate DSC resource patterns and behaviors.
.DESCRIPTION
The `DebugDscEngine` DSC resource is used for debugging and testing
purposes to demonstrate DSC resource patterns and behaviors. This
resource does not perform any actual configuration changes but instead
outputs verbose messages to help understand the DSC resource lifecycle
and method execution flow.
The built-in parameter **PSDscRunAsCredential** can be used to run the resource
as another user.
## Requirements
* No specific requirements - this is a debug resource for testing purposes.
## Known issues
All issues are not listed here, see [here for all open issues](https://github.com/dsccommunity/SqlServerDsc/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+DebugDscEngine).
.PARAMETER KeyProperty
Specifies the key property for the resource. This is a required property
that uniquely identifies the resource instance.
.PARAMETER MandatoryProperty
Specifies a mandatory property that must be provided when using the resource.
This demonstrates how mandatory properties work in DSC resources.
.PARAMETER WriteProperty
Specifies an optional write property that can be configured by the resource.
This property can be enforced and will be compared during Test() operations.
.PARAMETER ReadProperty
Specifies a read-only property that is returned by the resource but cannot
be configured. This property is populated during Get() operations to show
the current state.
.NOTES
This resource is designed for debugging and testing purposes only.
It demonstrates the proper patterns for creating DSC class-based resources
following the SqlServerDsc module conventions.
.EXAMPLE
Configuration Example
{
Import-DscResource -ModuleName SqlServerDsc
Node localhost
{
DebugDscEngine 'TestResource'
{
KeyProperty = 'UniqueIdentifier'
MandatoryProperty = 'RequiredValue'
WriteProperty = 'ConfigurableValue'
}
}
}
This example shows how to use the DebugDscEngine resource for testing.
#>
[DscResource(RunAsCredential = 'Optional')]
class DebugDscEngine : ResourceBase
{
[DscProperty(Key)]
[System.String]
$KeyProperty

[DscProperty(Mandatory)]
[System.String]
$MandatoryProperty

[DscProperty()]
[System.String]
$WriteProperty

[DscProperty(NotConfigurable)]
[System.String]
$ReadProperty

DebugDscEngine () : base ($PSScriptRoot)
{
# These properties will not be enforced.
$this.ExcludeDscProperties = @(
'MandatoryProperty'
)
}
Comment on lines +83 to +89
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Consider the implications of excluding a mandatory property from enforcement.

The MandatoryProperty is marked with [DscProperty(Mandatory)] but is excluded from enforcement in the constructor. This creates a contradiction that could confuse users - the property is required by DSC but won't be validated during Set operations. Consider either removing the Mandatory attribute or removing it from ExcludeDscProperties to maintain consistency.

🤖 Prompt for AI Agents
In source/Classes/020.DebugDscEngine.ps1 around lines 83 to 89, the property
'MandatoryProperty' is marked as mandatory but is excluded from enforcement in
the constructor, causing inconsistency. To fix this, either remove
'MandatoryProperty' from the ExcludeDscProperties array to ensure it is
validated during Set operations, or remove the Mandatory attribute from the
property definition to align with its exclusion from enforcement.


[DebugDscEngine] Get()
{
# Output all environment variables to verify the environment
#Write-Verbose -Message "`nEnvironment Variables from inside DSC resource:`n$([System.Environment]::GetEnvironmentVariables().GetEnumerator() | Sort-Object Key | ForEach-Object { "$($_.Key) = $($_.Value)" } | Out-String)" -Verbose
#Write-Warning -Message 'Mocked warning message for testing purposes.'
Comment on lines +94 to +95
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Remove or properly implement the commented-out debug code.

Consider either removing these commented lines or implementing them properly with a debug flag parameter. Keeping commented code in production reduces readability and maintainability.

If debug output is needed, consider:

+[DscProperty()]
+[System.Boolean]
+$EnableDebugOutput = $false

 [DebugDscEngine] Get()
 {
-    # Output all environment variables to verify the environment
-    #Write-Verbose -Message "`nEnvironment Variables from inside DSC resource:`n$([System.Environment]::GetEnvironmentVariables().GetEnumerator() | Sort-Object Key | ForEach-Object { "$($_.Key) = $($_.Value)" } | Out-String)" -Verbose
-    #Write-Warning -Message 'Mocked warning message for testing purposes.'
+    if ($this.EnableDebugOutput)
+    {
+        Write-Verbose -Message "`nEnvironment Variables from inside DSC resource:`n$([System.Environment]::GetEnvironmentVariables().GetEnumerator() | Sort-Object Key | ForEach-Object { "$($_.Key) = $($_.Value)" } | Out-String)" -Verbose
+    }
 
     # Call the base method to return the properties.
     return ([ResourceBase] $this).Get()
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#Write-Verbose -Message "`nEnvironment Variables from inside DSC resource:`n$([System.Environment]::GetEnvironmentVariables().GetEnumerator() | Sort-Object Key | ForEach-Object { "$($_.Key) = $($_.Value)" } | Out-String)" -Verbose
#Write-Warning -Message 'Mocked warning message for testing purposes.'
[DscProperty()]
[System.Boolean]
$EnableDebugOutput = $false
[DebugDscEngine] Get()
{
if ($this.EnableDebugOutput)
{
Write-Verbose -Message "`nEnvironment Variables from inside DSC resource:`n$([System.Environment]::GetEnvironmentVariables().GetEnumerator() | Sort-Object Key | ForEach-Object { "$($_.Key) = $($_.Value)" } | Out-String)" -Verbose
}
# Call the base method to return the properties.
return ([ResourceBase] $this).Get()
}
🤖 Prompt for AI Agents
In source/Classes/020.DebugDscEngine.ps1 around lines 94 to 95, there are
commented-out debug lines that reduce code readability and maintainability.
Remove these commented lines entirely if they are not needed, or implement them
properly by adding a debug flag parameter to control their execution, ensuring
debug output only appears when explicitly enabled.


# Call the base method to return the properties.
return ([ResourceBase] $this).Get()
}

[System.Boolean] Test()
{
# Call the base method to test all of the properties that should be enforced.
return ([ResourceBase] $this).Test()
}

[void] Set()
{
# Call the base method to enforce the properties.
([ResourceBase] $this).Set()
}

<#
Base method Get() call this method to get the current state as a hashtable.
The parameter properties will contain the key properties.
#>
hidden [System.Collections.Hashtable] GetCurrentState([System.Collections.Hashtable] $properties)
{
Write-Verbose -Message (
$this.localizedData.Getting_CurrentState -f @(
$properties.KeyProperty
)
)

Write-Verbose -Message (
$this.localizedData.Debug_GetCurrentState_Called -f @(
$properties.KeyProperty,
($properties.Keys -join ', ')
)
)

$currentState = @{
KeyProperty = $properties.KeyProperty
MandatoryProperty = 'CurrentMandatoryStateValue'
WriteProperty = 'CurrentStateValue'
ReadProperty = 'ReadOnlyValue_' + (Get-Date -Format 'yyyyMMdd_HHmmss')
}

Write-Verbose -Message (
$this.localizedData.Debug_GetCurrentState_Returning -f @(
($currentState.Keys -join ', ')
)
)

return $currentState
}

<#
Base method Set() call this method with the properties that are not in
desired state and should be enforced. It is not called if all properties
are in desired state. The variable $properties contains only the properties
that are not in desired state.
#>
hidden [void] Modify([System.Collections.Hashtable] $properties)
{
Write-Verbose -Message (
$this.localizedData.Debug_Modify_Called -f @(
$this.KeyProperty,
($properties.Keys -join ', ')
)
)

foreach ($propertyName in $properties.Keys)
{
$propertyValue = $properties[$propertyName]

Write-Verbose -Message (
$this.localizedData.Debug_Modify_Property -f @(
$propertyName,
$propertyValue
)
)

# Simulate setting the property
Start-Sleep -Milliseconds 100
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Consider making the simulated delay configurable.

The hardcoded 100ms sleep might be too short for some debugging scenarios. Consider adding a property to make this configurable.

Add a property to control the delay:

+[DscProperty()]
+[System.Int32]
+$SimulatedDelayMilliseconds = 100

 # Simulate setting the property
-Start-Sleep -Milliseconds 100
+Start-Sleep -Milliseconds $this.SimulatedDelayMilliseconds

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In source/Classes/020.DebugDscEngine.ps1 at line 175, the Start-Sleep command
uses a hardcoded 100ms delay which may not suit all debugging scenarios.
Introduce a new configurable property in the class to specify the delay
duration, then replace the fixed 100ms value with this property so users can
adjust the simulated delay as needed.

}

Write-Verbose -Message (
$this.localizedData.Debug_Modify_Completed -f $this.KeyProperty
)
}

<#
Base method Assert() call this method with the properties that was assigned
a value.
#>
hidden [void] AssertProperties([System.Collections.Hashtable] $properties)
{
Write-Verbose -Message (
$this.localizedData.Debug_AssertProperties_Called -f @(
$this.KeyProperty,
($properties.Keys -join ', ')
)
)

# Validate that KeyProperty is not null or empty
if ([System.String]::IsNullOrEmpty($properties.KeyProperty))
{
New-ArgumentException -ArgumentName 'KeyProperty' -Message $this.localizedData.KeyProperty_Invalid
}

# Validate that MandatoryProperty is not null or empty
if ([System.String]::IsNullOrEmpty($properties.MandatoryProperty))
{
New-ArgumentException -ArgumentName 'MandatoryProperty' -Message $this.localizedData.MandatoryProperty_Invalid
}

Write-Verbose -Message (
$this.localizedData.Debug_AssertProperties_Completed -f $this.KeyProperty
)
}

<#
Base method Normalize() call this method with the properties that was assigned
a value.
#>
hidden [void] NormalizeProperties([System.Collections.Hashtable] $properties)
{
Write-Verbose -Message (
$this.localizedData.Debug_NormalizeProperties_Called -f @(
$this.KeyProperty,
($properties.Keys -join ', ')
)
)

# Normalize KeyProperty to uppercase
if ($properties.ContainsKey('KeyProperty'))
{
$this.KeyProperty = $properties.KeyProperty.ToUpper()

Write-Verbose -Message (
$this.localizedData.Debug_NormalizeProperties_Property -f @(
'KeyProperty',
$this.KeyProperty
)
)
}

# Normalize WriteProperty to trim whitespace
if ($properties.ContainsKey('WriteProperty'))
{
$this.WriteProperty = $properties.WriteProperty.Trim()

Write-Verbose -Message (
$this.localizedData.Debug_NormalizeProperties_Property -f @(
'WriteProperty',
$this.WriteProperty
)
)
}

Write-Verbose -Message (
$this.localizedData.Debug_NormalizeProperties_Completed -f $this.KeyProperty
)
}
}
15 changes: 15 additions & 0 deletions source/en-US/DebugDscEngine.strings.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@{
Getting_CurrentState = "Getting current state for DebugDscEngine resource with KeyProperty '{0}'."
Debug_GetCurrentState_Called = "GetCurrentState method called for KeyProperty '{0}' with properties: {1}."
Debug_GetCurrentState_Returning = "GetCurrentState method returning properties: {0}."
Debug_Modify_Called = "Modify method called for KeyProperty '{0}' with properties to modify: {1}."
Debug_Modify_Property = "Modifying property '{0}' to value '{1}'."
Debug_Modify_Completed = "Modify method completed for KeyProperty '{0}'."
Debug_AssertProperties_Called = "AssertProperties method called for KeyProperty '{0}' with properties: {1}."
Debug_AssertProperties_Completed = "AssertProperties method completed for KeyProperty '{0}'."
Debug_NormalizeProperties_Called = "NormalizeProperties method called for KeyProperty '{0}' with properties: {1}."
Debug_NormalizeProperties_Property = "Normalized property '{0}' to value '{1}'."
Debug_NormalizeProperties_Completed = "NormalizeProperties method completed for KeyProperty '{0}'."
KeyProperty_Invalid = "The parameter KeyProperty cannot be null or empty."
MandatoryProperty_Invalid = "The parameter MandatoryProperty cannot be null or empty."
}
2 changes: 1 addition & 1 deletion source/suffix.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ if (-not $env:SqlServerDscCI)
It is not possible to throw the error from Import-SqlDscPreferredModule
since it will just fail the command Import-Module with an obscure error.
#>
Write-Warning -Message $_.Exception.Message
#Write-Warning -Message $_.Exception.Message
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Good fix for DSCv3 JSON parsing issue.

This change addresses the critical issue mentioned in the PR where warnings from module import cause JSON parsing failures in DSCv3. The warning was being interpreted as part of the resource output, breaking DSC's JSON parsing.

Consider whether the warning could be redirected to a different stream instead of completely suppressed:

-        #Write-Warning -Message $_.Exception.Message
+        Write-Warning -Message $_.Exception.Message 3>$null

This would suppress the warning from stdout while still allowing it to be captured if needed for debugging.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#Write-Warning -Message $_.Exception.Message
Write-Warning -Message $_.Exception.Message 3>$null
🤖 Prompt for AI Agents
In source/suffix.ps1 at line 24, instead of completely suppressing the warning
by commenting out the Write-Warning line, modify it to redirect the warning
output to a different stream such as the warning stream or error stream. This
way, the warning will not appear in the standard output and interfere with JSON
parsing, but it can still be captured for debugging if needed. Use PowerShell
redirection operators to achieve this without removing the warning entirely.

}
}
Loading
Loading