require File.join File.dirname(__FILE__), '../test_common.rb'

class MemcachedPostTest < Test::Unit::TestCase
  def test_memcached_is_running
    assert TestCommon::Process.running?('memcached'), 'Memcached is not running!'
  end

  def test_memcached_on_internal
    ip = TestCommon::Settings.internal_address
    assert TestCommon::Network.connection?(ip, 11211), 'Cannot connect to memcached on the internal address!'
  end

  def test_memcached_no_public
    ip = TestCommon::Settings.public_address
    assert TestCommon::Network.no_connection?(ip, 11211), 'Memcached should not be accessible from the public network!'
  end
end

require File.join File.dirname(__FILE__), '../test_common.rb'

class MemcachedPostTest < Test::Unit::TestCase
  def test_memcached_is_running
    assert TestCommon::Process.running?('memcached'), 'Memcached is not running!'
  end

  def get_node
    metadata = TestCommon::Settings.network_metadata
    node_name = TestCommon::Settings.node_name
    return metadata['nodes'][node_name]
  end

  def test_memcached_listen
    ip = get_node['network_roles']['mgmt/memcache']
    assert TestCommon::Network.connection?(ip, 11211), 'Cannot connect to memcached on the internal address!'
  end
end

Change the way to reach internal and public addresses from test
Change the way to reach internal and public addresses from test

There is no internal address in TestCommon, so we need to introduce our
own one.

Change-Id: I104e4a758d97ca622b8ca643d0e2a8638815d5a4
Closes-Bug: #1523585
