-
-
Notifications
You must be signed in to change notification settings - Fork 837
Refactor and enhance Pester tests batch #9759
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
Open
potatoqualitee
wants to merge
20
commits into
development
Choose a base branch
from
b4
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+2,171
−846
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Updated Pester tests for several dbatools commands to use Pester 5 syntax, added param blocks for test configuration, improved parameter validation, and enhanced test structure and assertions. These changes improve test maintainability, consistency, and reliability across the test suite.
Updated Invoke-DbatoolsFormatter to use custom PSSA settings that preserve manually aligned hashtables and assignment operators. The script now only writes files if formatting changes are detected, reducing unnecessary file writes.
Added checks to skip directories and non-PowerShell files, improved error handling for file read/write operations, and ensured only valid content is processed. These changes enhance robustness and prevent errors when processing invalid or unreadable files.
Enhances the formatter to compare processed, formatted content rather than raw content, ensuring that only meaningful formatting changes trigger file writes. Also applies CBH (Comment-Based Help) fixes and whitespace normalization to both the original and formatted content for accurate comparison.
Simplifies the formatter by removing custom alignment-preserving settings and redundant code. Now uses a placeholder approach to preserve aligned assignments, streamlines file type checks, and only writes files if actual formatting changes are detected. Improves maintainability and reliability of the formatting process.
Enhanced Invoke-DbatoolsFormatter to display progress when formatting multiple files, including status updates for each file, error handling, and a summary of processed and updated files. This improves user feedback during batch operations.
Replaces inconsistent whitespace and blank lines in various test files to improve code readability and maintain consistent formatting. No functional changes were made.
Introduces a new 'Pattern' parameter to Repair-PullRequestTest, allowing users to filter test files by name using wildcards. Updates logic to apply this filter when processing failed tests and enhances verbose output to reflect the applied pattern.
Improved test setup and teardown in Get-DbaCredential.Tests.ps1 by managing EnableException in $PSDefaultParameterValues and refactoring credential creation. In Get-DbaDatabase.Tests.ps1, reorganized and consolidated integration and unit tests, removed redundant code, and improved test clarity and reliability.
Updated Pester test scripts for Get-DbaBuild, Get-DbaDatabase, and Get-DbaDbBackupHistory to use more concise parameter validation, improved variable scoping, and modern PowerShell syntax. Removed redundant code, streamlined test setup/teardown, and enhanced test clarity and maintainability. These changes improve test reliability and readability while aligning with current best practices.
Updated the integration test for Backup-DbaDatabase to include the -IgnoreFileChecks parameter, ensuring the test bypasses file checks when backing up the msdb database.
This reverts commit 9c9416b.
Updated the test to check for at least 3 results and verify that each expected certificate is present, rather than requiring exactly 3 results. This makes the test more robust to additional certificates.
This reverts commit 6bfbfbc.
This reverts commit 79174f2.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Updated Pester tests for several dbatools commands to use Pester 5 syntax, added param blocks for test configuration, improved parameter validation, and enhanced test structure and assertions. These changes improve test maintainability, consistency, and reliability across the test suite.
Type of Change
Invoke-ManualPester
)Purpose
Approach
Commands to test
Screenshots
Learning