Sha256: 250d6df313d1eaaa01b97427faf4a2aeca1f3dcd8493405951c0c64a63e45ceb

Contents?: true

Size: 1.31 KB

Versions: 7

Compression:

Stored size: 1.31 KB

Contents

require 'test_helper'

module Elasticsearch
  module Test
    class ClusterNodeShutdownTest < ::Test::Unit::TestCase

      context "Cluster: Node shutdown" do
        subject { FakeClient.new }

        should "perform correct request" do
          subject.expects(:perform_request).with do |method, url, params, body|
            assert_equal 'POST', method
            assert_equal '_cluster/nodes/_shutdown', url
            assert_equal Hash.new, params
            assert_nil   body
            true
          end.returns(FakeResponse.new)

          subject.cluster.node_shutdown
        end

        should "send :node_id correctly" do
          subject.expects(:perform_request).with do |method, url, params, body|
            assert_equal '_cluster/nodes/foo/_shutdown', url
            true
          end.returns(FakeResponse.new)

          subject.cluster.node_shutdown :node_id => 'foo'
        end

        should "send multiple :node_id-s correctly" do
          subject.expects(:perform_request).with do |method, url, params, body|
            assert_equal '_cluster/nodes/A,B,C/_shutdown', url
            true
          end.returns(FakeResponse.new).twice

          subject.cluster.node_shutdown :node_id => 'A,B,C'
          subject.cluster.node_shutdown :node_id => ['A', 'B', 'C']
        end

      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
elasticsearch-api-0.4.5 test/unit/cluster/node_shutdown_test.rb
elasticsearch-api-0.4.4 test/unit/cluster/node_shutdown_test.rb
elasticsearch-api-0.4.3 test/unit/cluster/node_shutdown_test.rb
elasticsearch-api-0.4.2 test/unit/cluster/node_shutdown_test.rb
elasticsearch-api-0.4.1 test/unit/cluster/node_shutdown_test.rb
elasticsearch-api-0.4.0 test/unit/cluster/node_shutdown_test.rb
elasticsearch-api-0.0.2 test/unit/cluster/node_shutdown_test.rb