Skip to content

[release/v7.6] Fix a preview detection test for the packaging script#26971

Merged
daxian-dbw merged 1 commit intoPowerShell:release/v7.6from
daxian-dbw:backport/release/v7.6/26882-7ca2b72af
Mar 9, 2026
Merged

[release/v7.6] Fix a preview detection test for the packaging script#26971
daxian-dbw merged 1 commit intoPowerShell:release/v7.6from
daxian-dbw:backport/release/v7.6/26882-7ca2b72af

Conversation

@daxian-dbw
Copy link
Member

Backport of #26882 to release/v7.6

Triggered by @daxian-dbw on behalf of @daxian-dbw

Original CL Label: CL-BuildPackaging

/cc @PowerShell/powershell-maintainers

Impact

REQUIRED: Choose either Tooling Impact or Customer Impact (or both). At least one checkbox must be selected.

Tooling Impact

  • Required tooling change
  • Optional tooling change (include reasoning)

Fixes a test in the packaging script that validates preview version detection. Ensures packaging tests work correctly.

Customer Impact

  • Customer reported
  • Found internally

Regression

REQUIRED: Check exactly one box.

  • Yes
  • No

This is not a regression.

Testing

Verified by running the fixed test in the packaging script. The test now correctly detects preview versions. Backported to v7.4 and v7.5 with PRs awaiting merge.

Risk

REQUIRED: Check exactly one box.

  • High
  • Medium
  • Low

Low risk as this only fixes a test in the packaging script. The change affects test code verification only and does not impact production packaging behavior or runtime functionality.

Copilot AI review requested due to automatic review settings March 9, 2026 22:25
@daxian-dbw daxian-dbw added the CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log label Mar 9, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Backport to release/v7.6 that adjusts a packaging test to correctly validate preview-version detection in the packaging script test suite.

Changes:

  • Converts the preview detection verification test into a parameterized Pester test covering both -preview and -rc versions.
  • Removes the old “incorrect logic” assertion and instead validates the actual packaging helper output.

Comment on lines +49 to +56
It "Should NOT use package name for preview detection (bug fix verification) - <Name>" -TestCases @(
@{ Version = "7.6.0-preview.6"; Name = "Preview" }
@{ Version = "7.6.0-rc.1"; Name = "RC" }
) {
# This test verifies the fix for issue #26673
# The bug was using ($Name -like '*-preview') which always returned false
# because preview builds use Name="powershell" not "powershell-preview"

$Version = "7.6.0-preview.6"
$Name = "powershell" # Preview builds use "powershell" not "powershell-preview"

# The INCORRECT logic (the bug): $Name -like '*-preview'
$incorrectCheck = $Name -like '*-preview'
$incorrectCheck | Should -Be $false -Because "Package name is 'powershell' not 'powershell-preview'"

param($Version)
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

The updated test no longer checks anything about the package name (the test cases use Name only for display), but the It description and the comments still describe a package-name-based bug ($Name -like '*-preview'). This makes the test misleading and harder to maintain. Please update the It text/comments to match the actual assertion (e.g., that preview detection is based on the version string and that both -preview and -rc are treated as preview).

Copilot uses AI. Check for mistakes.
@daxian-dbw daxian-dbw merged commit ccf7ae9 into PowerShell:release/v7.6 Mar 9, 2026
39 checks passed
@daxian-dbw daxian-dbw deleted the backport/release/v7.6/26882-7ca2b72af branch March 9, 2026 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants