-
Notifications
You must be signed in to change notification settings - Fork 60
Register the win-enable-nvme-boot-driver run id (SCR-3) #154
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
Edwin Bernal Microsoft (EdwinBernal1)
merged 2 commits into
Azure:main
from
EdwinBernal1:nvme-release-scr3
Sep 18, 2026
+65
−0
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # Catalogue tests for map.json — the public run-id contract. | ||
| # Run from the repository root: | ||
| # pwsh -NoProfile -File ./tests/test-map-catalog.ps1 | ||
|
|
||
| $ErrorActionPreference = 'Stop' | ||
| $repositoryRoot = Split-Path $PSScriptRoot -Parent | ||
| $mapPath = Join-Path $repositoryRoot 'map.json' | ||
|
|
||
| function Assert-True { | ||
| Param([bool]$Condition, [string]$Message) | ||
| if (-not $Condition) { throw "ASSERTION FAILED: $Message" } | ||
| } | ||
|
|
||
| # A run id that resolves to nothing, or to the wrong file, fails only at the moment an operator is | ||
| # running a repair against a broken VM. That is the worst possible time to discover it. | ||
| $catalog = @(Get-Content -LiteralPath $mapPath -Raw | ConvertFrom-Json) | ||
| Assert-True ($catalog.Count -gt 0) 'map.json must contain at least one entry.' | ||
|
|
||
| foreach ($entry in $catalog) { | ||
| Assert-True (-not [string]::IsNullOrWhiteSpace($entry.id)) 'Every entry needs an id.' | ||
| Assert-True (-not [string]::IsNullOrWhiteSpace($entry.path)) "Entry '$($entry.id)' needs a path." | ||
| Assert-True (-not [string]::IsNullOrWhiteSpace($entry.description)) "Entry '$($entry.id)' needs a description." | ||
| Assert-True ($entry.path -notmatch '\\') "Entry '$($entry.id)' must use forward slashes; the path is used in a URL." | ||
| Assert-True (Test-Path -LiteralPath (Join-Path $repositoryRoot $entry.path) -PathType Leaf) ` | ||
| "Entry '$($entry.id)' points at '$($entry.path)', which does not exist." | ||
| } | ||
|
|
||
| $duplicates = @($catalog | Group-Object id | Where-Object Count -gt 1) | ||
| Assert-True ($duplicates.Count -eq 0) "Duplicate run ids: $(($duplicates | ForEach-Object Name) -join ', ')." | ||
|
|
||
| # The extension resolves a run id to a path and then downloads the whole bundle. An entry whose OS | ||
| # does not match its directory sends a PowerShell script to a Linux guest, or the reverse. | ||
| foreach ($entry in $catalog) { | ||
| if ($entry.path -like 'src/windows/*') { | ||
| Assert-True ($entry.path -like '*.ps1') "Windows entry '$($entry.id)' must point at a .ps1 file." | ||
| } | ||
| elseif ($entry.path -like 'src/linux/*') { | ||
| Assert-True ($entry.path -like '*.sh') "Linux entry '$($entry.id)' must point at a .sh file." | ||
| } | ||
| else { | ||
| throw "Entry '$($entry.id)' is outside src/windows and src/linux: '$($entry.path)'." | ||
| } | ||
| } | ||
|
|
||
| $nvmeRecovery = @($catalog | Where-Object id -eq 'win-enable-nvme-boot-driver') | ||
| Assert-True ($nvmeRecovery.Count -eq 1) 'win-enable-nvme-boot-driver must be registered exactly once.' | ||
| Assert-True ($nvmeRecovery[0].path -eq 'src/windows/win-enable-nvme-boot-driver.ps1') ` | ||
| 'win-enable-nvme-boot-driver must point at the Windows recovery script.' | ||
| Assert-True ($nvmeRecovery[0].description -match '--run-on-repair') ` | ||
| 'The recovery run id operates on an attached offline disk, so its description must say --run-on-repair.' | ||
|
|
||
| foreach ($detector in 'win-detect-nvme-readiness', 'linux-detect-nvme-readiness') { | ||
| Assert-True (@($catalog | Where-Object id -eq $detector).Count -eq 1) "$detector must stay registered." | ||
| } | ||
|
|
||
| Write-Host "PASS: map.json catalogue — $($catalog.Count) entries, unique ids, existing paths, OS/extension agreement, NVMe run ids registered." |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens if a user runs it on the original VM? Should we add guardrails around it