Skip to content

Commit 4db86cb

Browse files
committed
Upgraded testcontainers-redis and spring-batch-redis
1 parent 12bb2c2 commit 4db86cb

File tree

3 files changed

+27
-24
lines changed

3 files changed

+27
-24
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
<lombok.version>1.18.22</lombok.version>
3030
<mockito.version>4.1.0</mockito.version>
3131
<reactor.version>3.4.12</reactor.version>
32-
<spring-batch-redis.version>2.23.6</spring-batch-redis.version>
32+
<spring-batch-redis.version>2.23.7</spring-batch-redis.version>
3333
<slf4j.version>1.7.30</slf4j.version>
34-
<testcontainers-redis.version>1.4.5</testcontainers-redis.version>
34+
<testcontainers-redis.version>1.4.6</testcontainers-redis.version>
3535
<testcontainers.version>1.15.3</testcontainers.version>
3636
<component-owner>redis</component-owner>
3737
<component-name>redis-enterprise-kafka</component-name>

src/test/integration/java/com/redis/kafka/connect/RedisEnterpriseSinkTaskIT.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@
5656
class RedisEnterpriseSinkTaskIT extends AbstractTestcontainersRedisTestBase {
5757

5858
@Container
59-
private static final RedisModulesContainer REDIS = new RedisModulesContainer();
59+
private static final RedisModulesContainer REDIS = new RedisModulesContainer(
60+
RedisModulesContainer.DEFAULT_IMAGE_NAME.withTag(RedisModulesContainer.DEFAULT_TAG));
6061

6162
@Override
6263
protected Collection<RedisServer> servers() {
@@ -234,8 +235,8 @@ void putRpush(RedisTestContext redis) {
234235
records.add(SinkRecordHelper.write(topic, new SchemaAndValue(Schema.STRING_SCHEMA, member),
235236
new SchemaAndValue(Schema.STRING_SCHEMA, member)));
236237
}
237-
put(topic, RedisEnterpriseSinkConfig.DataType.LIST, redis, records, RedisEnterpriseSinkConfig.PUSH_DIRECTION_CONFIG,
238-
RedisEnterpriseSinkConfig.PushDirection.RIGHT.name());
238+
put(topic, RedisEnterpriseSinkConfig.DataType.LIST, redis, records,
239+
RedisEnterpriseSinkConfig.PUSH_DIRECTION_CONFIG, RedisEnterpriseSinkConfig.PushDirection.RIGHT.name());
239240
List<String> actual = redis.sync().lrange(topic, 0, -1);
240241
assertEquals(expected, actual);
241242
}
@@ -354,8 +355,8 @@ public void put(String topic, RedisEnterpriseSinkConfig.DataType type, RedisTest
354355
SinkTaskContext taskContext = mock(SinkTaskContext.class);
355356
when(taskContext.assignment()).thenReturn(ImmutableSet.of(new TopicPartition(topic, 1)));
356357
task.initialize(taskContext);
357-
Map<String, String> propsMap = map(RedisEnterpriseSinkConfig.REDIS_URI_CONFIG, context.getServer().getRedisURI(),
358-
RedisEnterpriseSinkConfig.TYPE_CONFIG, type.name());
358+
Map<String, String> propsMap = map(RedisEnterpriseSinkConfig.REDIS_URI_CONFIG,
359+
context.getServer().getRedisURI(), RedisEnterpriseSinkConfig.TYPE_CONFIG, type.name());
359360
propsMap.putAll(map(props));
360361
task.start(propsMap);
361362
task.put(records);

src/test/integration/java/com/redis/kafka/connect/RedisEnterpriseSourceTaskIT.java

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@
3232

3333
@Slf4j
3434
class RedisEnterpriseSourceTaskIT extends AbstractTestcontainersRedisTestBase {
35-
35+
3636
@Container
37-
private static final RedisContainer REDIS = new RedisContainer().withKeyspaceNotifications();
37+
private static final RedisContainer REDIS = new RedisContainer(
38+
RedisContainer.DEFAULT_IMAGE_NAME.withTag(RedisContainer.DEFAULT_TAG)).withKeyspaceNotifications();
3839

3940
@Override
4041
protected Collection<RedisServer> servers() {
@@ -53,16 +54,16 @@ private void startTask(RedisTestContext redis, String... props) {
5354
config.put(RedisEnterpriseSourceConfig.REDIS_URI_CONFIG, redis.getServer().getRedisURI());
5455
task.start(config);
5556
}
56-
57-
protected Map<String, String> map(String... args) {
58-
Assert.notNull(args, "Args cannot be null");
59-
Assert.isTrue(args.length % 2 == 0, "Args length is not a multiple of 2");
60-
Map<String, String> body = new LinkedHashMap<>();
61-
for (int index = 0; index < args.length / 2; index++) {
62-
body.put(args[index * 2], args[index * 2 + 1]);
63-
}
64-
return body;
65-
}
57+
58+
protected Map<String, String> map(String... args) {
59+
Assert.notNull(args, "Args cannot be null");
60+
Assert.isTrue(args.length % 2 == 0, "Args length is not a multiple of 2");
61+
Map<String, String> body = new LinkedHashMap<>();
62+
for (int index = 0; index < args.length / 2; index++) {
63+
body.put(args[index * 2], args[index * 2 + 1]);
64+
}
65+
return body;
66+
}
6667

6768
@AfterEach
6869
public void teardown() {
@@ -74,9 +75,10 @@ public void teardown() {
7475
void pollStream(RedisTestContext redis) throws InterruptedException {
7576
final String stream = "stream1";
7677
final String topicPrefix = "testprefix-";
77-
startTask(redis, RedisEnterpriseSourceConfig.TOPIC_CONFIG, topicPrefix + RedisEnterpriseSourceConfig.TOKEN_STREAM,
78-
RedisEnterpriseSourceConfig.READER_CONFIG, RedisEnterpriseSourceConfig.ReaderType.STREAM.name(),
79-
RedisEnterpriseSourceConfig.STREAM_NAME_CONFIG, stream);
78+
startTask(redis, RedisEnterpriseSourceConfig.TOPIC_CONFIG,
79+
topicPrefix + RedisEnterpriseSourceConfig.TOKEN_STREAM, RedisEnterpriseSourceConfig.READER_CONFIG,
80+
RedisEnterpriseSourceConfig.ReaderType.STREAM.name(), RedisEnterpriseSourceConfig.STREAM_NAME_CONFIG,
81+
stream);
8082
String field1 = "field1";
8183
String value1 = "value1";
8284
String field2 = "field2";
@@ -107,8 +109,8 @@ private void assertEquals(String expectedId, Map<String, String> expectedBody, S
107109
void pollKeys(RedisTestContext redis) throws InterruptedException {
108110
String topic = "mytopic";
109111
startTask(redis, RedisEnterpriseSourceConfig.READER_CONFIG, RedisEnterpriseSourceConfig.ReaderType.KEYS.name(),
110-
RedisEnterpriseSourceConfig.STREAM_NAME_CONFIG, "dummy", RedisEnterpriseSourceConfig.TOPIC_CONFIG, topic,
111-
RedisEnterpriseSourceTask.KEYS_IDLE_TIMEOUT, "3000");
112+
RedisEnterpriseSourceConfig.STREAM_NAME_CONFIG, "dummy", RedisEnterpriseSourceConfig.TOPIC_CONFIG,
113+
topic, RedisEnterpriseSourceTask.KEYS_IDLE_TIMEOUT, "3000");
112114
LiveRedisItemReader<String, DataStructure<String>> reader = ((KeySourceRecordReader) task.getReader())
113115
.getReader();
114116
Awaitility.await().until(reader::isOpen);

0 commit comments

Comments
 (0)