Skip to content

Commit 505fd84

Browse files
Use Redis 7.2 for build.
Update jenkinsfile to test against redis 7.2 Replace usage of DEBUG command. Provide Redis server version and client lib version to maven build system / gradle cache. Original Pull Request: #2802
1 parent 4da3169 commit 505fd84

11 files changed

+78
-15
lines changed

Jenkinsfile

+38
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,26 @@ pipeline {
4040
}
4141
}
4242
}
43+
stage('Publish JDK 17 + Redis 7.2 Docker Image') {
44+
when {
45+
anyOf {
46+
changeset "ci/openjdk17-redis-7.2/Dockerfile"
47+
changeset "Makefile"
48+
changeset "ci/pipeline.properties"
49+
}
50+
}
51+
agent { label 'data' }
52+
options { timeout(time: 20, unit: 'MINUTES') }
53+
54+
steps {
55+
script {
56+
def image = docker.build("springci/spring-data-with-redis-7.2:${p['java.main.tag']}", "--build-arg BASE=${p['docker.java.main.image']} --build-arg REDIS=${p['docker.redis.7.version']} -f ci/openjdk17-redis-7.2/Dockerfile .")
57+
docker.withRegistry(p['docker.registry'], p['docker.credentials']) {
58+
image.push()
59+
}
60+
}
61+
}
62+
}
4363
stage('Publish JDK 21 + Redis 6.2 Docker Image') {
4464
when {
4565
anyOf {
@@ -134,6 +154,24 @@ pipeline {
134154
}
135155
}
136156
}
157+
stage("test: Redis 7") {
158+
agent {
159+
label 'data'
160+
}
161+
options { timeout(time: 30, unit: 'MINUTES') }
162+
environment {
163+
ARTIFACTORY = credentials("${p['artifactory.credentials']}")
164+
DEVELOCITY_CACHE = credentials("${p['develocity.cache.credentials']}")
165+
DEVELOCITY_ACCESS_KEY = credentials("${p['develocity.access-key']}")
166+
}
167+
steps {
168+
script {
169+
docker.image("harbor-repo.vmware.com/dockerhub-proxy-cache/springci/spring-data-with-redis-7.2:${p['java.main.tag']}").inside('-v $HOME:/tmp/jenkins-home') {
170+
sh "PROFILE=none LONG_TESTS=true JENKINS_USER_NAME=${p['jenkins.user.name']} ci/test.sh"
171+
}
172+
}
173+
}
174+
}
137175
}
138176
}
139177

Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
REDIS_VERSION:=6.2.6
15+
REDIS_VERSION:=7.2.4
1616
SPRING_PROFILE?=ci
1717
SHELL=/bin/bash -euo pipefail
1818

@@ -175,7 +175,7 @@ clobber:
175175
work/redis/bin/redis-cli work/redis/bin/redis-server:
176176
@mkdir -p work/redis
177177

178-
curl -sSL https://github.com/antirez/redis/archive/$(REDIS_VERSION).tar.gz | tar xzf - -C work
178+
curl -sSL https://github.com/redis/redis/archive/$(REDIS_VERSION).tar.gz | tar xzf - -C work
179179
$(MAKE) -C work/redis-$(REDIS_VERSION) -j
180180
$(MAKE) -C work/redis-$(REDIS_VERSION) PREFIX=$(shell pwd)/work/redis install
181181
rm -rf work/redis-$(REDIS_VERSION)
@@ -196,14 +196,14 @@ stop: redis-stop sentinel-stop cluster-stop
196196
test:
197197
$(MAKE) start
198198
sleep 1
199-
./mvnw clean test -U -P$(SPRING_PROFILE) || (echo "maven failed $$?"; exit 1)
199+
./mvnw clean test -U -P$(SPRING_PROFILE) -Dredis.server.version=$(REDIS_VERSION) || (echo "maven failed $$?"; exit 1)
200200
$(MAKE) stop
201201
$(MAKE) clean
202202

203203
all-tests:
204204
$(MAKE) start
205205
sleep 1
206-
./mvnw clean test -U -DrunLongTests=true -P$(SPRING_PROFILE) || (echo "maven failed $$?"; exit 1)
206+
./mvnw clean test -U -DrunLongTests=true -P$(SPRING_PROFILE) -Dredis.server.version=$(REDIS_VERSION) || (echo "maven failed $$?"; exit 1)
207207
$(MAKE) stop
208208
$(MAKE) clean
209209

