Skip to content
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

test: remove api that should not be used #15678

Merged
merged 6 commits into from
Apr 3, 2023
Merged

test: remove api that should not be used #15678

merged 6 commits into from
Apr 3, 2023

Conversation

julienrbrt
Copy link
Member

Description

ref: #12332 (comment)
Given the sync in the standup, just removing the helper with had introduced for v0.48, for the API lacking of gotest.tools.
As going forward, we still use testify assertions, we can simply delete them, and add a proto deep equal helper.
We need to remove them now for ensuring that no one uses them.


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@julienrbrt julienrbrt requested a review from a team as a code owner April 3, 2023 15:12
Copy link
Member

@mark-rushakoff mark-rushakoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function name and doc could be slightly more clear, but everything else looks like a simple mechanical refactor.

)

// ProtoDeepEqual is a helper function that uses the protocmp package to compare two protobuf messages.
func ProtoDeepEqual(t *testing.T, p1, p2 interface{}) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RequireProtoDeepEqual is probably a better function name.

RequireProtoDeepEqual fails the test t if p1 and p2 are not equivalent protobuf messages.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this is why I am going to request reviews from you more often :D

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For that matter, I think p1 and p2 should be of type proto.Message iirc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmp.Diff accepts interface{}, so I think we should accept interfaces as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmp.Diff does accept any, but I'm not sure what the intended behavior is if a programmer mistakenly passes a non-proto.Message type when using protocmp.Transform. If there is a runtime failure in that case, then it would be better to fail earlier, at compile time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, maybe proto.Message would be too restrictive if you were comparing slices instead. Maybe the doc should mention that the function can handle values or slices in the case of continuing to accept any for p1 and p2.

@julienrbrt julienrbrt enabled auto-merge (squash) April 3, 2023 18:40
@julienrbrt julienrbrt merged commit c3b1b37 into main Apr 3, 2023
@julienrbrt julienrbrt deleted the julien/clean-up branch April 3, 2023 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants