[ https://issues.apache.org/jira/browse/KNOX-3069?focusedWorklogId=937626&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-937626 ]
ASF GitHub Bot logged work on KNOX-3069: ---------------------------------------- Author: ASF GitHub Bot Created on: 11/Oct/24 16:40 Start Date: 11/Oct/24 16:40 Worklog Time Spent: 10m Work Description: lmccay opened a new pull request, #938: URL: https://github.com/apache/knox/pull/938 ## What changes were proposed in this pull request? TokenServiceResourceTest - testLimitingTokensPerUser method acquires many tokens within a tight for loop and does not insure that the tokenIds are unique. This results in test failures for the unlimited tokens per user on certain machines. This may also point to a larger concurrency problem which needs investigation. Will file a separate JIRA for this. This may be an issue with the test or the UUID use for the tokenID in general. In the meantime, we can't have builds failing on certain machines. This change interrogates the response and adds an assertion to ensure that the tokenId is unique. It seems the time spent in doing the check "fixes" the failures. The same "fix" was accomplished with a sleep of 1ms between token acquisitions. ## How was this patch tested? Prior to this fix the following test failure was encountered for every run on my local machine: [ERROR] Tests run: 60, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.113 s <<< FAILURE! - in org.apache.knox.gateway.service.knoxtoken.TokenServiceResourceTest [ERROR] testUnlimitedTokensPerUser(org.apache.knox.gateway.service.knoxtoken.TokenServiceResourceTest) Time elapsed: 0.118 s <<< FAILURE! java.lang.AssertionError: expected:<94> but was:<105> at org.apache.knox.gateway.service.knoxtoken.TokenServiceResourceTest.testLimitingTokensPerUser(TokenServiceResourceTest.java:1145) at org.apache.knox.gateway.service.knoxtoken.TokenServiceResourceTest.testLimitingTokensPerUser(TokenServiceResourceTest.java:1110) at org.apache.knox.gateway.service.knoxtoken.TokenServiceResourceTest.testUnlimitedTokensPerUser(TokenServiceResourceTest.java:1046) This change looks for the root cause of the failure but also introduces a time lag between token acquisitions such that the tokenIDs are indeed unique. Issue Time Tracking ------------------- Worklog Id: (was: 937626) Remaining Estimate: 0h Time Spent: 10m > Flakey Test - TokenServiceResourceTest > -------------------------------------- > > Key: KNOX-3069 > URL: https://issues.apache.org/jira/browse/KNOX-3069 > Project: Apache Knox > Issue Type: Bug > Components: JWT > Reporter: Larry McCay > Priority: Minor > Time Spent: 10m > Remaining Estimate: 0h > > TokenServiceResourceTest - testLimitingTokensPerUser method acquires many > tokens within a tight for loop and does not insure that the tokenIds are > unique. > This results in test failures for the unlimited tokens per user on certain > machines. > This may also point to a larger concurrency problem which needs > investigation. Will file a separate JIRA for this. This may be an issue with > the test or the UUID use for the tokenID in general. In the meantime, we > can't have builds failing on certain machines. > This change interrogates the response and adds an assertion to ensure that > the tokenId is unique. It seems the time spent in doing the check "fixes" the > failures. The same "fix" was accomplished with a sleep of 1ms between token > acquisitions. -- This message was sent by Atlassian Jira (v8.20.10#820010)