chihsuan opened a new pull request, #10534:
URL: https://github.com/apache/ozone/pull/10534
## What changes were proposed in this pull request?
`TestSecureOzoneCluster#testDelegationTokenRenewal` fails intermittently. The
server checks token expiry (`maxDate < now`, throwing `TOKEN_EXPIRED`)
before it
checks the renewer, in `OzoneDelegationTokenSecretManager#renewToken`. The
test
set the delegation token max lifetime to only 1 second, so on a slow or
loaded
host the renewer-mismatch token could expire in the window between being
issued
and the renewal reaching the server. The renewal then failed with
`TOKEN_EXPIRED` instead of the expected renewer-mismatch error, so the
assertion
on `"Delegation token renewal failed"` did not hold.
This patch removes the time dependence from the test:
- Use a generous (60s) delegation token max lifetime so the renewer-mismatch
and
tampered-token cases cannot race token expiry.
- Trigger the expiry case deterministically by presenting a token whose
`maxDate` is already in the past (reusing the existing tampered-token
pattern),
instead of `Thread.sleep`-ing for the token to age out. This also removes
a 1s
sleep, so the test is slightly faster.
No production code is changed; the renewal logic was already correct.
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-15298
## How was this patch tested?
- Reproduced the original failure deterministically on the unmodified test by
forcing a stall before the renewer-mismatch renewal, yielding the exact
reported `TOKEN_EXPIRED` assertion failure.
- Verified the fix by injecting a 3s stall (3x the old lifetime) at the same
point: the test passes, proving the race window is closed.
- Ran `TestSecureOzoneCluster#testDelegationTokenRenewal` repeatedly; the
timing
failure never recurred.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]