Get-DbaStartupParameter - Fix -Simple parameter not being passed to scriptblock
The -Simple parameter was not working because it was referenced inside the scriptblock but never passed as an argument. This fix adds $Simple as the third argument to the scriptblock and passes it in both Invoke-ManagedComputerCommand calls.
Also added tests to verify the -Simple parameter correctly filters output properties.
Fixes #9196
Generated with Claude Code
@claude pls make some decisions Failed tests summary: Path : Get-DbaStartupParameter/Command actually works/Simple parameter returns only essential properties Name : It Simple parameter returns only essential properties Result : Failed Message : ErrorRecord: Expected @('ComputerName', 'InstanceName', 'SqlInstance', 'MasterData', 'MasterLog', 'ErrorLog', 'TraceFlags', 'DebugFlags', 'ParameterString'), but got @('ComputerName', 'DebugFlags', 'ErrorLog', 'InstanceName', 'MasterData', 'MasterLog', 'ParameterString', 'SqlInstance', 'TraceFlags'). StackTrace : RawErrorRecord : Expected @('ComputerName', 'InstanceName', 'SqlInstance', 'MasterData', 'MasterLog', 'ErrorLog', 'TraceFlags', 'DebugFlags', 'ParameterString'), but got @('ComputerName', 'DebugFlags', 'ErrorLog', 'InstanceName', 'MasterData', 'MasterLog', 'ParameterString', 'SqlInstance', 'TraceFlags'). Uploading artifact DetailedTestFailures_Pester5.json (1,729 bytes)...100%
Claude finished @potatoqualitee's task —— View job
Test fix completed ✓
The test was failing because PowerShell returns property names in alphabetical order, but the test was expecting them in a specific order.
Tasks:
- [x] Read the test file to understand current implementation
- [x] Fix the property order comparison in the test
- [x] Commit and push the fix
What I changed:
- Updated the test in
tests/Get-DbaStartupParameter.Tests.ps1to sort both the actual and expected property arrays before comparison - Changed from
Should -Be(which requires exact order) toCompare-Objectwith sorted arrays, which properly compares arrays regardless of order - This follows the dbatools pattern used in other parameter validation tests
The test should now pass since it correctly validates that all expected properties are present, without caring about their order.
--- |