-
Notifications
You must be signed in to change notification settings - Fork 196
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
Improve Azure deployment reconciler and add tests #1605
Improve Azure deployment reconciler and add tests #1605
Conversation
Ignore the first commit (based on my VMSS branch, will go away once that merges). This is a draft PR just so folks are aware of the upcoming tests and changes. I think after this we should have enough test coverage to be more confident about the reconciler behavior. Thinking we can follow this PR up with some refactoring around:
|
f226466
to
31dff27
Compare
Codecov Report
@@ Coverage Diff @@
## master #1605 +/- ##
==========================================
+ Coverage 62.38% 62.91% +0.53%
==========================================
Files 186 187 +1
Lines 12273 12355 +82
==========================================
+ Hits 7656 7773 +117
+ Misses 3926 3898 -28
+ Partials 691 684 -7
Continue to review full report at Codecov.
|
31dff27
to
12d7d54
Compare
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.
Some minor suggestions, but otherwise looks good.
hack/generated/controllers/deployment_reconciler_negative_test.go
Outdated
Show resolved
Hide resolved
@@ -31,8 +31,8 @@ func NewEnsure(c client.Client, stateAnnotation string, errorAnnotation string) | |||
} | |||
} | |||
|
|||
// Provisioned checks to ensure the provisioning state of the resource is successful. | |||
func (e *Ensure) Provisioned(ctx context.Context, obj runtime.Object) (bool, error) { | |||
// State checks to ensure the provisioning state of the resource the target state. |
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.
// State checks to ensure the provisioning state of the resource the target state. | |
// State checks to check whether the provisioning state of the resource has the target state. |
"Ensure" is an active word that implies this method will make any changes required for the resource to be in target state; I don't think that's what you mean.
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.
Maybe call the method HasState()
?
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.
"Ensure" is an active word that implies this method will make any changes required for the resource to be in target state; I don't think that's what you mean.
The actual struct is already called Ensure
- but the methods hanging off as you note do not actually make changes, they just check them. This same comment style is repeated for the other methods Provisioned
, Failed
, etc.
Merriam-Webster says:
Ensure: to make sure, certain, or safe : guarantee
whereas Cambridge dictionary agrees with you:
To make something certain to happen
I'm going to hold off making a change on this - if we do want to change it we should change the whole class, not just this one place, and it probably ought to be done in a separate PR
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.
Changed to HasState
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 made a note to change Ensure to something else, maybe Verify
? Will do it when I have some spare time.
12d7d54
to
df71532
Compare
- Add tests ensuring various edge cases are covered. - Fix bugs in deployment process which tests uncovered.
df71532
to
b7987fb
Compare
What this PR does / why we need it:
a resource before it's owner is created, or updating a failed resource, work
correctly.
How does this PR make you feel:
If applicable: