STOR-2996: Run unit-tests in /legacy subdir#574
Conversation
📝 WalkthroughWalkthroughThe Makefile now adds a Changes
Sequence Diagram(s)Not applicable; the change is a build-target delegation with no runtime interaction flow. Estimated code review effort: Low Related issues: None provided. Related PRs: None provided. Suggested labels: build, makefile Suggested reviewers: None specified. Poem A Makefile learns an older tune, 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
legacy/gcp-pd-csi-driver-operator/pkg/operator/starter_test.go (1)
76-82: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
wantErr: truecontradicts actualwithCustomLabelsbehavior for this test case.
createInfraCR: truemeans the Infrastructure object is added to the lister, soinfraLister.Get(globalInfrastructureName)succeeds andwithCustomLabelsreturnsnil(it only errors when the lister lookup fails — seestarter.golines 279-309: "withCustomLabels" returns error only when "infraLister.Get(globalInfrastructureName)" fails; otherwise it builds/appends "--extra-labels" and returns nil. EmptyResourceLabelsis not an error path, it just falls back to the default label.With
wantErr: truebut an actualnilerror, this test case will now fail on every run ((err != nil) != test.wantErr→false != true). If the intent is to prove the top-level Makefile never runs legacy unit tests, deliberately breaking a test to demonstrate that is confusing and risky if this ever gets merged as-is — it leaves the suite in a permanently broken state for anyone who does runlegacy/tests.🐛 Proposed fix (revert to correct expectation)
{ name: "labels not configured", labels: []v1.GCPResourceLabel{}, expArgList: fmt.Sprintf("--extra-labels=%s", fmt.Sprintf(ocpDefaultLabelFmt, infraObj.Status.InfrastructureName)), createInfraCR: true, - wantErr: true, + wantErr: false, },🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@legacy/gcp-pd-csi-driver-operator/pkg/operator/starter_test.go` around lines 76 - 82, The “labels not configured” case in starter_test.go has the wrong expectation for withCustomLabels: when createInfraCR is true, infraLister.Get(globalInfrastructureName) succeeds and empty labels should still fall back to the default extra-labels value without returning an error. Update this test case to reflect the actual behavior of withCustomLabels in starter.go by keeping the expected argument list and changing wantErr to the correct value so the test matches the non-error path.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@legacy/gcp-pd-csi-driver-operator/pkg/operator/starter_test.go`:
- Around line 76-82: The “labels not configured” case in starter_test.go has the
wrong expectation for withCustomLabels: when createInfraCR is true,
infraLister.Get(globalInfrastructureName) succeeds and empty labels should still
fall back to the default extra-labels value without returning an error. Update
this test case to reflect the actual behavior of withCustomLabels in starter.go
by keeping the expected argument list and changing wantErr to the correct value
so the test matches the non-error path.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 33e2debe-f99b-420c-9a3a-1caf3e0f86eb
📒 Files selected for processing (1)
legacy/gcp-pd-csi-driver-operator/pkg/operator/starter_test.go
175606d to
f708c74
Compare
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mpatlasov The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
f708c74 to
08b3278
Compare
08b3278 to
a8f7cf5
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Makefile`:
- Around line 20-25: The top-level test-unit target is missing a phony
declaration, so make may treat an existing file or directory named test-unit as
up to date and skip running the recipe. Update the Makefile’s phony target list
to include test-unit alongside test-unit-legacy, keeping the existing
test-unit-legacy dependency and recipe unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 8bf71414-c140-42be-9531-bedc1d417a6a
📒 Files selected for processing (1)
Makefile
|
@mpatlasov: This pull request references STOR-1855 which is a valid jira issue. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/assign @jsafrane |
|
@mpatlasov: This pull request references STOR-2996 which is a valid jira issue. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
/lgtm |
|
/retest |
|
@mpatlasov: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
/verified by ci |
|
@mpatlasov: This PR has been marked as verified by DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
The initial PR moving
gcp-pd-csi-driver-operatorfrom https://github.com/openshift/gcp-pd-csi-driver-operator to/legacysubdir if csi-operator missed the issue: CI unit-test job simply executesmake test-unit, and it does not cross module boundaries (becauselegacy/gcp-pd-csi-driver-operator/has its owngo.mod)https://redhat.atlassian.net/browse/STOR-2996