Sha256: 9d06f24f617c87a2952f236b32db5c6fbe92930869458d26163c47a955f20e3e

Contents?: true

Size: 1.45 KB

Versions: 21

Compression:

Stored size: 1.45 KB

Contents

# encoding: UTF-8

require File.expand_path("helper", File.dirname(__FILE__))

class TestDistributedRemoteServerControlCommands < Test::Unit::TestCase

  include Helper::Distributed

  def test_info
    keys = [
     "redis_version",
     "uptime_in_seconds",
     "uptime_in_days",
     "connected_clients",
     "used_memory",
     "total_connections_received",
     "total_commands_processed",
    ]

    infos = r.info

    infos.each do |info|
      keys.each do |k|
        msg = "expected #info to include #{k}"
        assert info.keys.include?(k), msg
      end
    end
  end

  def test_info_commandstats
    target_version "2.5.7" do
      r.nodes.each { |n| n.config(:resetstat) }
      r.ping # Executed on every node

      r.info(:commandstats).each do |info|
        assert_equal "1", info["ping"]["calls"]
      end
    end
  end

  def test_monitor
    begin
      r.monitor
    rescue Exception => ex
    ensure
      assert ex.kind_of?(NotImplementedError)
    end
  end

  def test_echo
    assert_equal ["foo bar baz\n"], r.echo("foo bar baz\n")
  end

  def test_time
    target_version "2.5.4" do
      # Test that the difference between the time that Ruby reports and the time
      # that Redis reports is minimal (prevents the test from being racy).
      r.time.each do |rv|
        redis_usec = rv[0] * 1_000_000 + rv[1]
        ruby_usec = Integer(Time.now.to_f * 1_000_000)

        assert 500_000 > (ruby_usec - redis_usec).abs
      end
    end
  end
end

Version data entries

21 entries across 20 versions & 7 rubygems

Version Path
finsync_redis-3.3.5 test/distributed_remote_server_control_commands_test.rb
redis-3.3.5 test/distributed_remote_server_control_commands_test.rb
logstash-filter-cache-redis-0.3.1 vendor/bundle/jruby/1.9/gems/redis-3.3.3/test/distributed_remote_server_control_commands_test.rb
logstash-filter-cache-redis-0.3.0 vendor/bundle/jruby/1.9/gems/redis-3.3.3/test/distributed_remote_server_control_commands_test.rb
logstash-filter-cache-redis-0.2.0 vendor/bundle/jruby/1.9/gems/redis-3.3.3/test/distributed_remote_server_control_commands_test.rb
logstash-filter-cache-redis-0.1.0 vendor/bundle/jruby/1.9/gems/redis-3.3.3/test/distributed_remote_server_control_commands_test.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/redis-3.3.3/test/distributed_remote_server_control_commands_test.rb
redis-3.3.3 test/distributed_remote_server_control_commands_test.rb
abaci-0.3.0 vendor/bundle/gems/redis-3.3.2/test/distributed_remote_server_control_commands_test.rb
abaci-0.3.0 vendor/bundle/gems/redis-3.3.1/test/distributed_remote_server_control_commands_test.rb
redis-3.3.2 test/distributed_remote_server_control_commands_test.rb
redis-3.3.1 test/distributed_remote_server_control_commands_test.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/redis-3.3.0/test/distributed_remote_server_control_commands_test.rb
redis-3.3.0 test/distributed_remote_server_control_commands_test.rb
discourse-redis-3.2.2 test/distributed_remote_server_control_commands_test.rb
redis-3.2.2 test/distributed_remote_server_control_commands_test.rb
redis-3.2.1 test/distributed_remote_server_control_commands_test.rb
redis-3.2.0 test/distributed_remote_server_control_commands_test.rb
redis-3.1.0 test/distributed_remote_server_control_commands_test.rb
redis-3.0.7 test/distributed_remote_server_control_commands_test.rb