Sha256: 2b68092dc549829ed3b9b6ef905a055b5bd4d6894e2d744ded58b3867c084d70

Contents?: true

Size: 1.93 KB

Versions: 36

Compression:

Stored size: 1.93 KB

Contents

describe HybridPlatformsConductor::NodesHandler do

  context 'checking aggregations across several platforms' do

    it 'returns nodes' do
      with_test_platforms(
        'platform1' => { nodes: { 'node1' => {}, 'node2' => {} } },
        'platform2' => { nodes: { 'node3' => {}, 'node4' => {} } }
      ) do
        expect(test_nodes_handler.known_nodes.sort).to eq %w[node1 node2 node3 node4].sort
      end
    end

    it 'fails when several platforms define the same nodes' do
      with_test_platforms(
        'platform1' => { nodes: { 'node1' => {}, 'node2' => {} } },
        'platform2' => { nodes: { 'node1' => {}, 'node4' => {} } }
      ) do
        expect { test_nodes_handler.known_nodes }.to raise_error(RuntimeError, /Can\'t register node1/)
      end
    end

    it 'returns nodes lists' do
      with_test_platforms(
        'platform1' => { nodes_lists: { 'nodeslist1' => [] } },
        'platform2' => { nodes_lists: { 'nodeslist2' => [] } }
      ) do
        expect(test_nodes_handler.known_nodes_lists.sort).to eq %w[nodeslist1 nodeslist2].sort
      end
    end

    it 'fails when several platforms define the same nodes lists' do
      with_test_platforms(
        'platform1' => { nodes_lists: { 'nodeslist1' => [] } },
        'platform2' => { nodes_lists: { 'nodeslist1' => [] } }
      ) do
        expect { test_nodes_handler.known_nodes_lists }.to raise_error(RuntimeError, /Can\'t register nodes list nodeslist1/)
      end
    end

    it 'returns services' do
      with_test_platforms(
        'platform1' => { nodes: {
          'node1' => { services: ['service1'] },
          'node2' => { services: ['service2'] }
        } },
        'platform2' => { nodes: {
          'node3' => { services: ['service1', 'service4'] },
          'node4' => { services: ['service3'] }
        } }
      ) do
        expect(test_nodes_handler.known_services.sort).to eq %w[service1 service2 service3 service4].sort
      end
    end

  end

end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
hybrid_platforms_conductor-33.0.0 spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb
hybrid_platforms_conductor-32.18.0 spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb
hybrid_platforms_conductor-32.17.1 spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb
hybrid_platforms_conductor-32.17.0 spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb
hybrid_platforms_conductor-32.16.4 spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb
hybrid_platforms_conductor-32.16.3 spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb
hybrid_platforms_conductor-32.16.2 spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb
hybrid_platforms_conductor-32.16.1 spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb
hybrid_platforms_conductor-32.16.0 spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb
hybrid_platforms_conductor-32.15.0 spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb
hybrid_platforms_conductor-32.14.0 spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb
hybrid_platforms_conductor-32.13.4 spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb
hybrid_platforms_conductor-32.13.3 spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb
hybrid_platforms_conductor-32.13.2 spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb
hybrid_platforms_conductor-32.13.1 spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb
hybrid_platforms_conductor-32.13.0 spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb
hybrid_platforms_conductor-32.12.0 spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb
hybrid_platforms_conductor-32.11.2 spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb
hybrid_platforms_conductor-32.11.1 spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb
hybrid_platforms_conductor-32.11.0 spec/hybrid_platforms_conductor_test/api/nodes_handler/several_platforms_spec.rb