[TEST] Do not call RandomizedTest.scaledRandomIntBetween from multiple threads

KeyedLockTests calls RandomizedTest.scaledRandomIntBetween from multiple threads which uses RandomizedTest.isNightly()
whereas that method is not concurrency-safe (see implementation of GroupEvaluator.isGroupEnabled)
This commit is contained in:
Yannick Welsch 2018-01-11 16:42:12 +01:00
parent 626c3d1fda
commit 52d627b66f
1 changed files with 1 additions and 1 deletions

View File

@ -116,6 +116,7 @@ public class KeyedLockTests extends ESTestCase {
String[] names;
ConcurrentHashMap<String, Integer> counter;
ConcurrentHashMap<String, AtomicInteger> safeCounter;
final int numRuns = scaledRandomIntBetween(5000, 50000);
public AcquireAndReleaseThread(CountDownLatch startLatch, KeyedLock<String> connectionLock, String[] names,
ConcurrentHashMap<String, Integer> counter, ConcurrentHashMap<String, AtomicInteger> safeCounter) {
@ -133,7 +134,6 @@ public class KeyedLockTests extends ESTestCase {
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
int numRuns = scaledRandomIntBetween(5000, 50000);
for (int i = 0; i < numRuns; i++) {
String curName = names[randomInt(names.length - 1)];
assert connectionLock.isHeldByCurrentThread(curName) == false;