Sha256: 85c1dc8f51e4ff4c7250e37df78ead313dc44e6bff440df79b246c2108f9c612

Contents?: true

Size: 1.24 KB

Versions: 14

Compression:

Stored size: 1.24 KB

Contents

require 'hybrid_platforms_conductor/test_only_remote_node'

module HybridPlatformsConductor

  module HpcPlugins

    module Test

      # Test that the private IP address is correct
      class Ip < TestOnlyRemoteNode

        # Check my_test_plugin.rb.sample documentation for signature details.
        def test_on_node
          {
            # TODO: Access the user correctly when the user notion will be moved out of the ssh connector
            "#{@deployer.instance_variable_get(:@actions_executor).connector(:ssh).ssh_user == 'root' ? '' : "#{@nodes_handler.sudo_on(@node)} "}hostname -I" => proc do |stdout|
              if stdout.first.nil?
                error 'No IP returned by "hostname -I"'
              else
                private_ips = @nodes_handler.get_private_ips_of @node
                if private_ips
                  host_ips = stdout.first.split.select { |ip| ip =~ /^172\.16\.\d+\.\d+$/ }.sort
                  ref_ips = private_ips.sort
                  assert_equal(
                    host_ips,
                    ref_ips,
                    "Expected IPs to be #{ref_ips}, but got #{host_ips} instead"
                  )
                end
              end
            end
          }
        end

      end

    end

  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
hybrid_platforms_conductor-33.5.0 lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb
hybrid_platforms_conductor-33.4.0 lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb
hybrid_platforms_conductor-33.3.0 lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb
hybrid_platforms_conductor-33.2.4 lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb
hybrid_platforms_conductor-33.2.3 lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb
hybrid_platforms_conductor-33.2.2 lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb
hybrid_platforms_conductor-33.2.1 lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb
hybrid_platforms_conductor-33.2.0 lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb
hybrid_platforms_conductor-33.1.1 lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb
hybrid_platforms_conductor-33.1.0 lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb
hybrid_platforms_conductor-33.0.4 lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb
hybrid_platforms_conductor-33.0.3 lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb
hybrid_platforms_conductor-33.0.2 lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb
hybrid_platforms_conductor-33.0.1 lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb