This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new fa1b3a35f18 HDDS-15298. Fix intermittent failure in 
testDelegationTokenRenewal (#10534)
fa1b3a35f18 is described below

commit fa1b3a35f18c14d40c32dca7bb2595c69276dd3a
Author: Chi-Hsuan Huang <[email protected]>
AuthorDate: Thu Jun 18 17:06:30 2026 +0800

    HDDS-15298. Fix intermittent failure in testDelegationTokenRenewal (#10534)
---
 .../org/apache/hadoop/ozone/TestSecureOzoneCluster.java | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git 
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestSecureOzoneCluster.java
 
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestSecureOzoneCluster.java
index 42856d846fe..3379167c1ca 100644
--- 
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestSecureOzoneCluster.java
+++ 
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/TestSecureOzoneCluster.java
@@ -650,9 +650,9 @@ void testDelegationTokenRenewal() throws Exception {
       // Start SCM
       scm.start();
 
-      // Setup secure OM for start.
-      int tokenMaxLifetime = 1000;
-      conf.setLong(DELEGATION_TOKEN_MAX_LIFETIME_KEY, tokenMaxLifetime);
+      // Setup secure OM for start.  Generous token lifetime so the renewer and
+      // tampered-token cases below do not race token expiry.
+      conf.setLong(DELEGATION_TOKEN_MAX_LIFETIME_KEY, 60 * 1000L);
       setupOm(conf);
       OzoneManager.setTestSecureOmFlag(true);
       om.setCertClient(new CertificateClientTestImpl(conf));
@@ -683,10 +683,15 @@ void testDelegationTokenRenewal() throws Exception {
       omLogs.clearOutput();
 
       // Test failure of delegation renewal
-      // 1. When token maxExpiryTime exceeds
-      Thread.sleep(tokenMaxLifetime);
+      // 1. When token maxExpiryTime exceeds (maxDate in the past)
+      OzoneTokenIdentifier expiredId = OzoneTokenIdentifier.readProtoBuf(
+          token.getIdentifier());
+      expiredId.setMaxDate(System.currentTimeMillis() - 1000);
+      Token<OzoneTokenIdentifier> expiredToken = new Token<>(
+          expiredId.getBytes(), token.getPassword(), token.getKind(),
+          token.getService());
       OMException ex = assertThrows(OMException.class,
-          () -> omClient.renewDelegationToken(token));
+          () -> omClient.renewDelegationToken(expiredToken));
       assertEquals(TOKEN_EXPIRED, ex.getResult());
       omLogs.clearOutput();
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to