-
-
Notifications
You must be signed in to change notification settings - Fork 838
Refactor and enhance Pester tests batch #9773
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
Merged
Merged
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
commit 7aefc63 Author: Chrissy LeMaire <potatoqualitee@users.noreply.github.com> Date: Tue Aug 12 14:44:56 2025 +0200 Improve build ID extraction and PR test repair logic Adds explicit checks for $Matches.Count when extracting AppVeyor build IDs to prevent errors if the regex does not match. Refactors Repair-PullRequestTest.ps1 to handle BuildId mode first, skipping PR/branch auto-detection when a build number is specified, and improves the logic for selecting the branch or PR context for test repair operations. commit 1a1c432 Author: Chrissy LeMaire <potatoqualitee@users.noreply.github.com> Date: Tue Aug 12 13:04:32 2025 +0200 Add appveyor.pester.ps1 to cache file paths Included the appveyor.pester.ps1 test file in the CacheFilePath array within Update-PesterTest.ps1 to ensure it is considered during cache operations. commit 842ae4e Author: Chrissy LeMaire <potatoqualitee@users.noreply.github.com> Date: Tue Aug 12 12:50:40 2025 +0200 Update Repair-PullRequestTest.ps1 commit f372c02 Author: Chrissy LeMaire <potatoqualitee@users.noreply.github.com> Date: Tue Aug 12 11:20:57 2025 +0200 Improve AppVeyor build detection using branch name Enhances the logic for detecting AppVeyor build status and IDs by first attempting to use the branch name directly with GitHub's API, falling back to commit SHA only if necessary. Adds more robust handling for check-runs and status APIs, and restricts fallback to processing all open PRs to only the development branch, providing clearer warnings and verbose output. commit 4a9a862 Author: Chrissy LeMaire <potatoqualitee@users.noreply.github.com> Date: Tue Aug 12 11:06:53 2025 +0200 Remove Test-BranchPublished and improve failure detection Eliminates the Test-BranchPublished helper and its early exit logic, simplifying the process flow. Now, if no failures are detected for the current branch, the script logs a verbose message and exits, improving clarity and reducing redundant checks. commit 02cbec1 Author: Chrissy LeMaire <potatoqualitee@users.noreply.github.com> Date: Tue Aug 12 11:04:15 2025 +0200 Improve branch unpublished warnings and temp dir handling Changed verbose messages to warnings when the current branch is unpublished in both Get-AppVeyorFailure and Repair-PullRequestTest. Refactored Repair-PullRequestTest to initialize and clean up the temp directory only when needed, preventing null reference issues. commit e1de4ae Author: Chrissy LeMaire <potatoqualitee@users.noreply.github.com> Date: Tue Aug 12 11:00:47 2025 +0200 Add branch publication check before AppVeyor actions Introduced a Test-BranchPublished helper function in both Get-AppVeyorFailure.ps1 and Repair-PullRequestTest.ps1 to verify if the current branch has been published to AppVeyor before proceeding. This prevents unnecessary operations and error checks on unpublished branches, improving script reliability and user feedback. commit 3e991a4 Author: Chrissy LeMaire <potatoqualitee@users.noreply.github.com> Date: Tue Aug 12 10:58:01 2025 +0200 Enhance AppVeyor failure detection and repair logic Improved Get-AppVeyorFailure and Repair-PullRequestTest to support automatic detection of AppVeyor build failures from the current branch or a specified branch, with multiple fallback methods (PR checks, commit status, check-runs API). Updated parameter documentation and examples to reflect new capabilities, and refactored logic to allow explicit branch-based repair and more robust auto-detection, reducing manual input and improving usability. commit f893538 Author: Chrissy LeMaire <potatoqualitee@users.noreply.github.com> Date: Tue Aug 12 10:47:01 2025 +0200 Rename parameters in Repair-PullRequestTest Renamed the 'PRNumber' parameter to 'PullRequest' and 'MaxPRs' to 'Limit' in Repair-PullRequestTest.ps1 for clarity and consistency. Updated all references and documentation in both the script and README accordingly. commit 6f07f99 Author: Chrissy LeMaire <potatoqualitee@users.noreply.github.com> Date: Tue Aug 12 10:43:26 2025 +0200 Rename BuildNumber parameter to BuildId in scripts Replaces all references to the BuildNumber parameter with BuildId in Get-AppVeyorFailure.ps1 and Repair-PullRequestTest.ps1 for clarity and consistency. Updates parameter names, documentation, and usage examples accordingly. commit 025d224 Author: Chrissy LeMaire <potatoqualitee@users.noreply.github.com> Date: Tue Aug 12 10:11:43 2025 +0200 Refactor PR test repair and failure filtering logic Replaces the Branch parameter with a Pattern parameter in Get-AppVeyorFailure, allowing regex-based filtering of failures by filename. Updates Repair-PullRequestTest to pass the pattern through, simplifies logic by removing special handling for standalone branches and the Force flag, and streamlines parallel job management and cleanup. Improves documentation and usage examples for both scripts. commit 7549513 Author: Chrissy LeMaire <potatoqualitee@users.noreply.github.com> Date: Tue Aug 12 10:01:48 2025 +0200 fox commit f86b7a3 Author: Chrissy LeMaire <potatoqualitee@users.noreply.github.com> Date: Tue Aug 12 09:42:41 2025 +0200 Add GitHub CLI integration to resolve AppVeyor builds Enhances Get-AppVeyorFailure.ps1 to first attempt resolving the latest AppVeyor build for a branch using the GitHub CLI and GitHub API, falling back to the previous AppVeyor history API logic if necessary. This improves reliability and accuracy when identifying the correct build associated with a branch. commit 2936ed5 Author: Chrissy LeMaire <potatoqualitee@users.noreply.github.com> Date: Tue Aug 12 09:05:35 2025 +0200 Add Branch parameter to Get-AppVeyorFailure Introduces a new -Branch parameter to the Get-AppVeyorFailure function, allowing users to retrieve test failures from the latest AppVeyor build for a specified branch. Updates parameter documentation and logic to support branch-based build selection. commit 0f90e72 Author: Chrissy LeMaire <potatoqualitee@users.noreply.github.com> Date: Tue Aug 12 09:03:10 2025 +0200 Update Repair-PullRequestTest.ps1 commit 5ca93c6 Author: Chrissy LeMaire <potatoqualitee@users.noreply.github.com> Date: Tue Aug 12 09:00:46 2025 +0200 Improve handling of current branch without AppVeyor failures Adds logic to only process test files matching a pattern when on the current branch without AppVeyor failure data. Provides clearer warnings and instructions when no failures are found, and avoids running all tests by default unless a pattern is specified. commit 3de8fe5 Author: Chrissy LeMaire <potatoqualitee@users.noreply.github.com> Date: Tue Aug 12 08:37:01 2025 +0200 Add Force flag to allow PR processing on Development branch Introduces a Force switch parameter to Repair-PullRequestTest, enabling PR test failure processing even when on the Development branch. Updates logic to require Force for PR handling on Development, improves filtering of test failures to only include those in changed files, and enhances verbose output for clarity. commit bdb9950 Author: Chrissy LeMaire <potatoqualitee@users.noreply.github.com> Date: Tue Aug 12 08:25:43 2025 +0200 Rename NoAuthFix to NoAutoFix in Update-PesterTest Renames the NoAuthFix parameter to NoAutoFix in Update-PesterTest.ps1 for clarity and consistency. Updates all references in Repair-PullRequestTest.ps1 and the function implementation. Also adds a call to Invoke-DbatoolsFormatter before invoking AutoFix. commit 19f8fca Author: Chrissy LeMaire <potatoqualitee@users.noreply.github.com> Date: Tue Aug 12 08:08:34 2025 +0200 Handle test repair for non-PR branches in script Enhances Repair-PullRequestTest.ps1 to support running test repairs on branches without open PRs, except for the Development branch. For such branches, the script now processes all relevant test files even without AppVeyor failure data, improving usability for feature and local branches. commit 44ce246 Author: Chrissy LeMaire <potatoqualitee@users.noreply.github.com> Date: Tue Aug 12 08:02:03 2025 +0200 Add strict dev branch protection and Ctrl-C job cleanup Prevents the Repair-PullRequestTest script from running repairs directly on the development branch, enforcing branch protection. Adds robust Ctrl-C (interrupt) handling to stop and clean up background jobs immediately, including registering and unregistering event handlers and traps for pipeline interruptions. Improves reliability and safety during parallel test repair operations.
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.
Couldn't be auto-converted
New-DbaAgentSchedule
New-DbaAvailabilityGroup
New-DbaConnectionStringBuilder
New-DbaDbSnapshot
New-DbaDbTransfer
New-DbaReplCreationScriptOptions
Read-DbaTraceFile