Vicky677 opened a new pull request, #23989:
URL: https://github.com/apache/kafka/pull/23989

   ### Add unit tests for CredentialProvider and DelegationTokenManager
   
   #### Motivation
   
   `CredentialProvider` and `DelegationTokenManager` in `server-common` had no 
unit
   test coverage.
   
   #### Changes
   
   **`CredentialProviderTest`** (11 tests)
   
   - Credential cache creation for all registered mechanisms, single mechanism, 
and
     no mechanisms
   - `updateCredential` for SHA-256 and SHA-512, overwrite, and isolation 
between
     users
   - `removeCredentials` for present entry, absent user, absent cache, and 
isolation
     between users
   - `DelegationTokenCache` construction isolated with `MockedConstruction` — 
tests
     exercise `CredentialProvider` only
   
   **`DelegationTokenManagerTest`** (20 tests)
   
   - `isEnabled` with and without a secret key
   - `createHmac` — determinism, key/id variance, `InvalidKeyException` path,
     general exception path
   - `getDelegationToken`, `updateToken`, `removeToken`, `getTokens` with filter
     variants
   - `filterToken` — owner, renewer, stranger, authorization by token id / 
owner,
     requested-owners filter
   - `DelegationTokenManagerConfigs` mocked directly (stubbing only
     `tokenAuthEnabled` + `delegationTokenSecretKey`), removing 
`AbstractConfig`/
     `ConfigDef` from test setup
   - `DelegationTokenCache` kept as a real instance so cache-state assertions
     reflect actual behaviour
   - Replaced fully-qualified `org.mockito.Mockito.doThrow` /
     `org.mockito.ArgumentMatchers.any` with static imports


-- 
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