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

[fix][broker] Fix failed TokenAuthenticatedProducerConsumerTest #23602

Merged

Conversation

BewareMyPower
Copy link
Contributor

Motivation

TokenAuthenticatedProducerConsumerTest cannot pass the test. The root cause is that when a namespace does not exist and the client carries a token without correct permission, the client would fail with AuthorizationException but not TopicDoesNotExistException.

It's because PulsarAuthorizationProvider#validateTenantAdminAccess will fail exceptionally by NotFoundException here:

However, when the namespace does not exist, this exception won't be thrown. If testTopicNotFound was running after testTokenProducerAndConsumer, the "my-property" tenant would be created so it would fail.

However, the CI somehow passed and I see 1 test was skipped.

Warning:  Tests run: 6, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 22.034 s - in org.apache.pulsar.client.api.TokenAuthenticatedProducerConsumerTest

Modifications

Change the test from testTopicNotFound to testTenantNotExist and use a tenant that does not exist.

Regarding the case when the namespace does not exist, we might need another PR for it.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov-commenter
Copy link

codecov-commenter commented Nov 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.33%. Comparing base (bbc6224) to head (1928598).
Report is 734 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #23602      +/-   ##
============================================
+ Coverage     73.57%   74.33%   +0.76%     
- Complexity    32624    34437    +1813     
============================================
  Files          1877     1944      +67     
  Lines        139502   147127    +7625     
  Branches      15299    16225     +926     
============================================
+ Hits         102638   109372    +6734     
- Misses        28908    29313     +405     
- Partials       7956     8442     +486     
Flag Coverage Δ
inttests 27.71% <ø> (+3.13%) ⬆️
systests 24.36% <ø> (+0.04%) ⬆️
unittests 73.71% <ø> (+0.86%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 653 files with indirect coverage changes

---- 🚨 Try these New Features:

@BewareMyPower BewareMyPower merged commit 2715853 into apache:master Nov 18, 2024
58 of 60 checks passed
@BewareMyPower BewareMyPower deleted the bewaremypower/fix-token-tests branch November 18, 2024 02:18
lhotari pushed a commit that referenced this pull request Nov 18, 2024
lhotari pushed a commit that referenced this pull request Nov 18, 2024
lhotari pushed a commit that referenced this pull request Nov 18, 2024
nikhil-ctds pushed a commit to datastax/pulsar that referenced this pull request Nov 20, 2024
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants