From 7c1fd68df2db35351dbdfd58c3636757d190f15e Mon Sep 17 00:00:00 2001 From: Taishi Kasuga Date: Sat, 21 Sep 2024 14:58:14 +0900 Subject: [PATCH 1/8] test: resume resharding test for scale reading --- .github/workflows/test.yaml | 5 ++-- compose.valkey.yaml | 23 +++++++++++++- test/test_against_cluster_state.rb | 48 ------------------------------ 3 files changed, 24 insertions(+), 52 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 469b129c..981a99a0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -28,7 +28,7 @@ jobs: matrix: include: - {redis: '7.2', ruby: '3.3'} - - {redis: '7.2', ruby: '3.3', compose: compose.valkey.yaml} + - {redis: '8', ruby: '3.3', compose: compose.valkey.yaml} - {redis: '7.2', ruby: '3.3', compose: compose.ssl.yaml} - {redis: '7.2', ruby: '3.3', driver: 'hiredis'} - {redis: '7.2', ruby: '3.3', driver: 'hiredis', compose: compose.ssl.yaml} @@ -39,8 +39,7 @@ jobs: - {redis: '5.0', ruby: '2.7'} - {ruby: 'jruby'} - {ruby: 'truffleruby'} - - {task: test_cluster_state, redis: '7.2', replica: '2', compose: compose.replica.yaml, startup: '9'} - - {task: test_cluster_state, redis: '6.2', replica: '2', compose: compose.replica.yaml, startup: '9'} + - {task: test_cluster_state, redis: '8', replica: '2', compose: compose.valkey.yaml, startup: '9'} - {task: test_cluster_broken, redis: '7.2', restart: 'no', startup: '6'} - {task: test_cluster_broken, redis: '6.2', restart: 'no', startup: '6'} - {task: test_cluster_scale, redis: '7.2', compose: compose.scale.yaml, startup: '8'} diff --git a/compose.valkey.yaml b/compose.valkey.yaml index fedb8815..5a5a3d78 100644 --- a/compose.valkey.yaml +++ b/compose.valkey.yaml @@ -38,6 +38,18 @@ services: <<: *node ports: - "6384:6379" + node7: + <<: *node + ports: + - "6385:6379" + node8: + <<: *node + ports: + - "6386:6379" + node9: + <<: *node + ports: + - "6387:6379" clustering: image: "valkey/valkey:${REDIS_VERSION:-7}" command: > @@ -51,7 +63,10 @@ services: $$(dig node4 +short):6379 $$(dig node5 +short):6379 $$(dig node6 +short):6379 - --cluster-replicas 1" + $$(dig node7 +short):6379 + $$(dig node8 +short):6379 + $$(dig node9 +short):6379 + --cluster-replicas 2" depends_on: node1: condition: service_healthy @@ -65,6 +80,12 @@ services: condition: service_healthy node6: condition: service_healthy + node7: + condition: service_healthy + node8: + condition: service_healthy + node9: + condition: service_healthy ruby: image: "ruby:${RUBY_VERSION:-3}" restart: always diff --git a/test/test_against_cluster_state.rb b/test/test_against_cluster_state.rb index cc35f208..ac14a06b 100644 --- a/test/test_against_cluster_state.rb +++ b/test/test_against_cluster_state.rb @@ -220,22 +220,6 @@ def new_test_client class ScaleReadRandom < TestingWrapper include Mixin - def test_the_state_of_cluster_resharding - skip('https://github.com/redis/redis/issues/11312') - end - - def test_the_state_of_cluster_resharding_with_pipelining - skip('https://github.com/redis/redis/issues/11312') - end - - def test_the_state_of_cluster_resharding_with_transaction - skip('https://github.com/redis/redis/issues/11312') - end - - def test_the_state_of_cluster_resharding_with_transaction_and_watch - skip('https://github.com/redis/redis/issues/11312') - end - private def new_test_client @@ -252,22 +236,6 @@ def new_test_client class ScaleReadRandomWithPrimary < TestingWrapper include Mixin - def test_the_state_of_cluster_resharding - skip('https://github.com/redis/redis/issues/11312') - end - - def test_the_state_of_cluster_resharding_with_pipelining - skip('https://github.com/redis/redis/issues/11312') - end - - def test_the_state_of_cluster_resharding_with_transaction - skip('https://github.com/redis/redis/issues/11312') - end - - def test_the_state_of_cluster_resharding_with_transaction_and_watch - skip('https://github.com/redis/redis/issues/11312') - end - private def new_test_client @@ -284,22 +252,6 @@ def new_test_client class ScaleReadLatency < TestingWrapper include Mixin - def test_the_state_of_cluster_resharding - skip('https://github.com/redis/redis/issues/11312') - end - - def test_the_state_of_cluster_resharding_with_pipelining - skip('https://github.com/redis/redis/issues/11312') - end - - def test_the_state_of_cluster_resharding_with_transaction - skip('https://github.com/redis/redis/issues/11312') - end - - def test_the_state_of_cluster_resharding_with_transaction_and_watch - skip('https://github.com/redis/redis/issues/11312') - end - private def new_test_client From 7e3efce44220cf3efe622105398900ca99d3796c Mon Sep 17 00:00:00 2001 From: Taishi Kasuga Date: Sat, 21 Sep 2024 15:04:06 +0900 Subject: [PATCH 2/8] fix --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 981a99a0..8cf8878e 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -28,11 +28,11 @@ jobs: matrix: include: - {redis: '7.2', ruby: '3.3'} - - {redis: '8', ruby: '3.3', compose: compose.valkey.yaml} - {redis: '7.2', ruby: '3.3', compose: compose.ssl.yaml} - {redis: '7.2', ruby: '3.3', driver: 'hiredis'} - {redis: '7.2', ruby: '3.3', driver: 'hiredis', compose: compose.ssl.yaml} - {redis: '7.2', ruby: '3.3', replica: '2', compose: compose.replica.yaml} + - {redis: '8', ruby: '3.3', replica: '2', compose: compose.valkey.yaml} - {redis: '7.2', ruby: '3.2', compose: compose.auth.yaml} - {redis: '7.0', ruby: '3.1'} - {redis: '6.2', ruby: '3.0'} From 88c98e26276db82cbc59535f28b6f416deda3412 Mon Sep 17 00:00:00 2001 From: Taishi Kasuga Date: Sat, 21 Sep 2024 15:44:37 +0900 Subject: [PATCH 3/8] fix? --- .github/workflows/test.yaml | 8 ++++++-- Rakefile | 6 ++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 8cf8878e..a849fbe2 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -39,11 +39,15 @@ jobs: - {redis: '5.0', ruby: '2.7'} - {ruby: 'jruby'} - {ruby: 'truffleruby'} - - {task: test_cluster_state, redis: '8', replica: '2', compose: compose.valkey.yaml, startup: '9'} - {task: test_cluster_broken, redis: '7.2', restart: 'no', startup: '6'} - {task: test_cluster_broken, redis: '6.2', restart: 'no', startup: '6'} - {task: test_cluster_scale, redis: '7.2', compose: compose.scale.yaml, startup: '8'} - {task: test_cluster_scale, redis: '6.2', compose: compose.scale.yaml, startup: '8'} + - {task: test_cluster_state, redis: '8', pattern: 'PrimaryOnly', compose: compose.valkey.yaml, replica: '2', startup: '9'} + - {task: test_cluster_state, redis: '8', pattern: 'Pooled', compose: compose.valkey.yaml, replica: '2', startup: '9'} + - {task: test_cluster_state, redis: '8', pattern: 'ScaleReadRandom', compose: compose.valkey.yaml, replica: '2', startup: '9'} + - {task: test_cluster_state, redis: '8', pattern: 'ScaleReadRandomWithPrimary', compose: compose.valkey.yaml, replica: '2', startup: '9'} + - {task: test_cluster_state, redis: '8', pattern: 'ScaleReadLatency', compose: compose.valkey.yaml, replica: '2', startup: '9'} env: REDIS_VERSION: ${{ matrix.redis || '7.2' }} DOCKER_COMPOSE_FILE: ${{ matrix.compose || 'compose.yaml' }} @@ -68,7 +72,7 @@ jobs: - name: Print containers run: docker compose -f $DOCKER_COMPOSE_FILE ps - name: Run minitest - run: bundle exec rake ${{ matrix.task || 'test' }} + run: bundle exec rake ${{ matrix.task || 'test' }} ${{ matrix.pattern || '' }} - name: Stop containers run: docker compose -f $DOCKER_COMPOSE_FILE down || true nat-ted-env: diff --git a/Rakefile b/Rakefile index 57fcef04..357b084b 100644 --- a/Rakefile +++ b/Rakefile @@ -14,7 +14,7 @@ task default: :test Rake::TestTask.new(:test) do |t| t.libs << :lib t.libs << :test - t.options = '-v' + t.options = '-v -c' t.test_files = if ARGV.size > 1 ARGV[1..] else @@ -26,7 +26,9 @@ SLUGGISH_TEST_TYPES.each do |type| Rake::TestTask.new("test_cluster_#{type}".to_sym) do |t| t.libs << :lib t.libs << :test - t.options = '-v' + pattern = '' + pattern = "-n #{ARGV[1]}" if ARGV.size > 1 + t.options = "-v -c #{pattern}" t.test_files = ["test/test_against_cluster_#{type}.rb"] end end From 08f1e44d5afc2fe524e2eb27b1d74305d2ca37a4 Mon Sep 17 00:00:00 2001 From: Taishi Kasuga Date: Sat, 21 Sep 2024 15:46:28 +0900 Subject: [PATCH 4/8] fix? --- Rakefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 357b084b..9b164e08 100644 --- a/Rakefile +++ b/Rakefile @@ -14,7 +14,7 @@ task default: :test Rake::TestTask.new(:test) do |t| t.libs << :lib t.libs << :test - t.options = '-v -c' + t.options = '-v' t.test_files = if ARGV.size > 1 ARGV[1..] else @@ -28,7 +28,7 @@ SLUGGISH_TEST_TYPES.each do |type| t.libs << :test pattern = '' pattern = "-n #{ARGV[1]}" if ARGV.size > 1 - t.options = "-v -c #{pattern}" + t.options = "-v #{pattern}" t.test_files = ["test/test_against_cluster_#{type}.rb"] end end From a63b94c72eadeb4468ac71d48fb7aa53ca92a82d Mon Sep 17 00:00:00 2001 From: Taishi Kasuga Date: Sat, 21 Sep 2024 15:56:47 +0900 Subject: [PATCH 5/8] fix? --- .github/workflows/test.yaml | 4 ++-- Rakefile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a849fbe2..9adfe6cc 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -31,8 +31,8 @@ jobs: - {redis: '7.2', ruby: '3.3', compose: compose.ssl.yaml} - {redis: '7.2', ruby: '3.3', driver: 'hiredis'} - {redis: '7.2', ruby: '3.3', driver: 'hiredis', compose: compose.ssl.yaml} - - {redis: '7.2', ruby: '3.3', replica: '2', compose: compose.replica.yaml} - - {redis: '8', ruby: '3.3', replica: '2', compose: compose.valkey.yaml} + - {redis: '7.2', ruby: '3.3', compose: compose.replica.yaml, replica: '2'} + - {redis: '8', ruby: '3.3', compose: compose.valkey.yaml, replica: '2'} - {redis: '7.2', ruby: '3.2', compose: compose.auth.yaml} - {redis: '7.0', ruby: '3.1'} - {redis: '6.2', ruby: '3.0'} diff --git a/Rakefile b/Rakefile index 9b164e08..c46bb546 100644 --- a/Rakefile +++ b/Rakefile @@ -27,7 +27,7 @@ SLUGGISH_TEST_TYPES.each do |type| t.libs << :lib t.libs << :test pattern = '' - pattern = "-n #{ARGV[1]}" if ARGV.size > 1 + pattern = "-n /#{ARGV[1]}/" if ARGV.size > 1 t.options = "-v #{pattern}" t.test_files = ["test/test_against_cluster_#{type}.rb"] end From 99bc3b6b37212a6a4f64a6191415a35c675d64f1 Mon Sep 17 00:00:00 2001 From: Taishi Kasuga Date: Sat, 21 Sep 2024 16:12:41 +0900 Subject: [PATCH 6/8] fix --- .github/workflows/test.yaml | 3 +- Rakefile | 4 +- test/test_against_cluster_state.rb | 116 ++++++++++++++++------------- 3 files changed, 67 insertions(+), 56 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9adfe6cc..04a2d23b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -55,6 +55,7 @@ jobs: REDIS_REPLICA_SIZE: ${{ matrix.replica || '1' }} RESTART_POLICY: ${{ matrix.restart || 'always' }} REDIS_CLIENT_MAX_STARTUP_SAMPLE: ${{ matrix.startup || '3' }} + TEST_CLASS_PATTERN: ${{ matrix.pattern || '' }} steps: - name: Check out code uses: actions/checkout@v4 @@ -72,7 +73,7 @@ jobs: - name: Print containers run: docker compose -f $DOCKER_COMPOSE_FILE ps - name: Run minitest - run: bundle exec rake ${{ matrix.task || 'test' }} ${{ matrix.pattern || '' }} + run: bundle exec rake ${{ matrix.task || 'test' }} - name: Stop containers run: docker compose -f $DOCKER_COMPOSE_FILE down || true nat-ted-env: diff --git a/Rakefile b/Rakefile index c46bb546..57fcef04 100644 --- a/Rakefile +++ b/Rakefile @@ -26,9 +26,7 @@ SLUGGISH_TEST_TYPES.each do |type| Rake::TestTask.new("test_cluster_#{type}".to_sym) do |t| t.libs << :lib t.libs << :test - pattern = '' - pattern = "-n /#{ARGV[1]}/" if ARGV.size > 1 - t.options = "-v #{pattern}" + t.options = '-v' t.test_files = ["test/test_against_cluster_#{type}.rb"] end end diff --git a/test/test_against_cluster_state.rb b/test/test_against_cluster_state.rb index ac14a06b..f0769e7a 100644 --- a/test/test_against_cluster_state.rb +++ b/test/test_against_cluster_state.rb @@ -2,7 +2,7 @@ require 'testing_helper' -class TestAgainstClusterState < TestingWrapper +module TestAgainstClusterState SLOT_SIZE = 16_384 module Mixin @@ -189,79 +189,91 @@ def do_resharding_test(number_of_keys: 1000) end end - class PrimaryOnly < TestingWrapper - include Mixin + PATTERN = ENV.fetch('TEST_CLASS_PATTERN', '') - private + if PATTERN == 'PrimaryOnly' || PATTERN.empty? + class PrimaryOnly < TestingWrapper + include Mixin + + private - def new_test_client - ::RedisClient.cluster( - nodes: TEST_NODE_URIS, - fixed_hostname: TEST_FIXED_HOSTNAME, - **TEST_GENERIC_OPTIONS - ).new_client + def new_test_client + ::RedisClient.cluster( + nodes: TEST_NODE_URIS, + fixed_hostname: TEST_FIXED_HOSTNAME, + **TEST_GENERIC_OPTIONS + ).new_client + end end end - class Pooled < TestingWrapper - include Mixin + if PATTERN == 'Pooled' || PATTERN.empty? + class Pooled < TestingWrapper + include Mixin - private + private - def new_test_client - ::RedisClient.cluster( - nodes: TEST_NODE_URIS, - fixed_hostname: TEST_FIXED_HOSTNAME, - **TEST_GENERIC_OPTIONS - ).new_pool(timeout: TEST_TIMEOUT_SEC, size: 2) + def new_test_client + ::RedisClient.cluster( + nodes: TEST_NODE_URIS, + fixed_hostname: TEST_FIXED_HOSTNAME, + **TEST_GENERIC_OPTIONS + ).new_pool(timeout: TEST_TIMEOUT_SEC, size: 2) + end end end - class ScaleReadRandom < TestingWrapper - include Mixin + if PATTERN == 'ScaleReadRandom' || PATTERN.empty? + class ScaleReadRandom < TestingWrapper + include Mixin - private + private - def new_test_client - ::RedisClient.cluster( - nodes: TEST_NODE_URIS, - replica: true, - replica_affinity: :random, - fixed_hostname: TEST_FIXED_HOSTNAME, - **TEST_GENERIC_OPTIONS - ).new_client + def new_test_client + ::RedisClient.cluster( + nodes: TEST_NODE_URIS, + replica: true, + replica_affinity: :random, + fixed_hostname: TEST_FIXED_HOSTNAME, + **TEST_GENERIC_OPTIONS + ).new_client + end end end - class ScaleReadRandomWithPrimary < TestingWrapper - include Mixin + if PATTERN == 'ScaleReadRandomWithPrimary' || PATTERN.empty? + class ScaleReadRandomWithPrimary < TestingWrapper + include Mixin - private + private - def new_test_client - ::RedisClient.cluster( - nodes: TEST_NODE_URIS, - replica: true, - replica_affinity: :random_with_primary, - fixed_hostname: TEST_FIXED_HOSTNAME, - **TEST_GENERIC_OPTIONS - ).new_client + def new_test_client + ::RedisClient.cluster( + nodes: TEST_NODE_URIS, + replica: true, + replica_affinity: :random_with_primary, + fixed_hostname: TEST_FIXED_HOSTNAME, + **TEST_GENERIC_OPTIONS + ).new_client + end end end - class ScaleReadLatency < TestingWrapper - include Mixin + if PATTERN == 'ScaleReadLatency' || PATTERN.empty? + class ScaleReadLatency < TestingWrapper + include Mixin - private + private - def new_test_client - ::RedisClient.cluster( - nodes: TEST_NODE_URIS, - replica: true, - replica_affinity: :latency, - fixed_hostname: TEST_FIXED_HOSTNAME, - **TEST_GENERIC_OPTIONS - ).new_client + def new_test_client + ::RedisClient.cluster( + nodes: TEST_NODE_URIS, + replica: true, + replica_affinity: :latency, + fixed_hostname: TEST_FIXED_HOSTNAME, + **TEST_GENERIC_OPTIONS + ).new_client + end end end end From c6fd6819bd7e29557aa82ab43790a3b9f8d63a5b Mon Sep 17 00:00:00 2001 From: Taishi Kasuga Date: Sat, 21 Sep 2024 16:22:55 +0900 Subject: [PATCH 7/8] fix --- .github/workflows/test.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 04a2d23b..2ab89e4d 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -39,15 +39,15 @@ jobs: - {redis: '5.0', ruby: '2.7'} - {ruby: 'jruby'} - {ruby: 'truffleruby'} - - {task: test_cluster_broken, redis: '7.2', restart: 'no', startup: '6'} - - {task: test_cluster_broken, redis: '6.2', restart: 'no', startup: '6'} - - {task: test_cluster_scale, redis: '7.2', compose: compose.scale.yaml, startup: '8'} - - {task: test_cluster_scale, redis: '6.2', compose: compose.scale.yaml, startup: '8'} - {task: test_cluster_state, redis: '8', pattern: 'PrimaryOnly', compose: compose.valkey.yaml, replica: '2', startup: '9'} - {task: test_cluster_state, redis: '8', pattern: 'Pooled', compose: compose.valkey.yaml, replica: '2', startup: '9'} - {task: test_cluster_state, redis: '8', pattern: 'ScaleReadRandom', compose: compose.valkey.yaml, replica: '2', startup: '9'} - {task: test_cluster_state, redis: '8', pattern: 'ScaleReadRandomWithPrimary', compose: compose.valkey.yaml, replica: '2', startup: '9'} - {task: test_cluster_state, redis: '8', pattern: 'ScaleReadLatency', compose: compose.valkey.yaml, replica: '2', startup: '9'} + - {task: test_cluster_broken, redis: '7.2', restart: 'no', startup: '6'} + - {task: test_cluster_broken, redis: '6.2', restart: 'no', startup: '6'} + - {task: test_cluster_scale, redis: '7.2', compose: compose.scale.yaml, startup: '8'} + - {task: test_cluster_scale, redis: '6.2', compose: compose.scale.yaml, startup: '8'} env: REDIS_VERSION: ${{ matrix.redis || '7.2' }} DOCKER_COMPOSE_FILE: ${{ matrix.compose || 'compose.yaml' }} From d653562500e78f3abb0e6ec85d0fae2dd257c344 Mon Sep 17 00:00:00 2001 From: Taishi Kasuga Date: Sat, 21 Sep 2024 16:31:18 +0900 Subject: [PATCH 8/8] fix --- .github/workflows/test.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2ab89e4d..c34cca5b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -33,21 +33,21 @@ jobs: - {redis: '7.2', ruby: '3.3', driver: 'hiredis', compose: compose.ssl.yaml} - {redis: '7.2', ruby: '3.3', compose: compose.replica.yaml, replica: '2'} - {redis: '8', ruby: '3.3', compose: compose.valkey.yaml, replica: '2'} + - {task: test_cluster_broken, redis: '7.2', restart: 'no', startup: '6'} + - {task: test_cluster_broken, redis: '6.2', restart: 'no', startup: '6'} + - {task: test_cluster_scale, redis: '7.2', compose: compose.scale.yaml, startup: '8'} + - {task: test_cluster_scale, redis: '6.2', compose: compose.scale.yaml, startup: '8'} - {redis: '7.2', ruby: '3.2', compose: compose.auth.yaml} - {redis: '7.0', ruby: '3.1'} - {redis: '6.2', ruby: '3.0'} - {redis: '5.0', ruby: '2.7'} - - {ruby: 'jruby'} - - {ruby: 'truffleruby'} - {task: test_cluster_state, redis: '8', pattern: 'PrimaryOnly', compose: compose.valkey.yaml, replica: '2', startup: '9'} - {task: test_cluster_state, redis: '8', pattern: 'Pooled', compose: compose.valkey.yaml, replica: '2', startup: '9'} - {task: test_cluster_state, redis: '8', pattern: 'ScaleReadRandom', compose: compose.valkey.yaml, replica: '2', startup: '9'} - {task: test_cluster_state, redis: '8', pattern: 'ScaleReadRandomWithPrimary', compose: compose.valkey.yaml, replica: '2', startup: '9'} - {task: test_cluster_state, redis: '8', pattern: 'ScaleReadLatency', compose: compose.valkey.yaml, replica: '2', startup: '9'} - - {task: test_cluster_broken, redis: '7.2', restart: 'no', startup: '6'} - - {task: test_cluster_broken, redis: '6.2', restart: 'no', startup: '6'} - - {task: test_cluster_scale, redis: '7.2', compose: compose.scale.yaml, startup: '8'} - - {task: test_cluster_scale, redis: '6.2', compose: compose.scale.yaml, startup: '8'} + - {ruby: 'jruby'} + - {ruby: 'truffleruby'} env: REDIS_VERSION: ${{ matrix.redis || '7.2' }} DOCKER_COMPOSE_FILE: ${{ matrix.compose || 'compose.yaml' }}