ci/openjdk17-redis-7.2/Dockerfile

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
ARG BASE
2+
FROM ${BASE}
3+
# Any ARG statements before FROM are cleared.
4+
ARG REDIS
5+
ENV REDIS_VERSION=${REDIS}
6+
7+
# Copy Spring Data Redis's Makefile into the container
8+
COPY ./Makefile /
9+
10+
RUN set -eux; \
11+
# sed -i -e 's/http/https/g' /etc/apt/sources.list ; \
12+
apt-get update ; \
13+
apt-get install -y build-essential ; \
14+
make work/redis/bin/redis-cli work/redis/bin/redis-server REDIS_VERSION=${REDIS}; \
15+
chmod -R o+rw work; \
16+
apt-get clean; \
17+
rm -rf /var/lib/apt/lists/*;

ci/pipeline.properties

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ docker.mongodb.7.0.version=7.0.2
1414

1515
# Supported versions of Redis
1616
docker.redis.6.version=6.2.13
17+
docker.redis.7.version=7.2.4
1718

1819
# Supported versions of Cassandra
1920
docker.cassandra.3.version=3.11.16

ci/test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export JENKINS_USER=${JENKINS_USER_NAME}
1818
export GRADLE_ENTERPRISE_ACCESS_KEY=${DEVELOCITY_ACCESS_KEY}
1919

2020
# Execute maven test
21-
MAVEN_OPTS="-Duser.name=${JENKINS_USER} -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml clean test -P${PROFILE} -DrunLongTests=${LONG_TESTS:-false} -U -B
21+
MAVEN_OPTS="-Duser.name=${JENKINS_USER} -Duser.home=/tmp/jenkins-home" ./mvnw -s settings.xml clean test -P${PROFILE} -DrunLongTests=${LONG_TESTS:-false} -Dredis.server.version=${REDIS_VERSION:-unknown} -U -B
2222

2323
# Capture resulting exit code from maven (pass/fail)
2424
RESULT=$?

pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,11 @@
297297
<groupId>org.apache.maven.plugins</groupId>
298298
<artifactId>maven-surefire-plugin</artifactId>
299299
<configuration>
300+
<systemPropertyVariables>
301+
<redis.server.version>${redis.server.version}</redis.server.version>
302+
<lettuce>${lettuce}</lettuce>
303+
<jedis>${jedis}</jedis>
304+
</systemPropertyVariables>
300305
<!-- Retain stack traces -->
301306
<argLine>-XX:-OmitStackTraceInFastThrow</argLine>
302307
<useSystemClassLoader>false</useSystemClassLoader>

src/test/java/org/springframework/data/redis/connection/AbstractConnectionIntegrationTests.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@
2828
import static org.springframework.data.redis.connection.RedisGeoCommands.GeoSearchStoreCommandArgs.*;
2929
import static org.springframework.data.redis.core.ScanOptions.*;
3030

31+
import java.nio.charset.StandardCharsets;
3132
import java.time.Duration;
3233
import java.time.Instant;
3334
import java.time.temporal.ChronoUnit;
3435
import java.util.*;
3536
import java.util.concurrent.BlockingDeque;
3637
import java.util.concurrent.LinkedBlockingDeque;
3738
import java.util.concurrent.TimeUnit;
39+
import java.util.stream.IntStream;
3840

3941
import org.assertj.core.data.Offset;
4042
import org.junit.AssumptionViolatedException;
@@ -2661,10 +2663,11 @@ private static List<String> toList(Cursor<byte[]> cursor) {
26612663
}
26622664

26632665
@Test // DATAREDIS-417
2664-
@DisabledOnOs(value = MAC, architectures = "aarch64")
2665-
public void scanShouldReadEntireValueRangeWhenIdividualScanIterationsReturnEmptyCollection() {
2666+
public void scanShouldReadEntireValueRangeWhenIndividualScanIterationsReturnEmptyCollection() {
26662667

2667-
connection.execute("DEBUG", "POPULATE".getBytes(), "100".getBytes());
2668+
byteConnection.openPipeline();
2669+
IntStream.range(0, 100).forEach(it -> byteConnection.stringCommands().set("key:%s".formatted(it).getBytes(StandardCharsets.UTF_8), "data".getBytes(StandardCharsets.UTF_8)));
2670+
byteConnection.closePipeline();
26682671

26692672
Cursor<byte[]> cursor = connection.scan(ScanOptions.scanOptions().match("key*9").count(10).build());
26702673

src/test/java/org/springframework/data/redis/connection/AbstractConnectionPipelineIntegrationTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ public void testClosePipelineNotOpen() {
149149
@Test // DATAREDIS-417
150150
@Disabled
151151
@Override
152-
public void scanShouldReadEntireValueRangeWhenIdividualScanIterationsReturnEmptyCollection() {
153-
super.scanShouldReadEntireValueRangeWhenIdividualScanIterationsReturnEmptyCollection();
152+
public void scanShouldReadEntireValueRangeWhenIndividualScanIterationsReturnEmptyCollection() {
153+
super.scanShouldReadEntireValueRangeWhenIndividualScanIterationsReturnEmptyCollection();
154154
}
155155

156156
@Override

src/test/java/org/springframework/data/redis/connection/AbstractConnectionTransactionIntegrationTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ public void testScriptKill() {
144144
@Test // DATAREDIS-417
145145
@Disabled
146146
@Override
147-
public void scanShouldReadEntireValueRangeWhenIdividualScanIterationsReturnEmptyCollection() {
148-
super.scanShouldReadEntireValueRangeWhenIdividualScanIterationsReturnEmptyCollection();
147+
public void scanShouldReadEntireValueRangeWhenIndividualScanIterationsReturnEmptyCollection() {
148+
super.scanShouldReadEntireValueRangeWhenIndividualScanIterationsReturnEmptyCollection();
149149
}
150150

151151
@Override

src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveClusterServerCommandsIntegrationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ void getConfigShouldRespondCorrectly() {
195195

196196
connection.serverCommands().getConfig(NODE1, "*").as(StepVerifier::create) //
197197
.consumeNextWith(properties -> {
198-
assertThat(properties).containsEntry("databases", "16");
198+
assertThat(properties).containsEntry("port", NODE1.getPort().toString());
199199
}) //
200200
.verifyComplete();
201201
}

src/test/java/org/springframework/data/redis/connection/lettuce/LettuceReactiveServerCommandsIntegrationTests.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,7 @@ void getConfigShouldRespondCorrectly() {
201201

202202
connection.serverCommands().getConfig("*").as(StepVerifier::create) //
203203
.consumeNextWith(properties -> {
204-
assertThat(properties).containsEntry("127.0.0.1:7379.databases", "16");
205-
204+
assertThat(properties).containsEntry("127.0.0.1:7379.port", "7379");
206205
}) //
207206
.verifyComplete();
208207
} else {

0 commit comments

Comments
 (0)