-
Notifications
You must be signed in to change notification settings - Fork 1.5k
OCPBUGS-78995: Azure Machines: Accept explicit image ID #10712
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -458,5 +458,9 @@ func mapiImage(osImage azure.OSImage, azEnv azure.CloudEnvironment, confidential | |
| // for MAPI, by removing the /subspcription/ prefix. | ||
| func trimSubscriptionPrefix(image string) string { | ||
| rgIndex := strings.Index(image, "/resourceGroups/") | ||
| // Allow invalid inputs to fail downstream | ||
| if rgIndex < 0 { | ||
| return image | ||
| } | ||
|
Comment on lines
+461
to
+464
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win Add regression tests for valid and malformed image IDs. This change fixes a panic path, but the modified helper has no visible unit tests. Cover a valid subscription-scoped ID, an ID without As per coding guidelines, all Go code under 🤖 Prompt for AI AgentsSource: Coding guidelines
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you point to an existing unit test that covers this function? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '== Azure machine-related Go tests =='
fd -t f -e go . pkg/asset/machines/azure | sort
echo
echo '== Direct trimSubscriptionPrefix calls =='
rg -n -C 3 '\btrimSubscriptionPrefix\s*\(' pkg/asset/machines/azure -g '*_test.go' || true
echo
echo '== mapiImage calls in tests (indirect coverage candidate) =='
rg -n -C 3 '\bmapiImage\s*\(' pkg/asset/machines/azure -g '*_test.go' || true
echo
echo '== Image ResourceID assertions in Azure machine tests =='
rg -n -C 3 '(ResourceID|resourceGroups)' pkg/asset/machines/azure -g '*_test.go' || trueLength of output: 1037 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '== Direct helper coverage in all Go tests =='
rg -n -C 3 '\btrimSubscriptionPrefix\s*\(' -g '*_test.go' . || true
echo
echo '== Indirect mapiImage coverage in all Go tests =='
rg -n -C 3 '\bmapiImage\s*\(' -g '*_test.go' . || true
echo
echo '== Tests covering the package or Azure resource-group image IDs =='
rg -n -C 3 '(pkg/asset/machines/azure|/resourceGroups/|ResourceID)' -g '*_test.go' . || trueLength of output: 3942
My original comment should have stated this more clearly: the requested tests would be new regression coverage, not an extension of an existing helper test.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cool, imma leave it alone then, unless a human feels otherwise. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the motivation for this (I.e. what is the input/case where we hit this) change? Generally the image function seems like a really good case for unit tests and should be easy to add with claude There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| return image[rgIndex:] | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.