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

test: resume resharding test for scale reading #375

Merged
merged 8 commits into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,34 @@ jobs:
matrix:
include:
- {redis: '7.2', ruby: '3.3'}
- {redis: '7.2', 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: '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'}
- {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'}
- {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_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' }}
REDIS_CONNECTION_DRIVER: ${{ matrix.driver || 'ruby' }}
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
Expand Down
23 changes: 22 additions & 1 deletion compose.valkey.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: >
Expand All @@ -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
Expand All @@ -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
Expand Down
164 changes: 64 additions & 100 deletions test/test_against_cluster_state.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'testing_helper'

class TestAgainstClusterState < TestingWrapper
module TestAgainstClusterState
SLOT_SIZE = 16_384

module Mixin
Expand Down Expand Up @@ -189,127 +189,91 @@ def do_resharding_test(number_of_keys: 1000)
end
end

class PrimaryOnly < TestingWrapper
include Mixin
PATTERN = ENV.fetch('TEST_CLASS_PATTERN', '')

private

def new_test_client
::RedisClient.cluster(
nodes: TEST_NODE_URIS,
fixed_hostname: TEST_FIXED_HOSTNAME,
**TEST_GENERIC_OPTIONS
).new_client
end
end

class Pooled < TestingWrapper
include Mixin
if PATTERN == 'PrimaryOnly' || PATTERN.empty?
class PrimaryOnly < 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_client
end
end
end

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
if PATTERN == 'Pooled' || PATTERN.empty?
class Pooled < 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,
fixed_hostname: TEST_FIXED_HOSTNAME,
**TEST_GENERIC_OPTIONS
).new_pool(timeout: TEST_TIMEOUT_SEC, size: 2)
end
end
end

class ScaleReadRandomWithPrimary < TestingWrapper
include Mixin
if PATTERN == 'ScaleReadRandom' || PATTERN.empty?
class ScaleReadRandom < TestingWrapper
include Mixin

def test_the_state_of_cluster_resharding
skip('https://github.com/redis/redis/issues/11312')
end
private

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
::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,
fixed_hostname: TEST_FIXED_HOSTNAME,
**TEST_GENERIC_OPTIONS
).new_client
end
end
end

class ScaleReadLatency < TestingWrapper
include Mixin
if PATTERN == 'ScaleReadRandomWithPrimary' || PATTERN.empty?
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
private

def test_the_state_of_cluster_resharding_with_transaction
skip('https://github.com/redis/redis/issues/11312')
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

def test_the_state_of_cluster_resharding_with_transaction_and_watch
skip('https://github.com/redis/redis/issues/11312')
end
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