File: commands_on_connection_test.rb

package info (click to toggle)
ruby-redis 5.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,160 kB
  • sloc: ruby: 11,445; makefile: 117; sh: 24
file content (40 lines) | stat: -rw-r--r-- 900 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# frozen_string_literal: true

require "helper"
require 'lint/authentication'

# ruby -w -Itest test/cluster_commands_on_connection_test.rb
# @see https://redis.io/commands#connection
class TestClusterCommandsOnConnection < Minitest::Test
  include Helper::Cluster
  include Lint::Authentication

  def test_echo
    assert_equal 'hogehoge', redis.echo('hogehoge')
  end

  def test_ping
    assert_equal 'hogehoge', redis.ping('hogehoge')
  end

  def test_quit
    redis2 = build_another_client
    assert_equal 'OK', redis2.quit
  end

  def test_select
    assert_raises(Redis::CommandError, 'ERR SELECT is not allowed in cluster mode') do
      redis.select(1)
    end
  end

  def test_swapdb
    assert_raises(Redis::CommandError, 'ERR SWAPDB is not allowed in cluster mode') do
      redis.swapdb(1, 2)
    end
  end

  def mock(*args, &block)
    redis_cluster_mock(*args, &block)
  end
end