Skip to content

Minor: Don’t send the DeleteTopicsRequest for the invalid topic names#4763

Merged
hachikuji merged 4 commits into
apache:trunkfrom
chia7712:invalid_DeleteTopicsRequest
Apr 5, 2018
Merged

Minor: Don’t send the DeleteTopicsRequest for the invalid topic names#4763
hachikuji merged 4 commits into
apache:trunkfrom
chia7712:invalid_DeleteTopicsRequest

Conversation

@chia7712

Copy link
Copy Markdown
Member

The invalid topic name is already handled locally so it is unnecessary to send the DeleteTopicsRequest. This PR adds a count to MockClient for testing.

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@hachikuji

Copy link
Copy Markdown
Contributor

cc @cmccabe

@cmccabe

cmccabe commented Mar 27, 2018

Copy link
Copy Markdown
Contributor

LGTM. Thanks, @chia7712

@hachikuji hachikuji left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR. Left a couple comments.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe we could make this assertion precise? I think we expect the request count to be 0.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ya, the expected value of count is zero currently. However, we can't assume the initial count won't be changed in the future. For example, we plan to share the AdminClientUnitTestEnv (or MockClient) between all UTs to speedup the tests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure I follow. What would be the benefit of sharing a MockClient?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

bq. What would be the benefit of sharing a MockClient?
Just saying (smile)

I'm fine to change the assertion.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

When do we decrement this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Does it need a way to decrement the count of a class used for testing?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I may have misunderstood the intent. I thought it was meant to count in-flight requests, but seems it is a total count instead?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

bq. seems it is a total count instead?
yep. used only for testing so it should be fine without decrement call

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think a total count is fine. Maybe name it totalRequestCount to make it obvious that that is what it is.

As @hachikuji commented, there is really no need to share a MockAdminClient across multiple tests. The mock client is extremely lightweight-- it doesn't manage any threads or sockets.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, totalRequestCount sounds clearer. We might also consider setting it back to 0 in MockClient.reset.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks for all reviews. Will address the following comments

  1. requestCount -> totalRequestCount
  2. set totalRequestCount to zero in MockClient.reset

@chia7712
chia7712 force-pushed the invalid_DeleteTopicsRequest branch from 27dc6dc to 029bc8d Compare March 28, 2018 07:03
@chia7712
chia7712 force-pushed the invalid_DeleteTopicsRequest branch from 029bc8d to 81130c2 Compare March 28, 2018 17:33

@hachikuji hachikuji left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Thanks for the patch!

@hachikuji
hachikuji merged commit 53d4267 into apache:trunk Apr 5, 2018
ying-zheng pushed a commit to ying-zheng/kafka that referenced this pull request Jul 6, 2018
…ache#4763)

The invalid topic name is already handled locally so it is unnecessary to send the DeleteTopicsRequest. This PR adds a count to MockClient for testing.

Reviewers: Colin Patrick McCabe <colin@cmccabe.xyz>, Jason Gustafson <jason@confluent.io>
@chia7712
chia7712 deleted the invalid_DeleteTopicsRequest branch March 25, 2024 15:23
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