Sha256: fc41c771c507bd9ffef67bd00f610c68a343776aa0b0449d8b67e40db79ce1fd

Contents?: true

Size: 910 Bytes

Versions: 2

Compression:

Stored size: 910 Bytes

Contents

# frozen_string_literal: true

require_relative 'helper'

# ruby -w -Itest test/cluster_commands_on_transactions_test.rb
# @see https://redis.io/commands#transactions
class TestClusterCommandsOnTransactions < Test::Unit::TestCase
  include Helper::Cluster

  def test_discard
    assert_raise(Redis::Cluster::AmbiguousNodeError) do
      redis.discard
    end
  end

  def test_exec
    assert_raise(Redis::Cluster::AmbiguousNodeError) do
      redis.exec
    end
  end

  def test_multi
    assert_raise(Redis::Cluster::AmbiguousNodeError) do
      redis.multi
    end
  end

  def test_unwatch
    assert_raise(Redis::Cluster::AmbiguousNodeError) do
      redis.unwatch
    end
  end

  def test_watch
    assert_raise(Redis::CommandError, "CROSSSLOT Keys in request don't hash to the same slot") do
      redis.watch('key1', 'key2')
    end

    assert_equal 'OK', redis.watch('{key}1', '{key}2')
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
redis-4.0.3 test/cluster_commands_on_transactions_test.rb
redis-4.1.0.beta1 test/cluster_commands_on_transactions_test.rb