SqlServerDsc: Update tests to Pester 6 syntax where supported#2465
SqlServerDsc: Update tests to Pester 6 syntax where supported#2465johlju wants to merge 22 commits into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2465 +/- ##
======================================
+ Coverage 91% 94% +2%
======================================
Files 32 227 +195
Lines 5353 10871 +5518
======================================
+ Hits 4904 10234 +5330
- Misses 449 637 +188
🚀 New features to boost your workflow:
|
… Should-NotInvoke - Changed all instances of 'Should:ModuleName' to 'Should-Invoke:ModuleName' and 'Should-NotInvoke:ModuleName' in various test scripts. - Updated BeforeAll and AfterAll blocks in the following test files: - Test-SqlDscIsLogin.Tests.ps1 - Test-SqlDscIsLoginEnabled.Tests.ps1 - Test-SqlDscIsRole.Tests.ps1 - Test-SqlDscIsSupportedFeature.Tests.ps1 - Test-SqlDscRSAccessible.Tests.ps1 - Test-SqlDscRSInitialized.Tests.ps1 - Test-SqlDscRSInstalled.Tests.ps1 - Test-SqlDscServerPermission.Tests.ps1 - Uninstall-SqlDscPowerBIReportServer.Tests.ps1 - Uninstall-SqlDscReportingService.Tests.ps1 - Uninstall-SqlDscServer.Tests.ps1 - Update-SqlDscServer.Tests.ps1 - Update-SqlDscServerEdition.Tests.ps1 - Connect-Sql.Tests.ps1 - Connect-SqlAnalysis.Tests.ps1 - Connect-UncPath.Tests.ps1 - ConvertTo-ServerInstanceName.Tests.ps1 - Copy-ItemWithRobocopy.Tests.ps1 - Disconnect-UncPath.Tests.ps1 - Find-ExceptionByNumber.Tests.ps1 - Get-PrimaryReplicaServerObject.Tests.ps1 - Get-ServiceAccount.Tests.ps1 - Get-SqlInstanceMajorVersion.Tests.ps1 - Invoke-InstallationMediaCopy.Tests.ps1 - Invoke-SqlScript.Tests.ps1 - Restart-SqlClusterService.Tests.ps1 - Restart-SqlService.Tests.ps1 - Split-FullSqlInstanceName.Tests.ps1 - Start-SqlSetupProcess.Tests.ps1 - Test-ActiveNode.Tests.ps1 - Test-AvailabilityReplicaSeedingModeAutomatic.Tests.ps1 - Test-ClusterPermissions.Tests.ps1 - Test-FeatureFlag.Tests.ps1 - Test-ImpersonatePermissions.Tests.ps1 - Test-LoginEffectivePermissions.Tests.ps1 - Update-AvailabilityGroupReplica.Tests.ps1
- Updated all test scripts to replace references of `$script:dscModuleName` with `$script:moduleName` for the `Should-Invoke` and `Should-NotInvoke` parameters in the `BeforeAll` block.
…er command behavior
…e:ModuleName' and 'Should-NotInvoke:ModuleName' for consistency with Pester 6
…datory checks
- Updated tests for various SQL DSC commands to replace direct checks for mandatory attributes with Should-All { $_ | Should-BeTrue } for better readability and consistency.
- Ensured that non-mandatory parameters are checked using Should-All { $_ | Should-BeFalse } where applicable.
- This change applies to tests across multiple files including Disable-SqlDscDatabaseSnapshotIsolation, Enable-SqlDscLogin, Get-SqlDscAgentAlert, and others.
…start and SuppressRestart
…consistency - Updated multiple unit test files to replace the use of inline script blocks with -FilterScript in assertions for parameter attributes. - Ensured that mandatory and non-mandatory parameter checks are consistently using the same validation method across various test files. - This change improves readability and maintains a uniform approach to parameter validation in the tests.
…ssertions - Updated parameter handling in multiple test scripts to use 'Should:ModuleName' instead of 'Should-Invoke:ModuleName' and 'Should-NotInvoke:ModuleName'. - Replaced 'Should -MatchExactly' assertions with 'Should-MatchString -CaseSensitive' for better clarity and consistency in tests. - Adjusted various test cases to ensure proper invocation and parameter filtering for SQL setup processes. - Enhanced type checking in tests to ensure expected object types are returned. - Cleaned up redundant code and improved readability across multiple test files.
…ccounts assertions
…sertions and update type checks for consistency
…g for better traceability
… depth overflow comments
…and improve debug logging
Pull Request (PR) description
This Pull Request (PR) fixes the following issues
None.
Task list
file CHANGELOG.md. Entry should say what was changed and how that
affects users (if applicable), and reference the issue being resolved
(if applicable).
This change is