Skip to content

Commit 1c7cd38

Browse files
authored
Merge pull request #1114 from casperisfine/test-redis-server-7.0
Add Redis 7.0 to CI matrix
2 parents d6626e6 + ccb6c9b commit 1c7cd38

12 files changed

+36
-53
lines changed

.github/workflows/test.yaml

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
fail-fast: false
3535
matrix:
3636
os: ["ubuntu-latest"]
37-
redis: ["6.2"]
37+
redis: ["7.0"]
3838
ruby: ["3.1", "3.0", "2.7", "2.6", "2.5"]
3939
driver: ["ruby", "hiredis", "synchrony"]
4040
runs-on: ${{ matrix.os }}
@@ -57,16 +57,7 @@ jobs:
5757
uses: ruby/setup-ruby@v1
5858
with:
5959
ruby-version: ${{ matrix.ruby }}
60-
- name: Cache dependent gems
61-
uses: actions/cache@v3
62-
with:
63-
path: .bundle
64-
key: "local-bundle-ruby-${{ matrix.ruby }}-on-${{ matrix.os }}-0001"
65-
- name: Set up Gems
66-
run: |
67-
gem update --system --no-document
68-
gem install bundler --no-document
69-
bundle install --jobs 4 --retry 3 --path=.bundle
60+
bundler-cache: true
7061
- name: Cache local temporary directory
7162
uses: actions/cache@v3
7263
with:
@@ -85,7 +76,7 @@ jobs:
8576
fail-fast: false
8677
matrix:
8778
os: ["ubuntu-latest"]
88-
redis: ["6.0", "5.0", "4.0", "3.2", "3.0"]
79+
redis: ["6.2", "6.0", "5.0"]
8980
ruby: ["jruby-9.2.9.0", "2.4"]
9081
driver: ["ruby"]
9182
runs-on: ${{ matrix.os }}
@@ -108,16 +99,7 @@ jobs:
10899
uses: ruby/setup-ruby@v1
109100
with:
110101
ruby-version: ${{ matrix.ruby }}
111-
- name: Cache dependent gems
112-
uses: actions/cache@v3
113-
with:
114-
path: .bundle
115-
key: "local-bundle-ruby-${{ matrix.ruby }}-on-${{ matrix.os }}-0001"
116-
- name: Set up Gems
117-
run: |
118-
gem update --system --no-document
119-
gem install bundler --no-document
120-
bundle install --jobs 4 --retry 3 --path=.bundle
102+
bundler-cache: true
121103
- name: Cache local temporary directory
122104
uses: actions/cache@v3
123105
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Gemfile.lock
1616
/test/db
1717
/test/test.conf
1818
appendonly.aof
19+
appendonlydir
1920
temp-rewriteaof-*.aof
2021
.history
2122

.rubocop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ Metrics/PerceivedComplexity:
5656
Style/PercentLiteralDelimiters:
5757
Enabled: false
5858

59+
Style/TrailingCommaInArrayLiteral:
60+
Enabled: false
61+
5962
Style/ParallelAssignment:
6063
Enabled: false
6164

makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
REDIS_BRANCH ?= 6.2
1+
REDIS_BRANCH ?= 7.0
2+
ROOT_DIR :=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
23
TMP := tmp
4+
CONF := ${ROOT_DIR}/test/support/conf/redis-${REDIS_BRANCH}.conf
35
BUILD_DIR := ${TMP}/cache/redis-${REDIS_BRANCH}
46
TARBALL := ${TMP}/redis-${REDIS_BRANCH}.tar.gz
57
BINARY := ${BUILD_DIR}/src/redis-server
@@ -39,10 +41,11 @@ test:
3941
@env SOCKET_PATH=${SOCKET_PATH} bundle exec rake test
4042

4143
stop:
42-
@$(call kill-redis,${PID_PATH})
44+
@$(call kill-redis,${PID_PATH});\
4345

4446
start: ${BINARY}
45-
@${BINARY}\
47+
@cp ${CONF} ${TMP}/redis.conf; \
48+
${BINARY} ${TMP}/redis.conf \
4649
--daemonize yes\
4750
--pidfile ${PID_PATH}\
4851
--port ${PORT}\

