Skip to content

Commit 49d5e4a

Browse files
authored
Merge a9042fe into f7699b1
2 parents f7699b1 + a9042fe commit 49d5e4a

96 files changed

Lines changed: 906 additions & 289 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/integration.yml

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,28 +51,10 @@ jobs:
5151
mvn javadoc:jar
5252
- name: Run tests
5353
run: |
54-
TEST="" make test
54+
make test
5555
env:
5656
JVM_OPTS: -Xmx3200m
5757
TERM: dumb
58-
- name: sleep 10s
59-
run: sleep 10s
60-
- name: Make - start
61-
run: |
62-
make start
63-
sleep 2s
64-
- name: Docker - mod or stack
65-
run: docker run -p 52567:6379 -d redis/redis-stack-server:edge
66-
- name: Test commands - default protocol
67-
run: mvn -Dtest="redis.clients.jedis.commands.**" test
68-
- name: Test commands - RESP3 protocol
69-
run: mvn -DjedisProtocol=3 -Dtest="redis.clients.jedis.commands.**" test
70-
- name: Test module commands - default protocol
71-
run: mvn -DmodulesDocker="localhost:52567" -Dtest="redis.clients.jedis.modules.**" test
72-
- name: Test module commands - RESP3 protocol
73-
run: mvn -DjedisProtocol=3 -DmodulesDocker="localhost:52567" -Dtest="redis.clients.jedis.modules.**" test
74-
- name: Make - stop
75-
run: make stop
7658
- name: Codecov
7759
run: |
7860
bash <(curl -s https://codecov.io/bash)

Makefile

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ ifndef STUNNEL_BIN
413413
endif
414414
export SKIP_SSL
415415

416-
start: stunnel cleanup
416+
start: stunnel cleanup compile-module
417417
echo "$$REDIS1_CONF" | redis-server -
418418
echo "$$REDIS2_CONF" | redis-server -
419419
echo "$$REDIS3_CONF" | redis-server -
@@ -446,6 +446,7 @@ start: stunnel cleanup
446446
echo "$$REDIS_UDS" | redis-server -
447447
echo "$$REDIS_UNAVAILABLE_CONF" | redis-server -
448448
redis-cli -a cluster --cluster create 127.0.0.1:7479 127.0.0.1:7480 127.0.0.1:7481 --cluster-yes
449+
docker run -p 6479:6379 --name jedis-stack -d redis/redis-stack-server:edge
449450

450451
cleanup:
451452
- rm -vf /tmp/redis_cluster_node*.conf 2>/dev/null
@@ -455,6 +456,7 @@ stunnel:
455456
@if [ -e "$$STUNNEL_BIN" ]; then\
456457
echo "$$STUNNEL_CONF" | stunnel -fd 0;\
457458
fi
459+
458460
stop:
459461
kill `cat /tmp/redis1.pid`
460462
kill `cat /tmp/redis2.pid`
@@ -496,29 +498,32 @@ stop:
496498
rm -f /tmp/redis_stable_cluster_node1.conf
497499
rm -f /tmp/redis_stable_cluster_node2.conf
498500
rm -f /tmp/redis_stable_cluster_node3.conf
501+
docker rm -f jedis-stack
502+
503+
test: | start mvn-test stop
499504

500-
test: compile-module start
501-
sleep 2
505+
mvn-test:
502506
mvn -Dtest=${SKIP_SSL}${TEST} clean compile test
503-
make stop
504507

505-
package: start
508+
package: | start mvn-package stop
509+
510+
mvn-package:
506511
mvn clean package
507-
make stop
508512

509-
deploy: start
513+
deploy: | start mvn-deploy stop
514+
515+
mvn-deploy:
510516
mvn clean deploy
511-
make stop
512517

513518
format:
514519
mvn java-formatter:format
515520

516-
release:
517-
make start
521+
release: | start mvn-release stop
522+
523+
mvn-release:
518524
mvn release:clean
519525
mvn release:prepare
520526
mvn release:perform -DskipTests
521-
make stop
522527

523528
system-setup:
524529
sudo apt install -y gcc g++

src/test/java/redis/clients/jedis/ACLJedisTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import java.net.URISyntaxException;
77
import org.junit.BeforeClass;
88
import org.junit.Test;
9+
import org.junit.runner.RunWith;
10+
import org.junit.runners.Parameterized;
911

1012
import redis.clients.jedis.commands.jedis.JedisCommandsTestBase;
1113
import redis.clients.jedis.util.RedisVersionUtil;
@@ -15,6 +17,7 @@
1517
* <p>
1618
* This test is only executed when the server/cluster is Redis 6. or more.
1719
*/
20+
@RunWith(Parameterized.class)
1821
public class ACLJedisTest extends JedisCommandsTestBase {
1922

2023
/**
@@ -27,6 +30,10 @@ public static void prepare() throws Exception {
2730
RedisVersionUtil.checkRedisMajorVersionNumber(6));
2831
}
2932

33+
public ACLJedisTest(RedisProtocol redisProtocol) {
34+
super(redisProtocol);
35+
}
36+
3037
@Test
3138
public void useWithoutConnecting() {
3239
try (Jedis j = new Jedis()) {

src/test/java/redis/clients/jedis/JedisShardedPubSubBaseTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ protected String encode(byte[] raw) {
5050
});
5151
thread.start();
5252

53-
assertTrue(countDownLatch.await(10, TimeUnit.MILLISECONDS));
53+
assertTrue(countDownLatch.await(20, TimeUnit.MILLISECONDS));
5454

5555
}
5656
}

src/test/java/redis/clients/jedis/JedisTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,22 @@
1717
import java.util.Map;
1818

1919
import org.junit.Test;
20+
import org.junit.runner.RunWith;
21+
import org.junit.runners.Parameterized;
2022

2123
import redis.clients.jedis.exceptions.InvalidURIException;
2224
import redis.clients.jedis.exceptions.JedisConnectionException;
2325
import redis.clients.jedis.exceptions.JedisException;
2426
import redis.clients.jedis.commands.jedis.JedisCommandsTestBase;
2527
import redis.clients.jedis.util.SafeEncoder;
2628

29+
@RunWith(Parameterized.class)
2730
public class JedisTest extends JedisCommandsTestBase {
2831

32+
public JedisTest(RedisProtocol protocol) {
33+
super(protocol);
34+
}
35+
2936
@Test
3037
public void useWithoutConnecting() {
3138
try (Jedis j = new Jedis()) {

src/test/java/redis/clients/jedis/MigratePipeliningTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@
1414
import org.junit.After;
1515
import org.junit.Before;
1616
import org.junit.Test;
17+
import org.junit.runner.RunWith;
18+
import org.junit.runners.Parameterized;
19+
1720
import redis.clients.jedis.commands.jedis.JedisCommandsTestBase;
1821
import redis.clients.jedis.exceptions.JedisDataException;
1922
import redis.clients.jedis.params.MigrateParams;
2023

24+
@RunWith(Parameterized.class)
2125
public class MigratePipeliningTest extends JedisCommandsTestBase {
2226

2327
private static final byte[] bfoo = { 0x01, 0x02, 0x03 };
@@ -39,6 +43,10 @@ public class MigratePipeliningTest extends JedisCommandsTestBase {
3943
private Jedis dest;
4044
private Jedis destAuth;
4145

46+
public MigratePipeliningTest(RedisProtocol protocol) {
47+
super(protocol);
48+
}
49+
4250
@Before
4351
@Override
4452
public void setUp() throws Exception {

src/test/java/redis/clients/jedis/PipeliningTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,28 @@
2424
import org.hamcrest.Matcher;
2525
import org.hamcrest.Matchers;
2626
import org.junit.Test;
27+
import org.junit.runner.RunWith;
28+
import org.junit.runners.Parameterized;
29+
2730
import redis.clients.jedis.commands.ProtocolCommand;
2831
import redis.clients.jedis.commands.jedis.JedisCommandsTestBase;
2932
import redis.clients.jedis.exceptions.JedisDataException;
3033
import redis.clients.jedis.params.SetParams;
3134
import redis.clients.jedis.resps.Tuple;
3235
import redis.clients.jedis.util.SafeEncoder;
3336

37+
@RunWith(Parameterized.class)
3438
public class PipeliningTest extends JedisCommandsTestBase {
3539

3640
private static final byte[] bfoo = { 0x01, 0x02, 0x03, 0x04 };
3741
private static final byte[] bfoo1 = { 0x01, 0x02, 0x03, 0x04, 0x11, 0x12, 0x13, 0x14 };
3842
private static final byte[] bbar = { 0x05, 0x06, 0x07, 0x08 };
3943
private static final byte[] bbaz = { 0x09, 0x0A, 0x0B, 0x0C };
4044

45+
public PipeliningTest(RedisProtocol protocol) {
46+
super(protocol);
47+
}
48+
4149
@Test
4250
public void pipeline() {
4351
Pipeline p = jedis.pipelined();

src/test/java/redis/clients/jedis/TupleSortedSetTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@
66
import java.util.Collections;
77
import java.util.List;
88
import org.junit.Test;
9+
import org.junit.runner.RunWith;
10+
import org.junit.runners.Parameterized;
11+
912
import redis.clients.jedis.resps.Tuple;
1013
import redis.clients.jedis.commands.jedis.JedisCommandsTestBase;
1114

15+
@RunWith(Parameterized.class)
1216
public class TupleSortedSetTest extends JedisCommandsTestBase {
1317
final byte[] bfoo = { 0x01, 0x02, 0x03, 0x04 };
1418
final byte[] ba = { 0x0A };
@@ -18,6 +22,10 @@ public class TupleSortedSetTest extends JedisCommandsTestBase {
1822
final byte[] be = { 0x0E };
1923
final byte[] bf = { 0x0F };
2024

25+
public TupleSortedSetTest(RedisProtocol protocol) {
26+
super(protocol);
27+
}
28+
2129
@Test
2230
public void testBinary() {
2331
List<Tuple> array = new ArrayList<Tuple>();
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package redis.clients.jedis.commands;
2+
3+
import java.util.Arrays;
4+
import java.util.Collection;
5+
6+
import redis.clients.jedis.RedisProtocol;
7+
8+
public class CommandsTestsParameters {
9+
10+
/**
11+
* RESP protocol versions we want our commands related tests to run against.
12+
* {@code null} means to use the default protocol which is assumed to be RESP2.
13+
*/
14+
public static Collection<Object[]> respVersions() {
15+
return Arrays.asList(
16+
new Object[]{ null },
17+
new Object[]{ RedisProtocol.RESP2 },
18+
new Object[]{ RedisProtocol.RESP3 }
19+
);
20+
}
21+
22+
}

src/test/java/redis/clients/jedis/commands/jedis/AccessControlListCommandsTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@
1818
import org.junit.After;
1919
import org.junit.BeforeClass;
2020
import org.junit.Test;
21+
import org.junit.runner.RunWith;
22+
import org.junit.runners.Parameterized;
2123

2224
import redis.clients.jedis.CommandArguments;
2325
import redis.clients.jedis.Jedis;
2426
import redis.clients.jedis.Protocol;
27+
import redis.clients.jedis.RedisProtocol;
2528
import redis.clients.jedis.Transaction;
2629
import redis.clients.jedis.exceptions.JedisAccessControlException;
2730
import redis.clients.jedis.exceptions.JedisDataException;
@@ -33,6 +36,7 @@
3336
/**
3437
* TODO: properly define and test exceptions
3538
*/
39+
@RunWith(Parameterized.class)
3640
public class AccessControlListCommandsTest extends JedisCommandsTestBase {
3741

3842
public static final String USER_NAME = "newuser";
@@ -45,6 +49,10 @@ public static void prepare() throws Exception {
4549
RedisVersionUtil.checkRedisMajorVersionNumber(6));
4650
}
4751

52+
public AccessControlListCommandsTest(RedisProtocol protocol) {
53+
super(protocol);
54+
}
55+
4856
@After
4957
@Override
5058
public void tearDown() throws Exception {

0 commit comments

Comments
 (0)