Skip to content
This repository was archived by the owner on Jun 4, 2025. It is now read-only.

Commit 021dcb8

Browse files
committed
add makefile to support testing
1 parent 01044b6 commit 021dcb8

File tree

6 files changed

+19
-23
lines changed

6 files changed

+19
-23
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
#node-version: [14.x, 16.x, 18.x, 20.x]
18-
node-version: [18.x]
17+
node-version: [14.x, 16.x, 18.x, 20.x]
1918

2019
steps:
2120
- name: Checkout
@@ -29,26 +28,26 @@ jobs:
2928
- name: install redis-ci
3029
run: sudo apt-get install redis-tools
3130

32-
# - name: Install dependencies
33-
# run: npm install
34-
35-
# - name: Setup Standalone Tests
36-
# run: make test-standalone-setup
37-
#
38-
# - name: Run Standalone tests
39-
# run: make test-standalone
40-
#
41-
# - name: Teardown Standalone Tests
42-
# run: make test-standalone-teardown
43-
#
31+
- name: Install dependencies
32+
run: npm install
33+
34+
- name: Setup Standalone Tests
35+
run: make test-standalone-setup
36+
37+
- name: Run Standalone tests
38+
run: make test-standalone
39+
40+
- name: Teardown Standalone Tests
41+
run: make test-standalone-teardown
42+
4443
- name: Setup Clustered Tests
4544
run: make test-cluster-setup
4645

4746
- name: Check Redis Cluster
48-
run: redis-cli -c -p 16371 cluster info
47+
run: timeout 60 bash <<< "until redis-cli -c -p 16371 cluster info | grep 'cluster_state:ok'; do sleep 1; done"
4948

50-
# - name: Run Clustered tests
51-
# run: make test-cluster
49+
- name: Run Clustered tests
50+
run: make test-cluster
5251

5352
- name: Teardown Clustered Tests
5453
run: make test-cluster-teardown

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ test-standalone-teardown:
88

99
test-cluster-setup:
1010
docker-compose -f docker-compose-cluster.yml up -d
11-
timeout 60s sh -c 'until ! docker ps | grep limitd-redis-redis-cluster-create; do echo "Waiting for cluster create container to finish..."; sleep 2; done'
1211

1312
test-cluster-teardown:
1413
docker-compose -f docker-compose-cluster.yml down

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"scripts": {
1111
"test-standalone": "CLUSTERED_ENV=false NODE_ENV=test nyc mocha --exit",
12-
"test-cluster": "DEBUG=ioredis:* CLUSTERED_ENV=true NODE_ENV=test nyc mocha --exit"
12+
"test-cluster": "CLUSTERED_ENV=true NODE_ENV=test nyc mocha --exit"
1313
},
1414
"author": "Auth0",
1515
"license": "MIT",

test-resources/redis-cluster/redis-cluster-create.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,3 @@ node_2_ip="0.0.0.0"
33
node_3_ip="0.0.0.0"
44

55
redis-cli --cluster create $node_1_ip:16371 $node_2_ip:16372 $node_3_ip:16373 --cluster-replicas 0 --cluster-yes
6-
echo "Waiting for cluster status to be ok..."
7-
timeout 60s sh -c 'until redis-cli -p 16371 -c cluster info | grep cluster_state:ok ; do echo "Waiting for cluster create container to finish..."; sleep 1; done'

test/client.tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const _ = require('lodash');
33
const assert = require('chai').assert;
44
const LimitRedis = require('../lib/client');
55
const ValidationError = LimitRedis.ValidationError;
6-
const clusterNodes = [{ host: 'localhost', port: 16371 }, { host: 'localhost', port: 16372 }, { host: 'localhost', port: 16373 }];
6+
const clusterNodes = [{ host: '127.0.0.1', port: 16371 }, { host: '127.0.0.1', port: 16372 }, { host: '127.0.0.1', port: 16373 }];
77

88
const standaloneClientFn = (params) => {
99
return new LimitRedis({ uri: 'localhost', buckets: {}, prefix: 'tests:', ..._.omit(params, ['nodes']) });

test/db.tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const { Toxiproxy, Toxic } = require('toxiproxy-node-client');
88
const crypto = require('crypto');
99
const { endOfMonthTimestamp, replicateHashtag } = require('../lib/utils');
1010

11-
const clusterNodes = [{ host: 'localhost', port: 16371 }, { host: 'localhost', port: 16372 }, { host: 'localhost', port: 16373 }];
11+
const clusterNodes = [{ host: '127.0.0.1', port: 16371 }, { host: '127.0.0.1', port: 16372 }, { host: '127.0.0.1', port: 16373 }];
1212

1313
const standaloneClientFn = (params) => {
1414
return new LimitDB({ uri: 'localhost', buckets: {}, prefix: 'tests:', ..._.omit(params, ['nodes']) });

0 commit comments

Comments
 (0)