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

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


The following commit(s) were added to refs/heads/master by this push:
     new 9b34e27d7 KNOX-3069 - Fix Flakey Test - TokenServiceResourceTest (#938)
9b34e27d7 is described below

commit 9b34e27d76b1f79b0c2039384edf97bfb32e01c9
Author: lmccay <[email protected]>
AuthorDate: Fri Oct 11 13:17:39 2024 -0400

    KNOX-3069 - Fix Flakey Test - TokenServiceResourceTest (#938)
---
 .../knox/gateway/service/knoxtoken/TokenServiceResourceTest.java   | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/gateway-service-knoxtoken/src/test/java/org/apache/knox/gateway/service/knoxtoken/TokenServiceResourceTest.java
 
b/gateway-service-knoxtoken/src/test/java/org/apache/knox/gateway/service/knoxtoken/TokenServiceResourceTest.java
index b3798bdd7..dc68117b6 100644
--- 
a/gateway-service-knoxtoken/src/test/java/org/apache/knox/gateway/service/knoxtoken/TokenServiceResourceTest.java
+++ 
b/gateway-service-knoxtoken/src/test/java/org/apache/knox/gateway/service/knoxtoken/TokenServiceResourceTest.java
@@ -1136,8 +1136,13 @@ public class TokenServiceResourceTest {
       tss.addMetadata(tokenId, tokenMetadata);
     }
 
+    ArrayList<String> tokenIDs = new ArrayList<>();
     for (int i = 0; i < numberOfTokens; i++) {
-      acquireToken(tr);
+      final Response tokenResponse = acquireToken(tr);
+      final String tokenId = getTagValue(tokenResponse.getEntity().toString(), 
"token_id");
+      assertNotNull("TokenID should not be null", tokenId);
+      assertFalse("TokenID must be unique", tokenIDs.contains(tokenId));
+      tokenIDs.add(tokenId);
     }
     final Response getKnoxTokensResponse = getUserTokensResponse(tr);
     final Collection<String> tokens = ((Map<String, Collection<String>>) 
JsonUtils.getObjectFromJsonString(getKnoxTokensResponse.getEntity().toString()))

Reply via email to