Replace embedded Redis server with testcontainers in tests (#3011)
* Replace embedded Redis server with testcontainers in tests * Update instrumentation/lettuce/lettuce-5.0/javaagent/src/test/groovy/LettuceReactiveClientTest.groovy Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com> Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
This commit is contained in:
parent
bcfd6b4d67
commit
3ecce72298
|
@ -12,8 +12,6 @@ muzzle {
|
||||||
dependencies {
|
dependencies {
|
||||||
library "redis.clients:jedis:1.4.0"
|
library "redis.clients:jedis:1.4.0"
|
||||||
|
|
||||||
testImplementation "com.github.kstyrc:embedded-redis:0.6"
|
|
||||||
|
|
||||||
// Jedis 3.0 has API changes that prevent instrumentation from applying
|
// Jedis 3.0 has API changes that prevent instrumentation from applying
|
||||||
latestDepTestLibrary "redis.clients:jedis:2.+"
|
latestDepTestLibrary "redis.clients:jedis:2.+"
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,30 +6,25 @@
|
||||||
import static io.opentelemetry.api.trace.SpanKind.CLIENT
|
import static io.opentelemetry.api.trace.SpanKind.CLIENT
|
||||||
|
|
||||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||||
import io.opentelemetry.instrumentation.test.utils.PortUtils
|
|
||||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||||
|
import org.testcontainers.containers.GenericContainer
|
||||||
import redis.clients.jedis.Jedis
|
import redis.clients.jedis.Jedis
|
||||||
import redis.embedded.RedisServer
|
|
||||||
import spock.lang.Shared
|
import spock.lang.Shared
|
||||||
|
|
||||||
class JedisClientTest extends AgentInstrumentationSpecification {
|
class JedisClientTest extends AgentInstrumentationSpecification {
|
||||||
|
|
||||||
@Shared
|
private static GenericContainer redisServer = new GenericContainer<>("redis:6.2.3-alpine").withExposedPorts(6379)
|
||||||
int port = PortUtils.findOpenPort()
|
|
||||||
|
|
||||||
@Shared
|
@Shared
|
||||||
RedisServer redisServer = RedisServer.builder()
|
int port
|
||||||
// bind to localhost to avoid firewall popup
|
|
||||||
.setting("bind 127.0.0.1")
|
|
||||||
// set max memory to avoid problems in CI
|
|
||||||
.setting("maxmemory 128M")
|
|
||||||
.port(port).build()
|
|
||||||
@Shared
|
@Shared
|
||||||
Jedis jedis = new Jedis("localhost", port)
|
Jedis jedis
|
||||||
|
|
||||||
def setupSpec() {
|
def setupSpec() {
|
||||||
println "Using redis: $redisServer.args"
|
|
||||||
redisServer.start()
|
redisServer.start()
|
||||||
|
port = redisServer.getMappedPort(6379)
|
||||||
|
jedis = new Jedis("localhost", port)
|
||||||
}
|
}
|
||||||
|
|
||||||
def cleanupSpec() {
|
def cleanupSpec() {
|
||||||
|
|
|
@ -17,7 +17,6 @@ muzzle {
|
||||||
dependencies {
|
dependencies {
|
||||||
library "redis.clients:jedis:3.0.0"
|
library "redis.clients:jedis:3.0.0"
|
||||||
|
|
||||||
testImplementation "com.github.kstyrc:embedded-redis:0.6"
|
|
||||||
// ensures jedis-1.4 instrumentation does not load with jedis 3.0+ by failing
|
// ensures jedis-1.4 instrumentation does not load with jedis 3.0+ by failing
|
||||||
// the tests in the event it does. The tests will end up with double spans
|
// the tests in the event it does. The tests will end up with double spans
|
||||||
testInstrumentation project(':instrumentation:jedis:jedis-1.4:javaagent')
|
testInstrumentation project(':instrumentation:jedis:jedis-1.4:javaagent')
|
||||||
|
|
|
@ -6,30 +6,25 @@
|
||||||
import static io.opentelemetry.api.trace.SpanKind.CLIENT
|
import static io.opentelemetry.api.trace.SpanKind.CLIENT
|
||||||
|
|
||||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||||
import io.opentelemetry.instrumentation.test.utils.PortUtils
|
|
||||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||||
|
import org.testcontainers.containers.GenericContainer
|
||||||
import redis.clients.jedis.Jedis
|
import redis.clients.jedis.Jedis
|
||||||
import redis.embedded.RedisServer
|
|
||||||
import spock.lang.Shared
|
import spock.lang.Shared
|
||||||
|
|
||||||
class Jedis30ClientTest extends AgentInstrumentationSpecification {
|
class Jedis30ClientTest extends AgentInstrumentationSpecification {
|
||||||
|
|
||||||
@Shared
|
private static GenericContainer redisServer = new GenericContainer<>("redis:6.2.3-alpine").withExposedPorts(6379)
|
||||||
int port = PortUtils.findOpenPort()
|
|
||||||
|
|
||||||
@Shared
|
@Shared
|
||||||
RedisServer redisServer = RedisServer.builder()
|
int port
|
||||||
// bind to localhost to avoid firewall popup
|
|
||||||
.setting("bind 127.0.0.1")
|
|
||||||
// set max memory to avoid problems in CI
|
|
||||||
.setting("maxmemory 128M")
|
|
||||||
.port(port).build()
|
|
||||||
@Shared
|
@Shared
|
||||||
Jedis jedis = new Jedis("localhost", port)
|
Jedis jedis
|
||||||
|
|
||||||
def setupSpec() {
|
def setupSpec() {
|
||||||
println "Using redis: $redisServer.args"
|
|
||||||
redisServer.start()
|
redisServer.start()
|
||||||
|
port = redisServer.getMappedPort(6379)
|
||||||
|
jedis = new Jedis("localhost", port)
|
||||||
}
|
}
|
||||||
|
|
||||||
def cleanupSpec() {
|
def cleanupSpec() {
|
||||||
|
|
|
@ -13,8 +13,6 @@ muzzle {
|
||||||
dependencies {
|
dependencies {
|
||||||
library "biz.paluch.redis:lettuce:4.0.Final"
|
library "biz.paluch.redis:lettuce:4.0.Final"
|
||||||
|
|
||||||
testImplementation "com.github.kstyrc:embedded-redis:0.6"
|
|
||||||
|
|
||||||
latestDepTestLibrary "biz.paluch.redis:lettuce:4.+"
|
latestDepTestLibrary "biz.paluch.redis:lettuce:4.+"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ import java.util.function.BiConsumer
|
||||||
import java.util.function.BiFunction
|
import java.util.function.BiFunction
|
||||||
import java.util.function.Consumer
|
import java.util.function.Consumer
|
||||||
import java.util.function.Function
|
import java.util.function.Function
|
||||||
import redis.embedded.RedisServer
|
import org.testcontainers.containers.FixedHostPortGenericContainer
|
||||||
import spock.lang.Shared
|
import spock.lang.Shared
|
||||||
import spock.util.concurrent.AsyncConditions
|
import spock.util.concurrent.AsyncConditions
|
||||||
|
|
||||||
|
@ -35,6 +35,8 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification {
|
||||||
// Disable autoreconnect so we do not get stray traces popping up on server shutdown
|
// Disable autoreconnect so we do not get stray traces popping up on server shutdown
|
||||||
public static final ClientOptions CLIENT_OPTIONS = new ClientOptions.Builder().autoReconnect(false).build()
|
public static final ClientOptions CLIENT_OPTIONS = new ClientOptions.Builder().autoReconnect(false).build()
|
||||||
|
|
||||||
|
private static FixedHostPortGenericContainer redisServer = new FixedHostPortGenericContainer<>("redis:6.2.3-alpine")
|
||||||
|
|
||||||
@Shared
|
@Shared
|
||||||
int port
|
int port
|
||||||
@Shared
|
@Shared
|
||||||
|
@ -48,9 +50,6 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification {
|
||||||
@Shared
|
@Shared
|
||||||
String embeddedDbUri
|
String embeddedDbUri
|
||||||
|
|
||||||
@Shared
|
|
||||||
RedisServer redisServer
|
|
||||||
|
|
||||||
@Shared
|
@Shared
|
||||||
Map<String, String> testHashMap = [
|
Map<String, String> testHashMap = [
|
||||||
firstname: "John",
|
firstname: "John",
|
||||||
|
@ -71,18 +70,12 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification {
|
||||||
dbUriNonExistent = "redis://" + dbAddrNonExistent
|
dbUriNonExistent = "redis://" + dbAddrNonExistent
|
||||||
embeddedDbUri = "redis://" + dbAddr
|
embeddedDbUri = "redis://" + dbAddr
|
||||||
|
|
||||||
redisServer = RedisServer.builder()
|
redisServer = redisServer.withFixedExposedPort(port, 6379)
|
||||||
// bind to localhost to avoid firewall popup
|
|
||||||
.setting("bind " + HOST)
|
|
||||||
// set max memory to avoid problems in CI
|
|
||||||
.setting("maxmemory 128M")
|
|
||||||
.port(port).build()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def setup() {
|
def setup() {
|
||||||
redisClient = RedisClient.create(embeddedDbUri)
|
redisClient = RedisClient.create(embeddedDbUri)
|
||||||
|
|
||||||
println "Using redis: $redisServer.args"
|
|
||||||
redisServer.start()
|
redisServer.start()
|
||||||
redisClient.setOptions(CLIENT_OPTIONS)
|
redisClient.setOptions(CLIENT_OPTIONS)
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ import com.lambdaworks.redis.api.sync.RedisCommands
|
||||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||||
import io.opentelemetry.instrumentation.test.utils.PortUtils
|
import io.opentelemetry.instrumentation.test.utils.PortUtils
|
||||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||||
import redis.embedded.RedisServer
|
import org.testcontainers.containers.FixedHostPortGenericContainer
|
||||||
import spock.lang.Shared
|
import spock.lang.Shared
|
||||||
|
|
||||||
class LettuceSyncClientTest extends AgentInstrumentationSpecification {
|
class LettuceSyncClientTest extends AgentInstrumentationSpecification {
|
||||||
|
@ -23,6 +23,8 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification {
|
||||||
// Disable autoreconnect so we do not get stray traces popping up on server shutdown
|
// Disable autoreconnect so we do not get stray traces popping up on server shutdown
|
||||||
public static final ClientOptions CLIENT_OPTIONS = new ClientOptions.Builder().autoReconnect(false).build()
|
public static final ClientOptions CLIENT_OPTIONS = new ClientOptions.Builder().autoReconnect(false).build()
|
||||||
|
|
||||||
|
private static FixedHostPortGenericContainer redis = new FixedHostPortGenericContainer<>("redis:6.2.3-alpine")
|
||||||
|
|
||||||
@Shared
|
@Shared
|
||||||
int port
|
int port
|
||||||
@Shared
|
@Shared
|
||||||
|
@ -36,9 +38,6 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification {
|
||||||
@Shared
|
@Shared
|
||||||
String embeddedDbUri
|
String embeddedDbUri
|
||||||
|
|
||||||
@Shared
|
|
||||||
RedisServer redisServer
|
|
||||||
|
|
||||||
@Shared
|
@Shared
|
||||||
Map<String, String> testHashMap = [
|
Map<String, String> testHashMap = [
|
||||||
firstname: "John",
|
firstname: "John",
|
||||||
|
@ -58,18 +57,15 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification {
|
||||||
dbUriNonExistent = "redis://" + dbAddrNonExistent
|
dbUriNonExistent = "redis://" + dbAddrNonExistent
|
||||||
embeddedDbUri = "redis://" + dbAddr
|
embeddedDbUri = "redis://" + dbAddr
|
||||||
|
|
||||||
redisServer = RedisServer.builder()
|
redis = redis.withFixedExposedPort(port, 6379)
|
||||||
// bind to localhost to avoid firewall popup
|
|
||||||
.setting("bind " + HOST)
|
|
||||||
// set max memory to avoid problems in CI
|
|
||||||
.setting("maxmemory 128M")
|
|
||||||
.port(port).build()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def setup() {
|
def setup() {
|
||||||
|
//TODO do not restart server for every test
|
||||||
|
redis.start()
|
||||||
|
|
||||||
redisClient = RedisClient.create(embeddedDbUri)
|
redisClient = RedisClient.create(embeddedDbUri)
|
||||||
|
|
||||||
redisServer.start()
|
|
||||||
connection = redisClient.connect()
|
connection = redisClient.connect()
|
||||||
syncCommands = connection.sync()
|
syncCommands = connection.sync()
|
||||||
|
|
||||||
|
@ -82,7 +78,7 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification {
|
||||||
|
|
||||||
def cleanup() {
|
def cleanup() {
|
||||||
connection.close()
|
connection.close()
|
||||||
redisServer.stop()
|
redis.stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
def "connect"() {
|
def "connect"() {
|
||||||
|
|
|
@ -14,7 +14,6 @@ dependencies {
|
||||||
|
|
||||||
implementation project(':instrumentation:lettuce:lettuce-common:library')
|
implementation project(':instrumentation:lettuce:lettuce-common:library')
|
||||||
|
|
||||||
testImplementation "com.github.kstyrc:embedded-redis:0.6"
|
|
||||||
testImplementation "io.lettuce:lettuce-core:5.0.0.RELEASE"
|
testImplementation "io.lettuce:lettuce-core:5.0.0.RELEASE"
|
||||||
testInstrumentation project(':instrumentation:reactor-3.1:javaagent')
|
testInstrumentation project(':instrumentation:reactor-3.1:javaagent')
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ import java.util.function.BiConsumer
|
||||||
import java.util.function.BiFunction
|
import java.util.function.BiFunction
|
||||||
import java.util.function.Consumer
|
import java.util.function.Consumer
|
||||||
import java.util.function.Function
|
import java.util.function.Function
|
||||||
import redis.embedded.RedisServer
|
import org.testcontainers.containers.FixedHostPortGenericContainer
|
||||||
import spock.lang.Shared
|
import spock.lang.Shared
|
||||||
import spock.util.concurrent.AsyncConditions
|
import spock.util.concurrent.AsyncConditions
|
||||||
|
|
||||||
|
@ -38,6 +38,8 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification {
|
||||||
// Disable autoreconnect so we do not get stray traces popping up on server shutdown
|
// Disable autoreconnect so we do not get stray traces popping up on server shutdown
|
||||||
public static final ClientOptions CLIENT_OPTIONS = ClientOptions.builder().autoReconnect(false).build()
|
public static final ClientOptions CLIENT_OPTIONS = ClientOptions.builder().autoReconnect(false).build()
|
||||||
|
|
||||||
|
private static FixedHostPortGenericContainer redisServer = new FixedHostPortGenericContainer<>("redis:6.2.3-alpine")
|
||||||
|
|
||||||
@Shared
|
@Shared
|
||||||
int port
|
int port
|
||||||
@Shared
|
@Shared
|
||||||
|
@ -51,9 +53,6 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification {
|
||||||
@Shared
|
@Shared
|
||||||
String embeddedDbUri
|
String embeddedDbUri
|
||||||
|
|
||||||
@Shared
|
|
||||||
RedisServer redisServer
|
|
||||||
|
|
||||||
@Shared
|
@Shared
|
||||||
Map<String, String> testHashMap = [
|
Map<String, String> testHashMap = [
|
||||||
firstname: "John",
|
firstname: "John",
|
||||||
|
@ -74,18 +73,12 @@ class LettuceAsyncClientTest extends AgentInstrumentationSpecification {
|
||||||
dbUriNonExistent = "redis://" + dbAddrNonExistent
|
dbUriNonExistent = "redis://" + dbAddrNonExistent
|
||||||
embeddedDbUri = "redis://" + dbAddr
|
embeddedDbUri = "redis://" + dbAddr
|
||||||
|
|
||||||
redisServer = RedisServer.builder()
|
redisServer = redisServer.withFixedExposedPort(port, 6379)
|
||||||
// bind to localhost to avoid firewall popup
|
|
||||||
.setting("bind " + PEER_NAME)
|
|
||||||
// set max memory to avoid problems in CI
|
|
||||||
.setting("maxmemory 128M")
|
|
||||||
.port(port).build()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def setup() {
|
def setup() {
|
||||||
redisClient = RedisClient.create(embeddedDbUri)
|
redisClient = RedisClient.create(embeddedDbUri)
|
||||||
|
|
||||||
println "Using redis: $redisServer.args"
|
|
||||||
redisServer.start()
|
redisServer.start()
|
||||||
redisClient.setOptions(CLIENT_OPTIONS)
|
redisClient.setOptions(CLIENT_OPTIONS)
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,8 @@ import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||||
import io.opentelemetry.instrumentation.test.utils.PortUtils
|
import io.opentelemetry.instrumentation.test.utils.PortUtils
|
||||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||||
import java.util.function.Consumer
|
import java.util.function.Consumer
|
||||||
|
import org.testcontainers.containers.FixedHostPortGenericContainer
|
||||||
import reactor.core.scheduler.Schedulers
|
import reactor.core.scheduler.Schedulers
|
||||||
import redis.embedded.RedisServer
|
|
||||||
import spock.lang.Shared
|
import spock.lang.Shared
|
||||||
import spock.util.concurrent.AsyncConditions
|
import spock.util.concurrent.AsyncConditions
|
||||||
|
|
||||||
|
@ -27,11 +27,11 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification {
|
||||||
// Disable autoreconnect so we do not get stray traces popping up on server shutdown
|
// Disable autoreconnect so we do not get stray traces popping up on server shutdown
|
||||||
public static final ClientOptions CLIENT_OPTIONS = ClientOptions.builder().autoReconnect(false).build()
|
public static final ClientOptions CLIENT_OPTIONS = ClientOptions.builder().autoReconnect(false).build()
|
||||||
|
|
||||||
|
private static FixedHostPortGenericContainer redisServer = new FixedHostPortGenericContainer<>("redis:6.2.3-alpine")
|
||||||
|
|
||||||
@Shared
|
@Shared
|
||||||
String embeddedDbUri
|
String embeddedDbUri
|
||||||
|
|
||||||
@Shared
|
|
||||||
RedisServer redisServer
|
|
||||||
|
|
||||||
RedisClient redisClient
|
RedisClient redisClient
|
||||||
StatefulConnection connection
|
StatefulConnection connection
|
||||||
|
@ -43,18 +43,12 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification {
|
||||||
String dbAddr = PEER_HOST + ":" + port + "/" + DB_INDEX
|
String dbAddr = PEER_HOST + ":" + port + "/" + DB_INDEX
|
||||||
embeddedDbUri = "redis://" + dbAddr
|
embeddedDbUri = "redis://" + dbAddr
|
||||||
|
|
||||||
redisServer = RedisServer.builder()
|
redisServer = redisServer.withFixedExposedPort(port, 6379)
|
||||||
// bind to localhost to avoid firewall popup
|
|
||||||
.setting("bind " + PEER_HOST)
|
|
||||||
// set max memory to avoid problems in CI
|
|
||||||
.setting("maxmemory 128M")
|
|
||||||
.port(port).build()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def setup() {
|
def setup() {
|
||||||
redisClient = RedisClient.create(embeddedDbUri)
|
redisClient = RedisClient.create(embeddedDbUri)
|
||||||
|
|
||||||
println "Using redis: $redisServer.args"
|
|
||||||
redisServer.start()
|
redisServer.start()
|
||||||
redisClient.setOptions(CLIENT_OPTIONS)
|
redisClient.setOptions(CLIENT_OPTIONS)
|
||||||
|
|
||||||
|
@ -201,7 +195,7 @@ class LettuceReactiveClientTest extends AgentInstrumentationSpecification {
|
||||||
attributes {
|
attributes {
|
||||||
"$SemanticAttributes.DB_SYSTEM.key" "redis"
|
"$SemanticAttributes.DB_SYSTEM.key" "redis"
|
||||||
"$SemanticAttributes.DB_STATEMENT.key" "COMMAND"
|
"$SemanticAttributes.DB_STATEMENT.key" "COMMAND"
|
||||||
"lettuce.command.results.count" 157
|
"lettuce.command.results.count" { it > 100 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import io.netty.channel.AbstractChannel
|
||||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||||
import io.opentelemetry.instrumentation.test.utils.PortUtils
|
import io.opentelemetry.instrumentation.test.utils.PortUtils
|
||||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||||
import redis.embedded.RedisServer
|
import org.testcontainers.containers.FixedHostPortGenericContainer
|
||||||
import spock.lang.Shared
|
import spock.lang.Shared
|
||||||
|
|
||||||
class LettuceSyncClientTest extends AgentInstrumentationSpecification {
|
class LettuceSyncClientTest extends AgentInstrumentationSpecification {
|
||||||
|
@ -25,6 +25,8 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification {
|
||||||
// Disable autoreconnect so we do not get stray traces popping up on server shutdown
|
// Disable autoreconnect so we do not get stray traces popping up on server shutdown
|
||||||
public static final ClientOptions CLIENT_OPTIONS = ClientOptions.builder().autoReconnect(false).build()
|
public static final ClientOptions CLIENT_OPTIONS = ClientOptions.builder().autoReconnect(false).build()
|
||||||
|
|
||||||
|
private static FixedHostPortGenericContainer redisServer = new FixedHostPortGenericContainer<>("redis:6.2.3-alpine")
|
||||||
|
|
||||||
@Shared
|
@Shared
|
||||||
int port
|
int port
|
||||||
@Shared
|
@Shared
|
||||||
|
@ -38,9 +40,6 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification {
|
||||||
@Shared
|
@Shared
|
||||||
String embeddedDbUri
|
String embeddedDbUri
|
||||||
|
|
||||||
@Shared
|
|
||||||
RedisServer redisServer
|
|
||||||
|
|
||||||
@Shared
|
@Shared
|
||||||
Map<String, String> testHashMap = [
|
Map<String, String> testHashMap = [
|
||||||
firstname: "John",
|
firstname: "John",
|
||||||
|
@ -60,12 +59,7 @@ class LettuceSyncClientTest extends AgentInstrumentationSpecification {
|
||||||
dbUriNonExistent = "redis://" + dbAddrNonExistent
|
dbUriNonExistent = "redis://" + dbAddrNonExistent
|
||||||
embeddedDbUri = "redis://" + dbAddr
|
embeddedDbUri = "redis://" + dbAddr
|
||||||
|
|
||||||
redisServer = RedisServer.builder()
|
redisServer = redisServer.withFixedExposedPort(port, 6379)
|
||||||
// bind to localhost to avoid firewall popup
|
|
||||||
.setting("bind " + PEER_NAME)
|
|
||||||
// set max memory to avoid problems in CI
|
|
||||||
.setting("maxmemory 128M")
|
|
||||||
.port(port).build()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def setup() {
|
def setup() {
|
||||||
|
|
|
@ -16,7 +16,6 @@ dependencies {
|
||||||
|
|
||||||
testImplementation project(':instrumentation:lettuce:lettuce-5.1:testing')
|
testImplementation project(':instrumentation:lettuce:lettuce-5.1:testing')
|
||||||
|
|
||||||
testImplementation "com.github.kstyrc:embedded-redis:0.6"
|
|
||||||
// Only 5.2+ will have command arguments in the db.statement tag.
|
// Only 5.2+ will have command arguments in the db.statement tag.
|
||||||
testLibrary "io.lettuce:lettuce-core:5.2.0.RELEASE"
|
testLibrary "io.lettuce:lettuce-core:5.2.0.RELEASE"
|
||||||
testInstrumentation project(':instrumentation:reactor-3.1:javaagent')
|
testInstrumentation project(':instrumentation:reactor-3.1:javaagent')
|
||||||
|
|
|
@ -5,8 +5,7 @@ dependencies {
|
||||||
|
|
||||||
api "io.lettuce:lettuce-core:5.1.0.RELEASE"
|
api "io.lettuce:lettuce-core:5.1.0.RELEASE"
|
||||||
|
|
||||||
api "com.github.kstyrc:embedded-redis:0.6"
|
implementation deps.testcontainers
|
||||||
|
|
||||||
implementation deps.guava
|
implementation deps.guava
|
||||||
|
|
||||||
implementation deps.groovy
|
implementation deps.groovy
|
||||||
|
|
|
@ -25,7 +25,7 @@ import java.util.function.BiConsumer
|
||||||
import java.util.function.BiFunction
|
import java.util.function.BiFunction
|
||||||
import java.util.function.Consumer
|
import java.util.function.Consumer
|
||||||
import java.util.function.Function
|
import java.util.function.Function
|
||||||
import redis.embedded.RedisServer
|
import org.testcontainers.containers.FixedHostPortGenericContainer
|
||||||
import spock.lang.Shared
|
import spock.lang.Shared
|
||||||
import spock.util.concurrent.AsyncConditions
|
import spock.util.concurrent.AsyncConditions
|
||||||
|
|
||||||
|
@ -33,6 +33,8 @@ abstract class AbstractLettuceAsyncClientTest extends InstrumentationSpecificati
|
||||||
public static final String HOST = "127.0.0.1"
|
public static final String HOST = "127.0.0.1"
|
||||||
public static final int DB_INDEX = 0
|
public static final int DB_INDEX = 0
|
||||||
|
|
||||||
|
private static FixedHostPortGenericContainer redisServer = new FixedHostPortGenericContainer<>("redis:6.2.3-alpine")
|
||||||
|
|
||||||
abstract RedisClient createClient(String uri)
|
abstract RedisClient createClient(String uri)
|
||||||
|
|
||||||
@Shared
|
@Shared
|
||||||
|
@ -48,9 +50,6 @@ abstract class AbstractLettuceAsyncClientTest extends InstrumentationSpecificati
|
||||||
@Shared
|
@Shared
|
||||||
String embeddedDbUri
|
String embeddedDbUri
|
||||||
|
|
||||||
@Shared
|
|
||||||
RedisServer redisServer
|
|
||||||
|
|
||||||
@Shared
|
@Shared
|
||||||
Map<String, String> testHashMap = [
|
Map<String, String> testHashMap = [
|
||||||
firstname: "John",
|
firstname: "John",
|
||||||
|
@ -71,18 +70,12 @@ abstract class AbstractLettuceAsyncClientTest extends InstrumentationSpecificati
|
||||||
dbUriNonExistent = "redis://" + dbAddrNonExistent
|
dbUriNonExistent = "redis://" + dbAddrNonExistent
|
||||||
embeddedDbUri = "redis://" + dbAddr
|
embeddedDbUri = "redis://" + dbAddr
|
||||||
|
|
||||||
redisServer = RedisServer.builder()
|
redisServer = redisServer.withFixedExposedPort(port, 6379)
|
||||||
// bind to localhost to avoid firewall popup
|
|
||||||
.setting("bind " + HOST)
|
|
||||||
// set max memory to avoid problems in CI
|
|
||||||
.setting("maxmemory 128M")
|
|
||||||
.port(port).build()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def setup() {
|
def setup() {
|
||||||
redisClient = createClient(embeddedDbUri)
|
redisClient = createClient(embeddedDbUri)
|
||||||
|
|
||||||
println "Using redis: $redisServer.args"
|
|
||||||
redisServer.start()
|
redisServer.start()
|
||||||
redisClient.setOptions(LettuceTestUtil.CLIENT_OPTIONS)
|
redisClient.setOptions(LettuceTestUtil.CLIENT_OPTIONS)
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ import io.opentelemetry.instrumentation.test.InstrumentationSpecification
|
||||||
import io.opentelemetry.instrumentation.test.utils.PortUtils
|
import io.opentelemetry.instrumentation.test.utils.PortUtils
|
||||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||||
import java.util.function.Consumer
|
import java.util.function.Consumer
|
||||||
import redis.embedded.RedisServer
|
import org.testcontainers.containers.FixedHostPortGenericContainer
|
||||||
import spock.lang.Shared
|
import spock.lang.Shared
|
||||||
import spock.util.concurrent.AsyncConditions
|
import spock.util.concurrent.AsyncConditions
|
||||||
|
|
||||||
|
@ -25,6 +25,8 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific
|
||||||
public static final String HOST = "127.0.0.1"
|
public static final String HOST = "127.0.0.1"
|
||||||
public static final int DB_INDEX = 0
|
public static final int DB_INDEX = 0
|
||||||
|
|
||||||
|
private static FixedHostPortGenericContainer redisServer = new FixedHostPortGenericContainer<>("redis:6.2.3-alpine")
|
||||||
|
|
||||||
abstract RedisClient createClient(String uri)
|
abstract RedisClient createClient(String uri)
|
||||||
|
|
||||||
@Shared
|
@Shared
|
||||||
|
@ -32,9 +34,6 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific
|
||||||
@Shared
|
@Shared
|
||||||
String embeddedDbUri
|
String embeddedDbUri
|
||||||
|
|
||||||
@Shared
|
|
||||||
RedisServer redisServer
|
|
||||||
|
|
||||||
RedisClient redisClient
|
RedisClient redisClient
|
||||||
StatefulConnection connection
|
StatefulConnection connection
|
||||||
RedisReactiveCommands<String, ?> reactiveCommands
|
RedisReactiveCommands<String, ?> reactiveCommands
|
||||||
|
@ -45,18 +44,12 @@ abstract class AbstractLettuceReactiveClientTest extends InstrumentationSpecific
|
||||||
String dbAddr = HOST + ":" + port + "/" + DB_INDEX
|
String dbAddr = HOST + ":" + port + "/" + DB_INDEX
|
||||||
embeddedDbUri = "redis://" + dbAddr
|
embeddedDbUri = "redis://" + dbAddr
|
||||||
|
|
||||||
redisServer = RedisServer.builder()
|
redisServer = redisServer.withFixedExposedPort(port, 6379)
|
||||||
// bind to localhost to avoid firewall popup
|
|
||||||
.setting("bind " + HOST)
|
|
||||||
// set max memory to avoid problems in CI
|
|
||||||
.setting("maxmemory 128M")
|
|
||||||
.port(port).build()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def setup() {
|
def setup() {
|
||||||
redisClient = createClient(embeddedDbUri)
|
redisClient = createClient(embeddedDbUri)
|
||||||
|
|
||||||
println "Using redis: $redisServer.args"
|
|
||||||
redisServer.start()
|
redisServer.start()
|
||||||
redisClient.setOptions(LettuceTestUtil.CLIENT_OPTIONS)
|
redisClient.setOptions(LettuceTestUtil.CLIENT_OPTIONS)
|
||||||
|
|
||||||
|
|
|
@ -12,13 +12,15 @@ import io.lettuce.core.RedisClient
|
||||||
import io.opentelemetry.instrumentation.test.InstrumentationSpecification
|
import io.opentelemetry.instrumentation.test.InstrumentationSpecification
|
||||||
import io.opentelemetry.instrumentation.test.utils.PortUtils
|
import io.opentelemetry.instrumentation.test.utils.PortUtils
|
||||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||||
import redis.embedded.RedisServer
|
import org.testcontainers.containers.FixedHostPortGenericContainer
|
||||||
import spock.lang.Shared
|
import spock.lang.Shared
|
||||||
|
|
||||||
abstract class AbstractLettuceSyncClientAuthTest extends InstrumentationSpecification {
|
abstract class AbstractLettuceSyncClientAuthTest extends InstrumentationSpecification {
|
||||||
public static final String HOST = "127.0.0.1"
|
public static final String HOST = "127.0.0.1"
|
||||||
public static final int DB_INDEX = 0
|
public static final int DB_INDEX = 0
|
||||||
|
|
||||||
|
private static FixedHostPortGenericContainer redisServer = new FixedHostPortGenericContainer<>("redis:6.2.3-alpine")
|
||||||
|
|
||||||
abstract RedisClient createClient(String uri)
|
abstract RedisClient createClient(String uri)
|
||||||
|
|
||||||
@Shared
|
@Shared
|
||||||
|
@ -30,9 +32,6 @@ abstract class AbstractLettuceSyncClientAuthTest extends InstrumentationSpecific
|
||||||
@Shared
|
@Shared
|
||||||
String embeddedDbUri
|
String embeddedDbUri
|
||||||
|
|
||||||
@Shared
|
|
||||||
RedisServer redisServer
|
|
||||||
|
|
||||||
RedisClient redisClient
|
RedisClient redisClient
|
||||||
|
|
||||||
def setupSpec() {
|
def setupSpec() {
|
||||||
|
@ -41,14 +40,9 @@ abstract class AbstractLettuceSyncClientAuthTest extends InstrumentationSpecific
|
||||||
embeddedDbUri = "redis://" + dbAddr
|
embeddedDbUri = "redis://" + dbAddr
|
||||||
password = "password"
|
password = "password"
|
||||||
|
|
||||||
redisServer = RedisServer.builder()
|
redisServer = redisServer
|
||||||
// bind to localhost to avoid firewall popup
|
.withFixedExposedPort(port, 6379)
|
||||||
.setting("bind " + HOST)
|
.withCommand("redis-server", "--requirepass $password")
|
||||||
// set max memory to avoid problems in CI
|
|
||||||
.setting("maxmemory 128M")
|
|
||||||
// Set password
|
|
||||||
.setting("requirepass " + password)
|
|
||||||
.port(port).build()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def setup() {
|
def setup() {
|
||||||
|
|
|
@ -19,13 +19,15 @@ import io.lettuce.core.api.sync.RedisCommands
|
||||||
import io.opentelemetry.instrumentation.test.InstrumentationSpecification
|
import io.opentelemetry.instrumentation.test.InstrumentationSpecification
|
||||||
import io.opentelemetry.instrumentation.test.utils.PortUtils
|
import io.opentelemetry.instrumentation.test.utils.PortUtils
|
||||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||||
import redis.embedded.RedisServer
|
import org.testcontainers.containers.FixedHostPortGenericContainer
|
||||||
import spock.lang.Shared
|
import spock.lang.Shared
|
||||||
|
|
||||||
abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecification {
|
abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecification {
|
||||||
public static final String HOST = "127.0.0.1"
|
public static final String HOST = "127.0.0.1"
|
||||||
public static final int DB_INDEX = 0
|
public static final int DB_INDEX = 0
|
||||||
|
|
||||||
|
private static FixedHostPortGenericContainer redisServer = new FixedHostPortGenericContainer<>("redis:6.2.3-alpine")
|
||||||
|
|
||||||
abstract RedisClient createClient(String uri)
|
abstract RedisClient createClient(String uri)
|
||||||
|
|
||||||
@Shared
|
@Shared
|
||||||
|
@ -43,9 +45,6 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio
|
||||||
@Shared
|
@Shared
|
||||||
String embeddedDbLocalhostUri
|
String embeddedDbLocalhostUri
|
||||||
|
|
||||||
@Shared
|
|
||||||
RedisServer redisServer
|
|
||||||
|
|
||||||
@Shared
|
@Shared
|
||||||
Map<String, String> testHashMap = [
|
Map<String, String> testHashMap = [
|
||||||
firstname: "John",
|
firstname: "John",
|
||||||
|
@ -66,12 +65,7 @@ abstract class AbstractLettuceSyncClientTest extends InstrumentationSpecificatio
|
||||||
embeddedDbUri = "redis://" + dbAddr
|
embeddedDbUri = "redis://" + dbAddr
|
||||||
embeddedDbLocalhostUri = "redis://localhost:" + port + "/" + DB_INDEX
|
embeddedDbLocalhostUri = "redis://localhost:" + port + "/" + DB_INDEX
|
||||||
|
|
||||||
redisServer = RedisServer.builder()
|
redisServer = redisServer.withFixedExposedPort(port, 6379)
|
||||||
// bind to localhost to avoid firewall popup
|
|
||||||
.setting("bind " + HOST)
|
|
||||||
// set max memory to avoid problems in CI
|
|
||||||
.setting("maxmemory 128M")
|
|
||||||
.port(port).build()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def setup() {
|
def setup() {
|
||||||
|
|
|
@ -46,6 +46,4 @@ muzzle {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
library "com.github.etaty:rediscala_2.11:1.8.0"
|
library "com.github.etaty:rediscala_2.11:1.8.0"
|
||||||
|
|
||||||
testImplementation "com.github.kstyrc:embedded-redis:0.6"
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,13 +7,12 @@ import static io.opentelemetry.api.trace.SpanKind.CLIENT
|
||||||
|
|
||||||
import akka.actor.ActorSystem
|
import akka.actor.ActorSystem
|
||||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||||
import io.opentelemetry.instrumentation.test.utils.PortUtils
|
|
||||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||||
|
import org.testcontainers.containers.GenericContainer
|
||||||
import redis.ByteStringDeserializerDefault
|
import redis.ByteStringDeserializerDefault
|
||||||
import redis.ByteStringSerializerLowPriority
|
import redis.ByteStringSerializerLowPriority
|
||||||
import redis.RedisClient
|
import redis.RedisClient
|
||||||
import redis.RedisDispatcher
|
import redis.RedisDispatcher
|
||||||
import redis.embedded.RedisServer
|
|
||||||
import scala.Option
|
import scala.Option
|
||||||
import scala.concurrent.Await
|
import scala.concurrent.Await
|
||||||
import scala.concurrent.duration.Duration
|
import scala.concurrent.duration.Duration
|
||||||
|
@ -21,16 +20,10 @@ import spock.lang.Shared
|
||||||
|
|
||||||
class RediscalaClientTest extends AgentInstrumentationSpecification {
|
class RediscalaClientTest extends AgentInstrumentationSpecification {
|
||||||
|
|
||||||
@Shared
|
private static GenericContainer redisServer = new GenericContainer<>("redis:6.2.3-alpine").withExposedPorts(6379)
|
||||||
int port = PortUtils.findOpenPort()
|
|
||||||
|
|
||||||
@Shared
|
@Shared
|
||||||
RedisServer redisServer = RedisServer.builder()
|
int port
|
||||||
// bind to localhost to avoid firewall popup
|
|
||||||
.setting("bind 127.0.0.1")
|
|
||||||
// set max memory to avoid problems in CI
|
|
||||||
.setting("maxmemory 128M")
|
|
||||||
.port(port).build()
|
|
||||||
|
|
||||||
@Shared
|
@Shared
|
||||||
ActorSystem system
|
ActorSystem system
|
||||||
|
@ -39,6 +32,8 @@ class RediscalaClientTest extends AgentInstrumentationSpecification {
|
||||||
RedisClient redisClient
|
RedisClient redisClient
|
||||||
|
|
||||||
def setupSpec() {
|
def setupSpec() {
|
||||||
|
redisServer.start()
|
||||||
|
port = redisServer.getMappedPort(6379)
|
||||||
system = ActorSystem.create()
|
system = ActorSystem.create()
|
||||||
redisClient = new RedisClient("localhost",
|
redisClient = new RedisClient("localhost",
|
||||||
port,
|
port,
|
||||||
|
@ -48,9 +43,6 @@ class RediscalaClientTest extends AgentInstrumentationSpecification {
|
||||||
Option.apply(null),
|
Option.apply(null),
|
||||||
system,
|
system,
|
||||||
new RedisDispatcher("rediscala.rediscala-client-worker-dispatcher"))
|
new RedisDispatcher("rediscala.rediscala-client-worker-dispatcher"))
|
||||||
|
|
||||||
println "Using redis: $redisServer.args"
|
|
||||||
redisServer.start()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def cleanupSpec() {
|
def cleanupSpec() {
|
||||||
|
|
|
@ -10,7 +10,6 @@ muzzle {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
library "org.redisson:redisson:3.0.0"
|
library "org.redisson:redisson:3.0.0"
|
||||||
testImplementation "com.github.kstyrc:embedded-redis:0.6"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
import static io.opentelemetry.api.trace.SpanKind.CLIENT
|
import static io.opentelemetry.api.trace.SpanKind.CLIENT
|
||||||
|
|
||||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||||
import io.opentelemetry.instrumentation.test.utils.PortUtils
|
|
||||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import org.redisson.Redisson
|
import org.redisson.Redisson
|
||||||
|
@ -17,33 +16,28 @@ import org.redisson.api.RSet
|
||||||
import org.redisson.api.RedissonClient
|
import org.redisson.api.RedissonClient
|
||||||
import org.redisson.config.Config
|
import org.redisson.config.Config
|
||||||
import org.redisson.config.SingleServerConfig
|
import org.redisson.config.SingleServerConfig
|
||||||
import redis.embedded.RedisServer
|
import org.testcontainers.containers.GenericContainer
|
||||||
import spock.lang.Shared
|
import spock.lang.Shared
|
||||||
|
|
||||||
class RedissonAsyncClientTest extends AgentInstrumentationSpecification {
|
class RedissonAsyncClientTest extends AgentInstrumentationSpecification {
|
||||||
|
|
||||||
|
private static GenericContainer redisServer = new GenericContainer<>("redis:6.2.3-alpine").withExposedPorts(6379)
|
||||||
@Shared
|
@Shared
|
||||||
int port = PortUtils.findOpenPort()
|
int port
|
||||||
|
|
||||||
@Shared
|
|
||||||
RedisServer redisServer = RedisServer.builder()
|
|
||||||
// bind to localhost to avoid firewall popup
|
|
||||||
.setting("bind 127.0.0.1")
|
|
||||||
// set max memory to avoid problems in CI
|
|
||||||
.setting("maxmemory 128M")
|
|
||||||
.port(port).build()
|
|
||||||
@Shared
|
@Shared
|
||||||
RedissonClient redisson
|
RedissonClient redisson
|
||||||
@Shared
|
@Shared
|
||||||
String address = "localhost:" + port
|
String address
|
||||||
|
|
||||||
def setupSpec() {
|
def setupSpec() {
|
||||||
|
redisServer.start()
|
||||||
|
port = redisServer.getMappedPort(6379)
|
||||||
|
address = "localhost:" + port
|
||||||
if (Boolean.getBoolean("testLatestDeps")) {
|
if (Boolean.getBoolean("testLatestDeps")) {
|
||||||
// Newer versions of redisson require scheme, older versions forbid it
|
// Newer versions of redisson require scheme, older versions forbid it
|
||||||
address = "redis://" + address
|
address = "redis://" + address
|
||||||
}
|
}
|
||||||
println "Using redis: $redisServer.args"
|
|
||||||
redisServer.start()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def cleanupSpec() {
|
def cleanupSpec() {
|
||||||
|
|
|
@ -8,7 +8,6 @@ import static java.util.regex.Pattern.compile
|
||||||
import static java.util.regex.Pattern.quote
|
import static java.util.regex.Pattern.quote
|
||||||
|
|
||||||
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
import io.opentelemetry.instrumentation.test.AgentInstrumentationSpecification
|
||||||
import io.opentelemetry.instrumentation.test.utils.PortUtils
|
|
||||||
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes
|
||||||
import org.redisson.Redisson
|
import org.redisson.Redisson
|
||||||
import org.redisson.api.RAtomicLong
|
import org.redisson.api.RAtomicLong
|
||||||
|
@ -22,33 +21,28 @@ import org.redisson.api.RSet
|
||||||
import org.redisson.api.RedissonClient
|
import org.redisson.api.RedissonClient
|
||||||
import org.redisson.config.Config
|
import org.redisson.config.Config
|
||||||
import org.redisson.config.SingleServerConfig
|
import org.redisson.config.SingleServerConfig
|
||||||
import redis.embedded.RedisServer
|
import org.testcontainers.containers.GenericContainer
|
||||||
import spock.lang.Shared
|
import spock.lang.Shared
|
||||||
|
|
||||||
class RedissonClientTest extends AgentInstrumentationSpecification {
|
class RedissonClientTest extends AgentInstrumentationSpecification {
|
||||||
|
|
||||||
|
private static GenericContainer redisServer = new GenericContainer<>("redis:6.2.3-alpine").withExposedPorts(6379)
|
||||||
@Shared
|
@Shared
|
||||||
int port = PortUtils.findOpenPort()
|
int port
|
||||||
|
|
||||||
@Shared
|
|
||||||
RedisServer redisServer = RedisServer.builder()
|
|
||||||
// bind to localhost to avoid firewall popup
|
|
||||||
.setting("bind 127.0.0.1")
|
|
||||||
// set max memory to avoid problems in CI
|
|
||||||
.setting("maxmemory 128M")
|
|
||||||
.port(port).build()
|
|
||||||
@Shared
|
@Shared
|
||||||
RedissonClient redisson
|
RedissonClient redisson
|
||||||
@Shared
|
@Shared
|
||||||
String address = "localhost:" + port
|
String address
|
||||||
|
|
||||||
def setupSpec() {
|
def setupSpec() {
|
||||||
|
redisServer.start()
|
||||||
|
port = redisServer.getMappedPort(6379)
|
||||||
|
address = "localhost:" + port
|
||||||
if (Boolean.getBoolean("testLatestDeps")) {
|
if (Boolean.getBoolean("testLatestDeps")) {
|
||||||
// Newer versions of redisson require scheme, older versions forbid it
|
// Newer versions of redisson require scheme, older versions forbid it
|
||||||
address = "redis://" + address
|
address = "redis://" + address
|
||||||
}
|
}
|
||||||
println "Using redis: $redisServer.args"
|
|
||||||
redisServer.start()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def cleanupSpec() {
|
def cleanupSpec() {
|
||||||
|
|
Loading…
Reference in New Issue