Add missing enum-documented query parameters (ValidateSet/ArgumentCompleter) across 7 cmdlets #20
Workflow file for this run
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
| name: Tests | |
| # Runs the Pester suite across every OS/PowerShell-edition combination the module | |
| # claims to support (PureStorageFlashBladePowerShell.psd1: PowerShellVersion = '5.1'), | |
| # so platform-specific bugs (e.g. a .NET marshaling difference between Windows and | |
| # Linux/macOS) are caught on every push/PR instead of only surfacing much later on | |
| # whichever CI job happens to run on a non-Windows runner. | |
| # | |
| # Two separate jobs rather than one shell-matrixed job: the `shell:` key on a step does | |
| # NOT have access to the `matrix` context (unlike `run:`, `env:`, or a job's own `name:`/ | |
| # `runs-on:`) -- confirmed via `gh workflow run`: "Unrecognized named-value: 'matrix'. | |
| # Located at position 1 within expression: matrix.shell". `shell:` must be a literal. | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: {} | |
| jobs: | |
| test-pwsh: | |
| name: Test (${{ matrix.os }}, pwsh) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Install test dependencies | |
| shell: pwsh | |
| run: | | |
| function Install-PfbModuleWithRetry { | |
| param([hashtable]$Params, [int]$MaxAttempts = 3, [int]$DelaySeconds = 15) | |
| for ($attempt = 1; $attempt -le $MaxAttempts; $attempt++) { | |
| try { | |
| Install-Module @Params -ErrorAction Stop | |
| return | |
| } catch { | |
| if ($attempt -eq $MaxAttempts) { throw } | |
| Write-Warning "Install-Module '$($Params.Name)' attempt $attempt/$MaxAttempts failed: $($_.Exception.Message). Retrying in $DelaySeconds s..." | |
| Start-Sleep -Seconds $DelaySeconds | |
| } | |
| } | |
| } | |
| # Posh-SSH is an optional runtime dependency (see Private/Get-PfbApiTokenViaSsh.ps1), | |
| # but Get-PfbApiTokenViaSsh.Tests.ps1 mocks its cmdlets (New-SSHSession, etc.) -- | |
| # Pester can only mock a command that's resolvable, so it must be installed here | |
| # even though the module under test never actually opens an SSH connection. | |
| Install-PfbModuleWithRetry -Params @{ Name = 'Pester'; MinimumVersion = '5.0'; Force = $true; SkipPublisherCheck = $true; Scope = 'CurrentUser' } | |
| Install-PfbModuleWithRetry -Params @{ Name = 'Posh-SSH'; Force = $true; SkipPublisherCheck = $true; Scope = 'CurrentUser' } | |
| - name: Run Pester tests | |
| shell: pwsh | |
| run: | | |
| Import-Module Pester -MinimumVersion 5.0 -Force | |
| Import-Module Posh-SSH -Force | |
| $cfg = New-PesterConfiguration | |
| $cfg.Run.Path = 'Tests' | |
| $cfg.Run.Exit = $true | |
| $cfg.Output.Verbosity = 'Detailed' | |
| Invoke-Pester -Configuration $cfg | |
| test-windows-powershell-5-1: | |
| name: Test (windows-latest, Windows PowerShell 5.1) | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Install test dependencies | |
| shell: powershell | |
| run: | | |
| # Some older Windows PowerShell 5.1 hosts default to TLS 1.0/1.1, which | |
| # PowerShell Gallery rejects -- force TLS 1.2 before hitting it. | |
| [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
| function Install-PfbModuleWithRetry { | |
| param([hashtable]$Params, [int]$MaxAttempts = 3, [int]$DelaySeconds = 15) | |
| for ($attempt = 1; $attempt -le $MaxAttempts; $attempt++) { | |
| try { | |
| Install-Module @Params -ErrorAction Stop | |
| return | |
| } catch { | |
| if ($attempt -eq $MaxAttempts) { throw } | |
| Write-Warning "Install-Module '$($Params.Name)' attempt $attempt/$MaxAttempts failed: $($_.Exception.Message). Retrying in $DelaySeconds s..." | |
| Start-Sleep -Seconds $DelaySeconds | |
| } | |
| } | |
| } | |
| # Posh-SSH is an optional runtime dependency (see Private/Get-PfbApiTokenViaSsh.ps1), | |
| # but Get-PfbApiTokenViaSsh.Tests.ps1 mocks its cmdlets (New-SSHSession, etc.) -- | |
| # Pester can only mock a command that's resolvable, so it must be installed here | |
| # even though the module under test never actually opens an SSH connection. | |
| Install-PfbModuleWithRetry -Params @{ Name = 'Pester'; MinimumVersion = '5.0'; Force = $true; SkipPublisherCheck = $true; Scope = 'CurrentUser' } | |
| Install-PfbModuleWithRetry -Params @{ Name = 'Posh-SSH'; Force = $true; SkipPublisherCheck = $true; Scope = 'CurrentUser' } | |
| - name: Run Pester tests | |
| shell: powershell | |
| run: | | |
| Import-Module Pester -MinimumVersion 5.0 -Force | |
| Import-Module Posh-SSH -Force | |
| $cfg = New-PesterConfiguration | |
| $cfg.Run.Path = 'Tests' | |
| $cfg.Run.Exit = $true | |
| $cfg.Output.Verbosity = 'Detailed' | |
| Invoke-Pester -Configuration $cfg |