Skip to content

Commit

Permalink
Merge pull request #1261 from casperisfine/update-redis-lcient
Browse files Browse the repository at this point in the history
Support latest redis-client
  • Loading branch information
byroot committed Apr 2, 2024
2 parents 7cc45e5 + 0060435 commit 35a7e82
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 15 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yaml
Expand Up @@ -29,7 +29,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ["3.2", "3.1", "3.0", "2.7", "2.6", "2.5", "jruby-9.3.6.0"]
ruby: ["3.2", "3.1", "3.0", "2.7", "2.6", "jruby-9.3.6.0"]
runs-on: ubuntu-latest
env:
LOW_TIMEOUT: "0.01"
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.5"
ruby-version: "2.6"
bundler-cache: true
- name: Cache local temporary directory
uses: actions/cache@v4
Expand Down Expand Up @@ -159,7 +159,7 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.5"
ruby-version: "2.6"
bundler-cache: true
- name: Cache local temporary directory
uses: actions/cache@v4
Expand Down Expand Up @@ -194,7 +194,7 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.5"
ruby-version: "2.6"
bundler-cache: true
- name: Cache local temporary directory
uses: actions/cache@v4
Expand Down
5 changes: 4 additions & 1 deletion .rubocop.yml
@@ -1,7 +1,7 @@
inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.5
TargetRubyVersion: 2.6

Layout/LineLength:
Max: 120
Expand Down Expand Up @@ -56,6 +56,9 @@ Metrics/PerceivedComplexity:
Style/PercentLiteralDelimiters:
Enabled: false

Style/SlicingWithRange:
Enabled: false

Style/TrailingCommaInArrayLiteral:
Enabled: false

Expand Down
3 changes: 1 addition & 2 deletions cluster/test/helper.rb
Expand Up @@ -72,8 +72,7 @@ def redis_cluster_mock(commands, options = {})
port = nil

cluster_subcommands = if commands.key?(:cluster)
commands.delete(:cluster)
.to_h { |k, v| [k.to_s.downcase, v] }
commands.delete(:cluster).transform_keys { |k| k.to_s.downcase }
else
{}
end
Expand Down
2 changes: 1 addition & 1 deletion redis.gemspec
Expand Up @@ -43,7 +43,7 @@ Gem::Specification.new do |s|
s.files = Dir["CHANGELOG.md", "LICENSE", "README.md", "lib/**/*"]
s.executables = `git ls-files -- exe/*`.split("\n").map { |f| File.basename(f) }

s.required_ruby_version = '>= 2.5.0'
s.required_ruby_version = '>= 2.6.0'

s.add_runtime_dependency('redis-client', '>= 0.17.0')
end
4 changes: 2 additions & 2 deletions test/lint/streams.rb
Expand Up @@ -135,7 +135,7 @@ def test_xtrim_with_limit_option

assert_equal 1, redis.xtrim('s1', 0, approximate: true, limit: 1)
error = assert_raises(Redis::CommandError) { redis.xtrim('s1', 0, limit: 1) }
assert_equal "ERR syntax error, LIMIT cannot be used without the special ~ option", error.message
assert_includes error.message, "ERR syntax error, LIMIT cannot be used without the special ~ option"
ensure
redis.config(:set, 'stream-node-max-entries', original)
end
Expand Down Expand Up @@ -174,7 +174,7 @@ def test_xtrim_with_invalid_strategy

redis.xadd('s1', { f: 'v1' })
error = assert_raises(Redis::CommandError) { redis.xtrim('s1', '1-0', strategy: '') }
assert_equal "ERR syntax error", error.message
assert_includes error.message, "ERR syntax error"
end

def test_xtrim_with_not_existed_stream
Expand Down
10 changes: 5 additions & 5 deletions test/redis/connection_test.rb
Expand Up @@ -37,27 +37,27 @@ def test_connection_information

def test_default_id_with_host_and_port
redis = Redis.new(OPTIONS.merge(host: "host", port: "1234", db: 0))
assert_equal "redis://host:1234/0", redis.connection.fetch(:id)
assert_equal "redis://host:1234", redis.connection.fetch(:id)
end

def test_default_id_with_host_and_port_and_ssl
redis = Redis.new(OPTIONS.merge(host: 'host', port: '1234', db: 0, ssl: true))
assert_equal "rediss://host:1234/0", redis.connection.fetch(:id)
assert_equal "rediss://host:1234", redis.connection.fetch(:id)
end

def test_default_id_with_host_and_port_and_explicit_scheme
redis = Redis.new(OPTIONS.merge(host: "host", port: "1234", db: 0))
assert_equal "redis://host:1234/0", redis.connection.fetch(:id)
assert_equal "redis://host:1234", redis.connection.fetch(:id)
end

def test_default_id_with_path
redis = Redis.new(OPTIONS.merge(path: "/tmp/redis.sock", db: 0))
assert_equal "/tmp/redis.sock/0", redis.connection.fetch(:id)
assert_equal "unix:///tmp/redis.sock", redis.connection.fetch(:id)
end

def test_default_id_with_path_and_explicit_scheme
redis = Redis.new(OPTIONS.merge(path: "/tmp/redis.sock", db: 0))
assert_equal "/tmp/redis.sock/0", redis.connection.fetch(:id)
assert_equal "unix:///tmp/redis.sock", redis.connection.fetch(:id)
end

def test_override_id
Expand Down

0 comments on commit 35a7e82

Please sign in to comment.