Merge "Add missing unit-test for IbInterface ethtool opts"
This commit is contained in:
commit
e2e2d55f1b
|
@ -1191,6 +1191,21 @@ ETHTOOL_OPTS=\"speed 1000 duplex full\"
|
|||
"""
|
||||
self.assertEqual(em1_config, self.get_interface_config('em1'))
|
||||
|
||||
def test_ib_interface_ethtool_opts(self):
|
||||
ifc = objects.IbInterface('ib0', ethtool_opts='speed 1000 duplex full')
|
||||
self.provider.add_interface(ifc)
|
||||
ib_config = """# This file is autogenerated by os-net-config
|
||||
DEVICE=ib0
|
||||
ONBOOT=yes
|
||||
HOTPLUG=no
|
||||
NM_CONTROLLED=no
|
||||
PEERDNS=no
|
||||
TYPE=Infiniband
|
||||
ETHTOOL_OPTS=\"speed 1000 duplex full\"
|
||||
BOOTPROTO=none
|
||||
"""
|
||||
self.assertEqual(ib_config, self.get_interface_config('ib0'))
|
||||
|
||||
def test_interface_single_dns_server(self):
|
||||
interface1 = objects.Interface('em1', dns_servers=['1.2.3.4'])
|
||||
self.provider.add_interface(interface1)
|
||||
|
|
|
@ -1475,6 +1475,7 @@ class TestIbInterface(base.TestCase):
|
|||
data = '{"type": "ib_interface", "name": "ib0", "use_dhcp": true}'
|
||||
ib_interface = objects.object_from_json(json.loads(data))
|
||||
self.assertEqual("ib0", ib_interface.name)
|
||||
self.assertIsNone(ib_interface.ethtool_opts)
|
||||
self.assertTrue(ib_interface.use_dhcp)
|
||||
|
||||
def test_from_json_defroute(self):
|
||||
|
@ -1491,6 +1492,15 @@ class TestIbInterface(base.TestCase):
|
|||
self.assertTrue(ib_interface1.defroute)
|
||||
self.assertFalse(ib_interface2.defroute)
|
||||
|
||||
def test_from_json_ethtool_opts(self):
|
||||
data = """{
|
||||
"type": "ib_interface",
|
||||
"name": "ib0",
|
||||
"ethtool_opts": "speed 1000 duplex full"
|
||||
}"""
|
||||
ib_ifc = objects.object_from_json(json.loads(data))
|
||||
self.assertEqual("speed 1000 duplex full", ib_ifc.ethtool_opts)
|
||||
|
||||
def test_from_json_dhclient_args(self):
|
||||
data = """{
|
||||
"type": "ib_interface",
|
||||
|
|
Loading…
Reference in New Issue