Skip to content

Commit

Permalink
test: remove a redundant case (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
supercaracal authored Sep 30, 2024
1 parent 5ad1397 commit 2212a8f
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions test/test_against_cluster_state.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ def setup
@controller = ClusterController.new(
TEST_NODE_URIS,
replica_size: TEST_REPLICA_SIZE,
**TEST_GENERIC_OPTIONS.merge(timeout: 30.0)
**TEST_GENERIC_OPTIONS
)
@controller.rebuild
@captured_commands = ::Middlewares::CommandCapture::CommandBuffer.new
@redirect_count = ::Middlewares::RedirectCount::Counter.new
@client = new_test_client
@client.call('echo', 'init')
@client = new_test_client.tap { |c| c.call('echo', 'init') }
@captured_commands.clear
@redirect_count.clear
end
Expand All @@ -30,18 +29,11 @@ def teardown
"ClusterNodesCall: #{@captured_commands.count('cluster', 'nodes')} = "
end

def test_the_state_of_cluster_down
@controller.down
assert_raises(::RedisClient::CommandError) { @client.call('SET', 'key1', 1) }
assert_equal('fail', fetch_cluster_info('cluster_state'))
end

def test_the_state_of_cluster_failover
@controller.failover
1000.times { |i| assert_equal('OK', @client.call('SET', "key#{i}", i)) }
wait_for_replication
1000.times { |i| assert_equal(i.to_s, @client.call('GET', "key#{i}")) }
assert_equal('ok', fetch_cluster_info('cluster_state'))
refute(@redirect_count.zero?, @redirect_count.get)
end

Expand Down Expand Up @@ -242,10 +234,6 @@ def wait_for_replication
end
end

def fetch_cluster_info(key)
@client.call('CLUSTER', 'INFO').split("\r\n").to_h { |v| v.split(':') }.fetch(key)
end

def do_resharding_test(number_of_keys: 1000)
@client.pipelined { |pipeline| number_of_keys.times { |i| pipeline.call('SET', "key#{i}", "key#{i}") } }
wait_for_replication
Expand Down

0 comments on commit 2212a8f

Please sign in to comment.