-
Notifications
You must be signed in to change notification settings - Fork 430
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
clean up scope unit tests #5143
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5143 +/- ##
=======================================
Coverage 51.25% 51.25%
=======================================
Files 273 273
Lines 24651 24651
=======================================
Hits 12636 12636
Misses 11229 11229
Partials 786 786 ☔ View full report in Codecov by Sentry. |
/retest |
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.
/lgtm
@@ -272,28 +265,10 @@ func TestManagedControlPlaneScope_PoolVersion(t *testing.T) { | |||
} | |||
|
|||
for _, c := range cases { | |||
c := c |
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.
I guess we can ditch this now with Go 1.22?
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.
I think this change was probably safe even before that since these tests aren't running in parallel.
LGTM label has been added. Git tree hash: 186123818041bf58a5cfccde1b627792b2646105
|
/assign @willie-yao |
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: willie-yao The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
What this PR does / why we need it:
This PR removes most usage of our constructor wrappers to create Scope objects in unit tests in order to avoid the extra setup that requires to create a valid reference to an existing AzureClusterIdentity. That adds quite a few moving parts when all we are trying to test is a function like this that doesn't actually use the identity at all:
cluster-api-provider-azure/azure/scope/cluster.go
Lines 636 to 645 in b8f23bd
I'm planning to make some changes to the identity stuff soon for #5017 and #1077 that would require some change to all of these tests, but with this change it shouldn't need any extra changes. Hopefully this prevents us from needing other sweeping changes to these tests for unrelated changes like this:
https://github.com/kubernetes-sigs/cluster-api-provider-azure/pull/4208/files#diff-bae329736fc788cebbe920f1680bfd39eb52e6f1bdaaa0a620c60037d3840462
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer:
TODOs:
Release note: