Skip to content

Commit

Permalink
Merge pull request #1114 from casperisfine/test-redis-server-7.0
Browse files Browse the repository at this point in the history
Add Redis 7.0 to CI matrix
  • Loading branch information
byroot committed Aug 9, 2022
2 parents d6626e6 + ccb6c9b commit 1c7cd38
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 53 deletions.
26 changes: 4 additions & 22 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
redis: ["6.2"]
redis: ["7.0"]
ruby: ["3.1", "3.0", "2.7", "2.6", "2.5"]
driver: ["ruby", "hiredis", "synchrony"]
runs-on: ${{ matrix.os }}
Expand All @@ -57,16 +57,7 @@ jobs:
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Cache dependent gems
uses: actions/cache@v3
with:
path: .bundle
key: "local-bundle-ruby-${{ matrix.ruby }}-on-${{ matrix.os }}-0001"
- name: Set up Gems
run: |
gem update --system --no-document
gem install bundler --no-document
bundle install --jobs 4 --retry 3 --path=.bundle
bundler-cache: true
- name: Cache local temporary directory
uses: actions/cache@v3
with:
Expand All @@ -85,7 +76,7 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
redis: ["6.0", "5.0", "4.0", "3.2", "3.0"]
redis: ["6.2", "6.0", "5.0"]
ruby: ["jruby-9.2.9.0", "2.4"]
driver: ["ruby"]
runs-on: ${{ matrix.os }}
Expand All @@ -108,16 +99,7 @@ jobs:
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Cache dependent gems
uses: actions/cache@v3
with:
path: .bundle
key: "local-bundle-ruby-${{ matrix.ruby }}-on-${{ matrix.os }}-0001"
- name: Set up Gems
run: |
gem update --system --no-document
gem install bundler --no-document
bundle install --jobs 4 --retry 3 --path=.bundle
bundler-cache: true
- name: Cache local temporary directory
uses: actions/cache@v3
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Gemfile.lock
/test/db
/test/test.conf
appendonly.aof
appendonlydir
temp-rewriteaof-*.aof
.history

3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ Metrics/PerceivedComplexity:
Style/PercentLiteralDelimiters:
Enabled: false

Style/TrailingCommaInArrayLiteral:
Enabled: false

Style/ParallelAssignment:
Enabled: false

Expand Down
9 changes: 6 additions & 3 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
REDIS_BRANCH ?= 6.2
REDIS_BRANCH ?= 7.0
ROOT_DIR :=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
TMP := tmp
CONF := ${ROOT_DIR}/test/support/conf/redis-${REDIS_BRANCH}.conf
BUILD_DIR := ${TMP}/cache/redis-${REDIS_BRANCH}
TARBALL := ${TMP}/redis-${REDIS_BRANCH}.tar.gz
BINARY := ${BUILD_DIR}/src/redis-server
Expand Down Expand Up @@ -39,10 +41,11 @@ test:
@env SOCKET_PATH=${SOCKET_PATH} bundle exec rake test

stop:
@$(call kill-redis,${PID_PATH})
@$(call kill-redis,${PID_PATH});\

start: ${BINARY}
@${BINARY}\
@cp ${CONF} ${TMP}/redis.conf; \
${BINARY} ${TMP}/redis.conf \
--daemonize yes\
--pidfile ${PID_PATH}\
--port ${PORT}\
Expand Down
23 changes: 3 additions & 20 deletions test/cluster_commands_on_server_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def test_client_list
expected = %w[addr age cmd db events fd flags id idle multi name obl oll omem psub qbuf qbuf-free sub]
expected << 'user' << 'argv-mem' << 'tot-mem' if version >= '6'
expected << 'laddr' << 'redir' if version >= '6.2'
expected << "multi-mem" << "rbp" << "rbs" << "resp" << "ssub" if version >= '7.0'
assert_equal expected.sort, actual.sort
end

Expand Down Expand Up @@ -80,33 +81,15 @@ def test_command_getkeys
end

def test_command_info
eval_command_flags = if version >= '6.2'
%w[noscript skip_monitor may_replicate movablekeys]
else
%w[noscript movablekeys]
end

expected = [
['get', 2, %w[readonly fast], 1, 1, 1],
['set', -3, %w[write denyoom], 1, 1, 1],
['eval', -3, eval_command_flags, 0, 0, 0]
]
if version >= '6'
expected[0] << ["@read", "@string", "@fast"]
expected[1] << ["@write", "@string", "@slow"]
expected[2] << ["@slow", "@scripting"]
end
assert_equal expected, redis.command(:info, :get, :set, :eval)
assert_equal(expected, redis.command(:info, :get, :set).map { |c| c.first(6) })
end

def test_config_get
expected_keys = if version < '3.2.0'
%w[hash-max-ziplist-entries list-max-ziplist-entries set-max-intset-entries zset-max-ziplist-entries]
else
%w[hash-max-ziplist-entries set-max-intset-entries zset-max-ziplist-entries]
end

assert_equal expected_keys, redis.config(:get, '*max-*-entries*').keys.sort
assert_equal ['hash-max-ziplist-entries'], redis.config(:get, 'hash-max-ziplist-entrie*').keys.sort
end

def test_config_rewrite
Expand Down
5 changes: 3 additions & 2 deletions test/distributed_remote_server_control_commands_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ def test_info_commandstats
target_version "2.5.7" do
r.nodes.each do |n|
n.config(:resetstat)
n.config(:get, :port)
n.get("foo")
n.get("bar")
end

r.info(:commandstats).each do |info|
assert_equal '2', info['config']['calls'] # CONFIG RESETSTAT + CONFIG GET = twice
assert_equal '2', info['get']['calls']
end
end
end
Expand Down
5 changes: 3 additions & 2 deletions test/remote_server_control_commands_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ def test_info
def test_info_commandstats
target_version "2.5.7" do
r.config(:resetstat)
r.config(:get, :port)
r.get("foo")
r.get("bar")

result = r.info(:commandstats)
assert_equal '2', result['config']['calls']
assert_equal '2', result['get']['calls']
end
end

Expand Down
4 changes: 0 additions & 4 deletions test/scanning_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,6 @@ def test_hscan_with_encoding

r.hmset "hash", *elements

assert_equal enc.to_s, r.object("encoding", "hash")

cursor = 0
all_key_values = []
loop do
Expand Down Expand Up @@ -345,8 +343,6 @@ def test_zscan_with_encoding

r.zadd "zset", elements

assert_equal enc.to_s, r.object("encoding", "zset")

cursor = 0
all_key_scores = []
loop do
Expand Down
3 changes: 3 additions & 0 deletions test/support/conf/redis-5.0.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
slaveof no one
appendonly no
save ""
3 changes: 3 additions & 0 deletions test/support/conf/redis-6.0.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
slaveof no one
appendonly no
save ""
3 changes: 3 additions & 0 deletions test/support/conf/redis-6.2.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
slaveof no one
appendonly no
save ""
4 changes: 4 additions & 0 deletions test/support/conf/redis-7.0.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
slaveof no one
appendonly no
save ""
enable-debug-command yes

0 comments on commit 1c7cd38

Please sign in to comment.