Fix redisson Nightly build (#1150)

* Fix redisson Nightly build

* Set a property affecting the URL when testing latest deps

* Add comments

* Fix review
This commit is contained in:
dengliming 2020-09-02 18:18:09 +08:00 committed by GitHub
parent 7ec06e2d26
commit 256865146c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 4 deletions

View File

@ -17,3 +17,7 @@ dependencies {
library group: 'org.redisson', name: 'redisson', version: '3.0.0'
testImplementation group: 'com.github.kstyrc', name: 'embedded-redis', version: '0.6'
}
test {
systemProperty "testLatestDeps", testLatestDeps
}

View File

@ -43,6 +43,9 @@ public class RedissonClientTracer extends DatabaseClientTracer<RedisConnection,
for (CommandData commandData : commands) {
commandStrings.append(commandData.getCommand().getName()).append(";");
}
if (commandStrings.length() > 0) {
commandStrings.deleteCharAt(commandStrings.length() - 1);
}
return commandStrings.toString();
} else if (args instanceof CommandData) {
return ((CommandData) args).getCommand().getName();

View File

@ -42,8 +42,14 @@ class RedissonAsyncClientTest extends AgentTestRunner {
.port(port).build()
@Shared
RedissonClient redisson
@Shared
String address = "localhost:" + port
def setupSpec() {
if (Boolean.getBoolean("testLatestDeps")) {
// Newer versions of redisson require scheme, older versions forbid it
address = "redis://" + address
}
println "Using redis: $redisServer.args"
redisServer.start()
}
@ -55,7 +61,7 @@ class RedissonAsyncClientTest extends AgentTestRunner {
def setup() {
Config config = new Config()
config.useSingleServer().setAddress("localhost:" + port)
config.useSingleServer().setAddress(address)
redisson = Redisson.create(config)
TEST_WRITER.clear()
}

View File

@ -47,8 +47,14 @@ class RedissonClientTest extends AgentTestRunner {
.port(port).build()
@Shared
RedissonClient redisson
@Shared
String address = "localhost:" + port
def setupSpec() {
if (Boolean.getBoolean("testLatestDeps")) {
// Newer versions of redisson require scheme, older versions forbid it
address = "redis://" + address
}
println "Using redis: $redisServer.args"
redisServer.start()
}
@ -60,7 +66,7 @@ class RedissonClientTest extends AgentTestRunner {
def setup() {
Config config = new Config()
config.useSingleServer().setAddress("localhost:" + port)
config.useSingleServer().setAddress(address)
redisson = Redisson.create(config)
TEST_WRITER.clear()
}
@ -113,7 +119,7 @@ class RedissonClientTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 1) {
span(0) {
operationName "SET;SET;"
operationName "SET;SET"
spanKind CLIENT
attributes {
"${SemanticAttributes.DB_SYSTEM.key()}" "redis"
@ -121,7 +127,7 @@ class RedissonClientTest extends AgentTestRunner {
"${SemanticAttributes.NET_PEER_NAME.key()}" "localhost"
"${SemanticAttributes.DB_CONNECTION_STRING.key()}" "localhost:$port"
"${SemanticAttributes.NET_PEER_PORT.key()}" port
"${SemanticAttributes.DB_STATEMENT.key()}" "SET;SET;"
"${SemanticAttributes.DB_STATEMENT.key()}" "SET;SET"
}
}
}