Sha256: 3297211d2afed38a0ff31dd6852e9b155918cabfdc069ba1df18c60e7d7c833e

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

module HybridPlatformsConductor

  module HpcPlugins

    module Test

      # Test that Public IPs are assigned correctly
      class PublicIps < HybridPlatformsConductor::Test

        # Check my_test_plugin.rb.sample documentation for signature details.
        def test
          # Get a map of public IPs per node
          @nodes_handler.prefetch_metadata_of @nodes_handler.known_nodes, :public_ips
          public_ips = @nodes_handler.
            known_nodes.
            to_h { |node| [node, @nodes_handler.get_public_ips_of(node) || []] }

          # Check there are no duplicates
          nodes_per_public_ip = {}
          public_ips.each do |node, node_public_ips|
            node_public_ips.each do |public_ip|
              nodes_per_public_ip[public_ip] = [] unless nodes_per_public_ip.key?(public_ip)
              nodes_per_public_ip[public_ip] << node
            end
          end
          nodes_per_public_ip.each do |public_ip, nodes|
            error "Public IP #{public_ip} is used by the following nodes: #{nodes.join(', ')}" if nodes.size > 1
          end
        end

      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hybrid_platforms_conductor-33.9.5 lib/hybrid_platforms_conductor/hpc_plugins/test/public_ips.rb
hybrid_platforms_conductor-33.9.4 lib/hybrid_platforms_conductor/hpc_plugins/test/public_ips.rb