-
Notifications
You must be signed in to change notification settings - Fork 44
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
e2e: Use Semantic.DeepEqual to test empty status #1593
e2e: Use Semantic.DeepEqual to test empty status #1593
Conversation
karlkfi
commented
Mar 7, 2025
- reflect.DeepEqual worked, but Semantic.DeepEqual is preferred for Kubernetes resources.
- Error with the YAML diff if the status is still set
if len(rg.Status.ResourceStatuses) == 0 { | ||
return fmt.Errorf("found empty status in %s", core.IDOf(obj)) | ||
emptyStatus := resourcegroupv1alpha1.ResourceGroupStatus{} | ||
if equality.Semantic.DeepEqual(emptyStatus, rg.Status) { |
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.
This seems like a weak assertion - can the test use testpredicates.ResourceGroupStatusEquals
instead?
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.
Yes, but the output isn't consistent yet until after some other PRs merge.
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.
- fix: ResourceGroup unnecessary timestamp updates #1570 should have fixed the
status.conditions
timestamps continuously updating (b/399892476) - fix: inventory client deleting unmanaged fields #1588 should have fixed the
status.conditions
disappearing (b/401304237) - fix: ResourceGroup unnecessary condition updates #1571 should have fixed the Reconciling condition flip/flopping (b/399896123)
- fix: ResourceGroup conflicts #1575 should fix
status.observedGeneration
being updated exclusively by the RGC (b/390467537) - TODO: fix
status.resourceStatuses[*].conditions
disappearing (b/401315927) - TODO: fix
status.resourceStatuses[*].status
being set to UNKNOWN by the applier (b/401315927)
My preference would just be to keep this weak assertion for now, until all the above fixes have landed, especially because the last two might not get fixed until after we land the inventory client rewrite.
- reflect.DeepEqual worked, but Semantic.DeepEqual is preferred for Kubernetes resources.
841fd21
to
99d010e
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sdowell 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 |
2595d24
into
GoogleContainerTools:main