From 88f1dab8b531c12f8096906677819901ddfe6a30 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Tue, 23 Jun 2020 16:02:13 -0700 Subject: [PATCH] Fix long/int precision for test baseport calculation --- .../src/main/java/org/elasticsearch/test/ESTestCase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/framework/src/main/java/org/elasticsearch/test/ESTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/ESTestCase.java index d9e21a4a976..1bca44986e4 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/ESTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/ESTestCase.java @@ -1439,7 +1439,7 @@ public abstract class ESTestCase extends LuceneTestCase { // increases this value, so the mod can eventually become zero, thus we shift on both sides by 1 final long workerId = Long.valueOf(workerIdStr); assert workerId >= 1 : "Non positive gradle worker id: " + workerIdStr; - startAt = Math.floorMod(workerId - 1, 223) + 1; + startAt = (int) Math.floorMod(workerId - 1, 223L) + 1; } assert startAt >= 0 : "Unexpected test worker Id, resulting port range would be negative"; return 10300 + (startAt * 100);