fix(gpu): report actual vs expected GPU PCI count in provision-check assertion - #4589
Merged
Conversation
…assertion
## What
Replace the static GPU provisioning assertion message in `_gpu_provision_check`
with a dynamic one that reports the actual detected GPU PCI device count and the
expected minimum.
## Why
The assertion checks `len(init_gpu) >= min_pci_count`, but the failure message
was hardcoded to "Number of GPU PCI device is not greater than 0". This is
misleading: when `min_pci_count > 0`, the reported reason didn't match the
actual check, making triage harder (e.g. detected 2 GPUs but expected 4 still
printed "not greater than 0"). The message should reflect the real detected and
expected values.
## How
Update the `.described_as(...)` text to include `len(init_gpu)` (detected count)
and `min_pci_count` (expected minimum):
> Detected GPU PCI device count {n} is less than the expected minimum {min}
No change to the assertion logic (`is_greater_than_or_equal_to(min_pci_count)`)
or control flow.
## Impact
- Clearer, accurate failure diagnostics for GPU provisioning checks.
- No behavioral change to which cases pass or fail.
## Testing
- GPU provisioning validation on a GPU SKU.
SRIKKANTH
requested review from
LiliDeng,
johnsongeorge-w,
paxue and
umfranci
as code owners
July 9, 2026 07:25
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the GPU provisioning check assertion text in the GPU test suite so failures report the actual detected GPU PCI device count and the expected minimum, improving triage without changing pass/fail behavior.
Changes:
- Replace the hardcoded
_gpu_provision_checkassertion message with a dynamic message that includes actual and expected counts.
✅ AI Test Selection — PASSED7 test case(s) selected (view run) Marketplace image: canonical 0001-com-ubuntu-server-jammy 22_04-lts-gen2 latest
Test case details
|
LiliDeng
approved these changes
Jul 9, 2026
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
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.
What
Replace the static GPU provisioning assertion message in
_gpu_provision_checkwith a dynamic one that reports the actual detected GPU PCI device count and the expected minimum.Why
The assertion checks
len(init_gpu) >= min_pci_count, but the failure message was hardcoded to "Number of GPU PCI device is not greater than 0". This is misleading: whenmin_pci_count > 0, the reported reason didn't match the actual check, making triage harder (e.g. detected 2 GPUs but expected 4 still printed "not greater than 0"). The message should reflect the real detected and expected values.How
Update the
.described_as(...)text to includelen(init_gpu)(detected count) andmin_pci_count(expected minimum):No change to the assertion logic (
is_greater_than_or_equal_to(min_pci_count)) or control flow.Impact
Testing
Description
Related Issue
Type of Change
Checklist
Test Validation
Key Test Cases:
Impacted LISA Features:
Gpu
Tested Azure Marketplace Images:
Test Results