summaryrefslogtreecommitdiffstats
path: root/tests/unit
diff options
context:
space:
mode:
authorkubi <jean.gaoliang@huawei.com>2016-01-15 19:40:28 +0800
committerliang gao <jean.gaoliang@huawei.com>2016-01-15 13:49:59 +0000
commitb111866af4a311ef965443499bf46505f2c2a22a (patch)
tree1a2e7df61d75382374255bafa4ac611e46d359df /tests/unit
parent9598fee99c2b2cabd3d0546de8cdfb7a942a9500 (diff)
fix some bug in ipv6 to make it run in ci
JIRA:YARDSTICK-187 Change-Id: Ia15d17afdef145f7b230a8a4d25a61eed5cdfd76 Signed-off-by: kubi <jean.gaoliang@huawei.com>
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/benchmark/scenarios/networking/test_ping6.py37
1 files changed, 23 insertions, 14 deletions
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)