Use random ports for embedded redis
MODIFY
dd-java-agent/instrumentation/jedis-1.4/src/test/groovy/JedisClientTest.groovy
dd-java-agent/instrumentation/jedis-1.4/src/test/groovy/JedisClientTest.groovy
import datadog.trace.agent.test.AgentTestRunner
+import datadog.trace.agent.test.utils.PortUtils
import datadog.trace.api.Config
import datadog.trace.api.DDSpanTypes
import datadog.trace.instrumentation.api.Tags
@@ -8,7 +9,8 @@ import spock.lang.Shared
class JedisClientTest extends AgentTestRunner {
- public static final int PORT = 6399
+ @Shared
+ int port = PortUtils.randomOpenPort()
@Shared
RedisServer redisServer = RedisServer.builder()
@@ -16,9 +18,9 @@ class JedisClientTest extends AgentTestRunner {
.setting("bind 127.0.0.1")
// set max memory to avoid problems in CI
.setting("maxmemory 128M")
- .port(PORT).build()
+ .port(port).build()
@Shared
- Jedis jedis = new Jedis("localhost", PORT)
+ Jedis jedis = new Jedis("localhost", port)
def setupSpec() {
println "Using redis: $redisServer.args"

MODIFY
dd-java-agent/instrumentation/jedis-3.0/src/test/groovy/Jedis30ClientTest.groovy
dd-java-agent/instrumentation/jedis-3.0/src/test/groovy/Jedis30ClientTest.groovy
import datadog.trace.agent.test.AgentTestRunner
+import datadog.trace.agent.test.utils.PortUtils
import datadog.trace.api.Config
import datadog.trace.api.DDSpanTypes
import datadog.trace.instrumentation.api.Tags
@@ -8,7 +9,8 @@ import spock.lang.Shared
class Jedis30ClientTest extends AgentTestRunner {
- public static final int PORT = 6399
+ @Shared
+ int port = PortUtils.randomOpenPort()
@Shared
RedisServer redisServer = RedisServer.builder()
@@ -16,9 +18,9 @@ class Jedis30ClientTest extends AgentTestRunner {
.setting("bind 127.0.0.1")
// set max memory to avoid problems in CI
.setting("maxmemory 128M")
- .port(PORT).build()
+ .port(port).build()
@Shared
- Jedis jedis = new Jedis("localhost", PORT)
+ Jedis jedis = new Jedis("localhost", port)
def setupSpec() {
println "Using redis: $redisServer.args"

Use random ports for embedded redis