test/cluster_commands_on_server_test.rb

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def test_client_list
4545
expected = %w[addr age cmd db events fd flags id idle multi name obl oll omem psub qbuf qbuf-free sub]
4646
expected << 'user' << 'argv-mem' << 'tot-mem' if version >= '6'
4747
expected << 'laddr' << 'redir' if version >= '6.2'
48+
expected << "multi-mem" << "rbp" << "rbs" << "resp" << "ssub" if version >= '7.0'
4849
assert_equal expected.sort, actual.sort
4950
end
5051

@@ -80,33 +81,15 @@ def test_command_getkeys
8081
end
8182

8283
def test_command_info
83-
eval_command_flags = if version >= '6.2'
84-
%w[noscript skip_monitor may_replicate movablekeys]
85-
else
86-
%w[noscript movablekeys]
87-
end
88-
8984
expected = [
9085
['get', 2, %w[readonly fast], 1, 1, 1],
9186
['set', -3, %w[write denyoom], 1, 1, 1],
92-
['eval', -3, eval_command_flags, 0, 0, 0]
9387
]
94-
if version >= '6'
95-
expected[0] << ["@read", "@string", "@fast"]
96-
expected[1] << ["@write", "@string", "@slow"]
97-
expected[2] << ["@slow", "@scripting"]
98-
end
99-
assert_equal expected, redis.command(:info, :get, :set, :eval)
88+
assert_equal(expected, redis.command(:info, :get, :set).map { |c| c.first(6) })
10089
end
10190

10291
def test_config_get
103-
expected_keys = if version < '3.2.0'
104-
%w[hash-max-ziplist-entries list-max-ziplist-entries set-max-intset-entries zset-max-ziplist-entries]
105-
else
106-
%w[hash-max-ziplist-entries set-max-intset-entries zset-max-ziplist-entries]
107-
end
108-
109-
assert_equal expected_keys, redis.config(:get, '*max-*-entries*').keys.sort
92+
assert_equal ['hash-max-ziplist-entries'], redis.config(:get, 'hash-max-ziplist-entrie*').keys.sort
11093
end
11194

11295
def test_config_rewrite

test/distributed_remote_server_control_commands_test.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ def test_info_commandstats
3030
target_version "2.5.7" do
3131
r.nodes.each do |n|
3232
n.config(:resetstat)
33-
n.config(:get, :port)
33+
n.get("foo")
34+
n.get("bar")
3435
end
3536

3637
r.info(:commandstats).each do |info|
37-
assert_equal '2', info['config']['calls'] # CONFIG RESETSTAT + CONFIG GET = twice
38+
assert_equal '2', info['get']['calls']
3839
end
3940
end
4041
end

test/remote_server_control_commands_test.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ def test_info
2727
def test_info_commandstats
2828
target_version "2.5.7" do
2929
r.config(:resetstat)
30-
r.config(:get, :port)
30+
r.get("foo")
31+
r.get("bar")
3132

3233
result = r.info(:commandstats)
33-
assert_equal '2', result['config']['calls']
34+
assert_equal '2', result['get']['calls']
3435
end
3536
end
3637

test/scanning_test.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,6 @@ def test_hscan_with_encoding
246246

247247
r.hmset "hash", *elements
248248

249-
assert_equal enc.to_s, r.object("encoding", "hash")
250-
251249
cursor = 0
252250
all_key_values = []
253251
loop do
@@ -345,8 +343,6 @@ def test_zscan_with_encoding
345343

346344
r.zadd "zset", elements
347345

348-
assert_equal enc.to_s, r.object("encoding", "zset")
349-
350346
cursor = 0
351347
all_key_scores = []
352348
loop do

test/support/conf/redis-5.0.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
slaveof no one
2+
appendonly no
3+
save ""

test/support/conf/redis-6.0.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
slaveof no one
2+
appendonly no
3+
save ""

0 commit comments

Comments
 (0)