Sha256: d5641cddd047ad78186f0e6006a4ae149814adfd4744db3433d8693010b372ea

Contents?: true

Size: 1.29 KB

Versions: 6

Compression:

Stored size: 1.29 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 '_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 '_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 '_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

6 entries across 6 versions & 1 rubygems

Version Path
elasticsearch-api-0.4.11 test/unit/cluster/node_shutdown_test.rb
elasticsearch-api-0.4.10 test/unit/cluster/node_shutdown_test.rb
elasticsearch-api-0.4.9 test/unit/cluster/node_shutdown_test.rb
elasticsearch-api-0.4.8 test/unit/cluster/node_shutdown_test.rb
elasticsearch-api-0.4.7 test/unit/cluster/node_shutdown_test.rb
elasticsearch-api-0.4.6 test/unit/cluster/node_shutdown_test.rb