File tree 4 files changed +25
-6
lines changed
4 files changed +25
-6
lines changed Original file line number Diff line number Diff line change 38
38
--health-retries 5
39
39
ports :
40
40
- " 7000-7005:7000-7005"
41
+ valkey :
42
+ image : valkey/valkey:8
43
+ options : >-
44
+ --health-cmd "valkey-cli ping"
45
+ --health-interval 10s
46
+ --health-timeout 5s
47
+ --health-retries 5
48
+ ports :
49
+ - 6389:6379
50
+
41
51
steps :
42
52
- name : Checkout repository
43
53
uses : actions/checkout@v4
Original file line number Diff line number Diff line change @@ -8,3 +8,8 @@ services:
8
8
image : grokzen/redis-cluster:7.0.10
9
9
ports :
10
10
- " 7000-7005:7000-7005"
11
+
12
+ valkey :
13
+ image : valkey/valkey:8
14
+ ports :
15
+ - " 6389:6379"
Original file line number Diff line number Diff line change 17
17
"format:check" : " prettier --parser typescript --check \" lib/**/*.ts\" \" test/**/*.ts\" " ,
18
18
"format:fix" : " prettier --parser typescript --write \" lib/**/*.ts\" \" test/**/*.ts\" " ,
19
19
"prepack" : " npm run compile" ,
20
- "test" : " npm run format:check && npm run compile && npm run test:redis-standalone && npm run test:redis-cluster && npm run test:ioredis-standalone && npm run test:ioredis-cluster" ,
20
+ "test" : " npm run format:check && npm run compile && npm run test:redis-standalone && npm run test:redis-cluster && npm run test:ioredis-standalone && npm run test:ioredis-cluster && npm run test:valkey-standalone " ,
21
21
"test:redis-standalone" : " nyc mocha --require ts-node/register test/**/*.ts" ,
22
22
"test:redis-cluster" : " cross-env REDIS_CLUSTER=1 mocha --require ts-node/register test/**/*.ts" ,
23
23
"test:ioredis-standalone" : " cross-env REDIS_LIB=ioredis mocha --require ts-node/register test/**/*.ts" ,
24
- "test:ioredis-cluster" : " cross-env REDIS_LIB=ioredis REDIS_CLUSTER=1 mocha --require ts-node/register test/**/*.ts"
24
+ "test:ioredis-cluster" : " cross-env REDIS_LIB=ioredis REDIS_CLUSTER=1 mocha --require ts-node/register test/**/*.ts" ,
25
+ "test:valkey-standalone" : " cross-env VALKEY=1 mocha --require ts-node/register test/**/*.ts"
25
26
},
26
27
"prettier" : {
27
28
"endOfLine" : " auto"
Original file line number Diff line number Diff line change @@ -43,8 +43,8 @@ const lib = process.env.REDIS_LIB || "redis";
43
43
console . log ( `[INFO] testing in ${ mode } mode with ${ lib } ` ) ;
44
44
45
45
async function initRedisClient ( ) {
46
- if ( process . env . REDIS_CLUSTER === "1 " ) {
47
- if ( process . env . REDIS_LIB === "ioredis" ) {
46
+ if ( mode === "cluster " ) {
47
+ if ( lib === "ioredis" ) {
48
48
return new Cluster ( [
49
49
{
50
50
host : "localhost" ,
@@ -100,10 +100,13 @@ async function initRedisClient() {
100
100
return redisClient ;
101
101
}
102
102
} else {
103
- if ( process . env . REDIS_LIB === "ioredis" ) {
103
+ if ( lib === "ioredis" ) {
104
104
return new Redis ( ) ;
105
105
} else {
106
- const redisClient = createClient ( ) ;
106
+ const port = process . env . VALKEY === "1" ? 6389 : 6379 ;
107
+ const redisClient = createClient ( {
108
+ url : `redis://localhost:${ port } ` ,
109
+ } ) ;
107
110
await redisClient . connect ( ) ;
108
111
109
112
return redisClient ;
You can’t perform that action at this time.
0 commit comments