BewareMyPower opened a new pull request, #23602:
URL: https://github.com/apache/pulsar/pull/23602

   ### 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: 
https://github.com/apache/pulsar/blob/0b0eef905c3a6ebe8a6fbb284743d98c8e97d5b8/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authorization/PulsarAuthorizationProvider.java#L718
   
   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
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update 
later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository:


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to