diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/opnfv/test_cases/opnfv_yardstick_tc027.yaml | 13 | ||||
-rw-r--r-- | tests/unit/benchmark/scenarios/networking/test_ping6.py | 37 |
2 files changed, 33 insertions, 17 deletions
diff --git a/tests/opnfv/test_cases/opnfv_yardstick_tc027.yaml b/tests/opnfv/test_cases/opnfv_yardstick_tc027.yaml index 9b5e86509..6710621fb 100644 --- a/tests/opnfv/test_cases/opnfv_yardstick_tc027.yaml +++ b/tests/opnfv/test_cases/opnfv_yardstick_tc027.yaml @@ -7,8 +7,15 @@ schema: "yardstick:task:0.1" scenarios: - type: Ping6 - host: node1.IPV6 - + options: + packetsize: 200 + host: host1,host2,host3,host4,host5 + nodes: + host1: node1.IPV6 + host2: node2.IPV6 + host3: node3.IPV6 + host4: node4.IPV6 + host5: node5.IPV6 runner: type: Iteration iterations: 1 @@ -22,6 +29,6 @@ scenarios: context: type: Node name: IPV6 - file: /root/yardstick/etc/yardstick/nodes/compass_sclab_physical/pod.yaml + file: /home/opnfv/repos/yardstick/etc/yardstick/nodes/compass_sclab_physical/pod.yaml diff --git a/tests/unit/benchmark/scenarios/networking/test_ping6.py b/tests/unit/benchmark/scenarios/networking/test_ping6.py index 662b85c30..b600e4103 100644 --- a/tests/unit/benchmark/scenarios/networking/test_ping6.py +++ b/tests/unit/benchmark/scenarios/networking/test_ping6.py @@ -21,18 +21,23 @@ class PingTestCase(unittest.TestCase): def setUp(self): self.ctx = { - 'host': { + 'nodes':{ + 'host1': { 'ip': '172.16.0.137', 'user': 'cirros', 'key_filename': "mykey.key", 'password': "root" - }, + }, + } } @mock.patch('yardstick.benchmark.scenarios.networking.ping6.ssh') - def test_pktgen_successful_setup(self, mock_ssh): - - p = ping6.Ping6({}, self.ctx) + def test_ping_successful_setup(self, mock_ssh): + args = { + 'options': {'host': 'host1','packetsize': 200}, + 'sla': {'max_rtt': 50} + } + p = ping6.Ping6(args, self.ctx) mock_ssh.SSH().execute.return_value = (0, '0', '') p.setup() @@ -40,12 +45,15 @@ class PingTestCase(unittest.TestCase): @mock.patch('yardstick.benchmark.scenarios.networking.ping6.ssh') def test_ping_successful_no_sla(self, mock_ssh): + args = { + 'options': {'host': 'host1','packetsize': 200}, + } result = {} - p = ping6.Ping6({}, self.ctx) + p = ping6.Ping6(args, self.ctx) p.client = mock_ssh.SSH() - mock_ssh.SSH().execute.return_value = (0, '100', '') + mock_ssh.SSH().execute.side_effect = [(0, 'host1', ''),(0, 100, '')] p.run(result) self.assertEqual(result, {'rtt': 100.0}) @@ -53,13 +61,14 @@ class PingTestCase(unittest.TestCase): def test_ping_successful_sla(self, mock_ssh): args = { + 'options': {'host': 'host1','packetsize': 200}, 'sla': {'max_rtt': 150} - } + } result = {} p = ping6.Ping6(args, self.ctx) p.client = mock_ssh.SSH() - mock_ssh.SSH().execute.return_value = (0, '100', '') + mock_ssh.SSH().execute.side_effect = [(0, 'host1', ''),(0, 100, '')] p.run(result) self.assertEqual(result, {'rtt': 100.0}) @@ -67,28 +76,28 @@ class PingTestCase(unittest.TestCase): def test_ping_unsuccessful_sla(self, mock_ssh): args = { - 'options': {'packetsize': 200}, + 'options': {'host': 'host1','packetsize': 200}, 'sla': {'max_rtt': 50} } result = {} p = ping6.Ping6(args, self.ctx) p.client = mock_ssh.SSH() - mock_ssh.SSH().execute.return_value = (0, '100', '') + mock_ssh.SSH().execute.side_effect = [(0, 'host1', ''),(0, 100, '')] self.assertRaises(AssertionError, p.run, result) @mock.patch('yardstick.benchmark.scenarios.networking.ping6.ssh') def test_ping_unsuccessful_script_error(self, mock_ssh): args = { - 'options': {'packetsize': 200}, - 'sla': {'max_rtt': 50} + 'options': {'host': 'host1','packetsize': 200}, + 'sla': {'max_rtt': 150} } result = {} p = ping6.Ping6(args, self.ctx) p.client = mock_ssh.SSH() - mock_ssh.SSH().execute.return_value = (1, '', 'FOOBAR') + mock_ssh.SSH().execute.side_effect = [(0, 'host1', ''),(1, '', 'FOOBAR')] self.assertRaises(RuntimeError, p.run, result) |