You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.3 KiB

#!/usr/bin/python2
#
# Copyright 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
import common
from autotest_lib.server.cros import dnsname_mangler
HOST = 'chromeos1-row1-rack1-host1'
ROUTER = 'chromeos1-row1-rack1-host1-router'
ATTENUATOR = 'chromeos1-row1-rack1-host1-attenuator'
HOST_FROM_OUTSIDE_LAB = HOST + '.cros'
ROUTER_FROM_OUTSIDE_LAB = ROUTER + '.cros'
ATTENUATOR_FROM_OUTSIDE_LAB = ATTENUATOR + '.cros'
class DnsnameMangerUnittest(unittest.TestCase):
"""Check that we're correctly mangling DNS names."""
def testRouterNamesCorrect(self):
"""Router names should look like <dut_dns_name>-router[.cros]"""
self.assertEquals(ROUTER, dnsname_mangler.get_router_addr(HOST))
self.assertEquals(
ROUTER_FROM_OUTSIDE_LAB,
dnsname_mangler.get_router_addr(HOST_FROM_OUTSIDE_LAB))
def testAttenuatorNamesCorrect(self):
"""Router names should look like <dut_dns_name>-attenuator[.cros]"""
self.assertEquals(ATTENUATOR, dnsname_mangler.get_attenuator_addr(HOST))
self.assertEquals(
ATTENUATOR_FROM_OUTSIDE_LAB,
dnsname_mangler.get_attenuator_addr(HOST_FROM_OUTSIDE_LAB))
if __name__ == '__main__':
unittest.main()