aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/benchmark/contexts/test_model.py35
1 files changed, 28 insertions, 7 deletions
diff --git a/tests/unit/benchmark/contexts/test_model.py b/tests/unit/benchmark/contexts/test_model.py
index 3fb186b9b..1ce550306 100644
--- a/tests/unit/benchmark/contexts/test_model.py
+++ b/tests/unit/benchmark/contexts/test_model.py
@@ -161,6 +161,23 @@ class NetworkTestCase(unittest.TestCase):
self.assertEqual(model.Network.find_external_network(), 'ext_net')
+ def test_construct_gateway_ip_is_null(self):
+
+ attrs = {'gateway_ip': 'null'}
+ test_network = model.Network('foo', self.mock_context, attrs)
+ self.assertEqual(test_network.gateway_ip, 'null')
+
+ def test_construct_gateway_ip_is_none(self):
+
+ attrs = {'gateway_ip': None}
+ test_network = model.Network('foo', self.mock_context, attrs)
+ self.assertEqual(test_network.gateway_ip, 'null')
+
+ def test_construct_gateway_ip_is_absent(self):
+
+ attrs = {}
+ test_network = model.Network('foo', self.mock_context, attrs)
+ self.assertIsNone(test_network.gateway_ip)
class ServerTestCase(unittest.TestCase):
@@ -214,11 +231,12 @@ class ServerTestCase(unittest.TestCase):
attrs = {'image': 'some-image', 'flavor': 'some-flavor', 'floating_ip': '192.168.1.10', 'floating_ip_assoc': 'some-vm'}
test_server = model.Server('foo', self.mock_context, attrs)
- self.mock_context.flavors = ['flavor1', 'flavor2', 'some-flavor']
+ self.mock_context.flavors = ['flavor1', 'flavor2', 'some-flavor']
mock_network = mock.Mock()
mock_network.name = 'some-network'
mock_network.stack_name = 'some-network-stack'
+ mock_network.allowed_address_pairs = ["1", "2"]
mock_network.subnet_stack_name = 'some-network-stack-subnet'
mock_network.provider = 'sriov'
mock_network.external_network = 'ext_net'
@@ -232,7 +250,8 @@ class ServerTestCase(unittest.TestCase):
mock_network.stack_name,
mock_network.subnet_stack_name,
sec_group_id=self.mock_context.secgroup_name,
- provider=mock_network.provider)
+ provider=mock_network.provider,
+ allowed_address_pairs=mock_network.allowed_address_pairs)
mock_template.add_floating_ip.assert_called_with(
'some-server-fip',
@@ -290,11 +309,12 @@ class ServerTestCase(unittest.TestCase):
}
test_server = model.Server('ServerFlavor-2', self.mock_context, attrs)
- self.mock_context.flavors = ['flavor2']
+ self.mock_context.flavors = ['flavor2']
mock_network = mock.Mock()
- mock_network.configure_mock(name='some-network', stack_name= 'some-network-stack',
- subnet_stack_name = 'some-network-stack-subnet',
- provider = 'some-provider')
+ mock_network.allowed_address_pairs = ["1", "2"]
+ mock_network.configure_mock(name='some-network', stack_name='some-network-stack',
+ subnet_stack_name='some-network-stack-subnet',
+ provider='some-provider')
test_server._add_instance(mock_template, 'ServerFlavor-2',
[mock_network], 'hints')
@@ -304,7 +324,8 @@ class ServerTestCase(unittest.TestCase):
mock_network.stack_name,
mock_network.subnet_stack_name,
provider=mock_network.provider,
- sec_group_id=self.mock_context.secgroup_name)
+ sec_group_id=self.mock_context.secgroup_name,
+ allowed_address_pairs=mock_network.allowed_address_pairs)
mock_template.add_server.assert_called_with(
'ServerFlavor-2', 'some-image',