aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/benchmark
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/benchmark')
-rw-r--r--tests/unit/benchmark/contexts/test_heat.py7
-rw-r--r--tests/unit/benchmark/contexts/test_model.py25
-rw-r--r--tests/unit/benchmark/scenarios/networking/test_pktgen.py6
-rw-r--r--tests/unit/benchmark/scenarios/storage/test_storperf.py4
4 files changed, 35 insertions, 7 deletions
diff --git a/tests/unit/benchmark/contexts/test_heat.py b/tests/unit/benchmark/contexts/test_heat.py
index 8f4852ca8..b56d0c86d 100644
--- a/tests/unit/benchmark/contexts/test_heat.py
+++ b/tests/unit/benchmark/contexts/test_heat.py
@@ -21,6 +21,7 @@ import uuid
import mock
from yardstick.benchmark.contexts import heat
+from yardstick.benchmark.contexts import model
LOG = logging.getLogger(__name__)
@@ -102,12 +103,18 @@ class HeatContextTestCase(unittest.TestCase):
self.test_context.keypair_name = "foo-key"
self.test_context.secgroup_name = "foo-secgroup"
self.test_context.key_uuid = "2f2e4997-0a8e-4eb7-9fa4-f3f8fbbc393b"
+ netattrs = {'cidr': '10.0.0.0/24', 'provider': None, 'external_network': 'ext_net'}
+ self.mock_context.name = 'bar'
+ self.test_context.networks = [model.Network("fool-network", self.mock_context, netattrs)]
self.test_context._add_resources_to_template(mock_template)
mock_template.add_keypair.assert_called_with(
"foo-key",
"2f2e4997-0a8e-4eb7-9fa4-f3f8fbbc393b")
mock_template.add_security_group.assert_called_with("foo-secgroup")
+ mock_template.add_network.assert_called_with("bar-fool-network", 'physnet1', None)
+ mock_template.add_router.assert_called_with("bar-fool-network-router", netattrs["external_network"], "bar-fool-network-subnet")
+ mock_template.add_router_interface.assert_called_with("bar-fool-network-router-if0", "bar-fool-network-router", "bar-fool-network-subnet")
@mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
def test_deploy(self, mock_template):
diff --git a/tests/unit/benchmark/contexts/test_model.py b/tests/unit/benchmark/contexts/test_model.py
index 6ae4e6dac..4a10761f7 100644
--- a/tests/unit/benchmark/contexts/test_model.py
+++ b/tests/unit/benchmark/contexts/test_model.py
@@ -170,6 +170,9 @@ class ServerTestCase(unittest.TestCase):
self.mock_context.keypair_name = 'some-keys'
self.mock_context.secgroup_name = 'some-secgroup'
self.mock_context.user = "some-user"
+ netattrs = {'cidr': '10.0.0.0/24', 'provider': None, 'external_network': 'ext_net'}
+ self.mock_context.networks = [model.Network("some-network", self.mock_context, netattrs)]
+
def test_construct_defaults(self):
@@ -208,13 +211,16 @@ class ServerTestCase(unittest.TestCase):
@mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate')
def test__add_instance(self, mock_template):
- attrs = {'image': 'some-image', 'flavor': 'some-flavor'}
+ 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)
mock_network = mock.Mock()
mock_network.name = 'some-network'
mock_network.stack_name = 'some-network-stack'
mock_network.subnet_stack_name = 'some-network-stack-subnet'
+ mock_network.provider = 'sriov'
+ mock_network.external_network = 'ext_net'
+ mock_network.router = model.Router('some-router', 'some-network', self.mock_context, 'ext_net')
test_server._add_instance(mock_template, 'some-server',
[mock_network], 'hints')
@@ -223,7 +229,22 @@ class ServerTestCase(unittest.TestCase):
'some-server-some-network-port',
mock_network.stack_name,
mock_network.subnet_stack_name,
- sec_group_id=self.mock_context.secgroup_name)
+ sec_group_id=self.mock_context.secgroup_name,
+ provider=mock_network.provider)
+
+ mock_template.add_floating_ip.assert_called_with(
+ 'some-server-fip',
+ mock_network.external_network,
+ 'some-server-some-network-port',
+ 'bar-some-network-some-router-if0',
+ 'some-secgroup'
+ )
+
+ mock_template.add_floating_ip_association.assert_called_with(
+ 'some-server-fip-assoc',
+ 'some-server-fip',
+ 'some-server-some-network-port'
+ )
mock_template.add_server.assert_called_with(
'some-server', 'some-image', 'some-flavor',
diff --git a/tests/unit/benchmark/scenarios/networking/test_pktgen.py b/tests/unit/benchmark/scenarios/networking/test_pktgen.py
index f50fa108c..989c5b712 100644
--- a/tests/unit/benchmark/scenarios/networking/test_pktgen.py
+++ b/tests/unit/benchmark/scenarios/networking/test_pktgen.py
@@ -132,7 +132,7 @@ class PktgenTestCase(unittest.TestCase):
p._iptables_get_result = mock_iptables_result
sample_output = '{"packets_per_second": 9753, "errors": 0, \
- "packets_sent": 149776, "flows": 110}'
+ "packets_sent": 149776, "packetsize": 60, "flows": 110}'
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
p.run(result)
@@ -158,7 +158,7 @@ class PktgenTestCase(unittest.TestCase):
p._iptables_get_result = mock_iptables_result
sample_output = '{"packets_per_second": 9753, "errors": 0, \
- "packets_sent": 149776, "flows": 110}'
+ "packets_sent": 149776, "packetsize": 60, "flows": 110}'
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
p.run(result)
@@ -184,7 +184,7 @@ class PktgenTestCase(unittest.TestCase):
p._iptables_get_result = mock_iptables_result
sample_output = '{"packets_per_second": 9753, "errors": 0, \
- "packets_sent": 149776, "flows": 110}'
+ "packets_sent": 149776, "packetsize": 60, "flows": 110}'
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
self.assertRaises(AssertionError, p.run, result)
diff --git a/tests/unit/benchmark/scenarios/storage/test_storperf.py b/tests/unit/benchmark/scenarios/storage/test_storperf.py
index adc9d47c6..00054d531 100644
--- a/tests/unit/benchmark/scenarios/storage/test_storperf.py
+++ b/tests/unit/benchmark/scenarios/storage/test_storperf.py
@@ -55,7 +55,7 @@ def mocked_requests_job_get(*args, **kwargs):
self.status_code = status_code
return MockResponseJobGet(
- '{"status": "completed",\
+ '{"Status": "Completed",\
"_ssd_preconditioning.queue-depth.8.block-size.16384.duration": 6}',
200)
@@ -171,7 +171,7 @@ class StorPerfTestCase(unittest.TestCase):
s = storperf.StorPerf(args, self.ctx)
s.setup_done = True
- sample_output = '{"status": "completed",\
+ sample_output = '{"Status": "Completed",\
"_ssd_preconditioning.queue-depth.8.block-size.16384.duration": 6}'
expected_result = jsonutils.loads(sample_output)