You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by cs...@apache.org on 2022/12/01 11:45:04 UTC

[accumulo] branch main updated: Fix flaky AuthenticationTokenSecretManagerTest (#3099)

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

cshannon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/main by this push:
     new 9e8964aeaa Fix flaky AuthenticationTokenSecretManagerTest (#3099)
9e8964aeaa is described below

commit 9e8964aeaa026e34d7eca4a0304bb0aa9f5e94e1
Author: Christopher L. Shannon <ch...@gmail.com>
AuthorDate: Thu Dec 1 06:44:57 2022 -0500

    Fix flaky AuthenticationTokenSecretManagerTest (#3099)
    
    Fix flaky AuthenticationTokenSecretManagerTest
    
    Part of the ID of the generated token is the issue date which is the
    current time in millis so this adds a 100 millisecond sleep in between
    token generation to guarantee the tokens will be unique.
    
    This fixes #3075
    
    Co-authored-by: Christopher Tubbs <ct...@apache.org>
---
 .../security/delegation/AuthenticationTokenSecretManagerTest.java       | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/server/base/src/test/java/org/apache/accumulo/server/security/delegation/AuthenticationTokenSecretManagerTest.java b/server/base/src/test/java/org/apache/accumulo/server/security/delegation/AuthenticationTokenSecretManagerTest.java
index d30afce00d..8a7b6ea7bf 100644
--- a/server/base/src/test/java/org/apache/accumulo/server/security/delegation/AuthenticationTokenSecretManagerTest.java
+++ b/server/base/src/test/java/org/apache/accumulo/server/security/delegation/AuthenticationTokenSecretManagerTest.java
@@ -208,6 +208,8 @@ public class AuthenticationTokenSecretManagerTest extends WithTestNames {
     assertArrayEquals(password, secretManager.retrievePassword(id));
 
     // Make a second token for the same user
+    // Briefly sleep to guarantee token is unique, since the token is based on the time
+    Thread.sleep(100);
     Entry<Token<AuthenticationTokenIdentifier>,AuthenticationTokenIdentifier> pair2 =
         secretManager.generateToken(principal, cfg);
     Token<AuthenticationTokenIdentifier> token2 = pair2.getKey();