Revision caad16e2 test/ganeti.utils_unittest.py

b/test/ganeti.utils_unittest.py
41 41
     RemoveFile, CheckDict, MatchNameComponent, FormatUnit, \
42 42
     ParseUnit, AddAuthorizedKey, RemoveAuthorizedKey, \
43 43
     ShellQuote, ShellQuoteArgs, TcpPing, ListVisibleFiles, \
44
     SetEtcHostsEntry, RemoveEtcHostsEntry, FirstFree
44
     SetEtcHostsEntry, RemoveEtcHostsEntry, FirstFree, OwnIpAddress
45 45
from ganeti.errors import LockError, UnitParseError, GenericError, \
46 46
     ProgrammerError
47 47

  
......
635 635
                 "failed to ping alive host on deaf port (no source addr)")
636 636

  
637 637

  
638
class TestOwnIpAddress(unittest.TestCase):
639
  """Testcase for OwnIpAddress"""
640

  
641
  def testOwnLoopback(self):
642
    """check having the loopback ip"""
643
    self.failUnless(OwnIpAddress(constants.LOCALHOST_IP_ADDRESS),
644
                    "Should own the loopback address")
645

  
646
  def testNowOwnAddress(self):
647
    """check that I don't own an address"""
648

  
649
    # network 192.0.2.0/24 is reserved for test/documentation as per
650
    # rfc 3330, so we *should* not have an address of this range... if
651
    # this fails, we should extend the test to multiple addresses
652
    DST_IP = "192.0.2.1"
653
    self.failIf(OwnIpAddress(DST_IP), "Should not own IP address %s" % DST_IP)
654

  
655

  
638 656
class TestListVisibleFiles(unittest.TestCase):
639 657
  """Test case for ListVisibleFiles"""
640 658

  

Also available in: Unified diff