Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix redis-clustering gem to pass the test with latest dependencies #1222

Merged
merged 1 commit into from Sep 13, 2023

Conversation

supercaracal
Copy link
Contributor

  • Since redis-cluster-client changed a portion of internal implementation in 0.6.1, redis-rb should adapt codes depended on it.
  • A portion of test cases is a bit unstable against redis server minor changes, so we should keep it simple.

@@ -28,11 +28,11 @@ def initialize(*)
ruby2_keywords :initialize if respond_to?(:ruby2_keywords, true)

def id
@router.node.node_keys.join(' ')
@router.node_keys.join(' ')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -47,5 +47,5 @@ Gem::Specification.new do |s|
s.required_ruby_version = '>= 2.7.0'

s.add_runtime_dependency('redis', s.version)
s.add_runtime_dependency('redis-cluster-client', '>= 0.3.7')
s.add_runtime_dependency('redis-cluster-client', '>= 0.6.1')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -47,7 +47,7 @@ def test_migrate
def test_object
redis.lpush('mylist', 'Hello World')
assert_equal 1, redis.object('refcount', 'mylist')
assert_equal 'quicklist', redis.object('encoding', 'mylist')
assert_equal 'listpack', redis.object('encoding', 'mylist')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like internal changes for Redis 7.2.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's best to either remove that test or to allow both values.

There is no point testing Redis internal implementation.

expected << "multi-mem" << "rbp" << "rbs" << "resp" << "ssub" if version >= '7.0'
assert_equal expected.sort, actual.sort
assert_instance_of Hash, a_client_info
assert_includes a_client_info, 'addr'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • It looks like server side changes for reply type from Array to Hash.
  • I simplified this test case rather than meticulous assertion because it is weak against server side minor changes.

@@ -47,7 +47,6 @@ def test_migrate
def test_object
redis.lpush('mylist', 'Hello World')
assert_equal 1, redis.object('refcount', 'mylist')
assert_equal 'quicklist', redis.object('encoding', 'mylist')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was changed to 'listpack' in Redis 7.2. We have no advantages for testing redis minor behavior, so just removed.

@supercaracal
Copy link
Contributor Author

The CI job was failed but it was related to sentinel.

  1) Failure:
SentinelTest#test_sentinel_with_non_sentinel_options [/home/runner/work/redis-rb/redis-rb/test/sentinel/sentinel_test.rb:208]:
--- expected
+++ actual
@@ -1 +1 @@
-[["auth", "foo"], ["get-master-addr-by-name", "master1"], ["sentinels", "master1"]]
+[["get-master-addr-by-name", "master1"], ["sentinels", "master1"]]

@supercaracal supercaracal marked this pull request as ready for review September 13, 2023 13:00
@byroot byroot merged commit 01de51a into redis:master Sep 13, 2023
16 of 17 checks passed
@supercaracal supercaracal deleted the fix-cluster branch September 13, 2023 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants