Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ jobs:
- name: Parse + analyze PowerShell
shell: pwsh
run: |
# Register the gallery if the runner image has not, then trust it. Set-PSRepository fails hard when
# PSGallery is not registered yet - an intermittent runner-image state that has flaked this job -
# so register-if-missing rather than assume it is there.
if (-not (Get-PSRepository -Name PSGallery -ErrorAction SilentlyContinue)) { Register-PSRepository -Default }
Set-PSRepository PSGallery -InstallationPolicy Trusted
Install-Module PSScriptAnalyzer -Force -Scope CurrentUser
$dirs = 'appliance', 'installer/windows'
Expand Down Expand Up @@ -51,6 +55,7 @@ jobs:
- name: Pester (Hyper-V import logic, cmdlets mocked)
shell: pwsh
run: |
if (-not (Get-PSRepository -Name PSGallery -ErrorAction SilentlyContinue)) { Register-PSRepository -Default }
Set-PSRepository PSGallery -InstallationPolicy Trusted
Install-Module Pester -MinimumVersion 5.5.0 -Force -Scope CurrentUser -SkipPublisherCheck
Import-Module Pester
Expand Down
7 changes: 6 additions & 1 deletion appliance/Import-DispatchAppliance.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ Describe 'Import-DispatchAppliance (unattended)' {
Mock Set-VMMemory {}
Mock Set-VMNetworkAdapterVlan {}
Mock Start-VM {}
Mock Copy-Item {}
# Create the destination, rather than mocking the copy away to nothing. The script verifies the
# copy landed (Test-Path -PathType Leaf) before handing the path to New-VM - a real guard, since a
# silently failed copy would otherwise produce a VM pointed at a missing disk. A no-op mock made
# that guard throw on every test that got as far as the copy, which is why four of the six here have
# failed since they were written.
Mock Copy-Item { New-Item -ItemType File -Path $Destination -Force | Out-Null }
}

It 'keeps VM config + disk together under <storage>\<name>' {
Expand Down