summaryrefslogtreecommitdiffstats
path: root/tests/unit/benchmark/scenarios/compute/test_ramspeed.py
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2017-03-01 17:28:46 -0800
committerRoss Brattain <ross.b.brattain@intel.com>2017-04-11 21:58:20 -0700
commit99abbb424007da2e01762f3c040a39c0157cbe1f (patch)
treebaab901a9e7444c9fd36aa4a19c1e51d03cb8e7f /tests/unit/benchmark/scenarios/compute/test_ramspeed.py
parent2240fcc201fa9665e42e92c29e201cb62490acfa (diff)
standardize ssh auth
we need to be following defautl paramiko rules, first use pkey, then key_filenames (autodetecting ~/.ssh/ keys), then password We have too much boilerplate redudant code everywhere, we need to standardize on a factory function that takes a node dict. Using Python3 ChainMap we can layer overrides and defaults. VNF descriptors have to default key_filename, password to Python None. The only way to do this is to omit key values if the variable is not defined, this way the dict will not have the value and it will default to Python None Add python2 chainmap backport Updated unittest mocking to use ssh.SSH.from_node Change-Id: I80b0cb606e593b33e317c9e5e8ed0b74da591514 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Diffstat (limited to 'tests/unit/benchmark/scenarios/compute/test_ramspeed.py')
-rw-r--r--tests/unit/benchmark/scenarios/compute/test_ramspeed.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/unit/benchmark/scenarios/compute/test_ramspeed.py b/tests/unit/benchmark/scenarios/compute/test_ramspeed.py
index 82cc93870..85d49641e 100644
--- a/tests/unit/benchmark/scenarios/compute/test_ramspeed.py
+++ b/tests/unit/benchmark/scenarios/compute/test_ramspeed.py
@@ -38,7 +38,7 @@ class RamspeedTestCase(unittest.TestCase):
def test_ramspeed_successful_setup(self, mock_ssh):
r = ramspeed.Ramspeed({}, self.ctx)
- mock_ssh.SSH().execute.return_value = (0, '', '')
+ mock_ssh.SSH.from_node().execute.return_value = (0, '', '')
r.setup()
self.assertIsNotNone(r.client)
@@ -75,7 +75,7 @@ class RamspeedTestCase(unittest.TestCase):
{"Test_type": "INTEGER & WRITING", "Block_size(kb)": 16384,\
"Bandwidth(MBps)": 14128.94}, {"Test_type": "INTEGER & WRITING",\
"Block_size(kb)": 32768, "Bandwidth(MBps)": 8340.85}]}'
- mock_ssh.SSH().execute.return_value = (0, sample_output, '')
+ mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '')
r.run(self.result)
expected_result = jsonutils.loads(sample_output)
self.assertEqual(self.result, expected_result)
@@ -111,7 +111,7 @@ class RamspeedTestCase(unittest.TestCase):
{"Test_type": "INTEGER & WRITING", "Block_size(kb)": 16384,\
"Bandwidth(MBps)": 14128.94}, {"Test_type": "INTEGER & WRITING",\
"Block_size(kb)": 32768, "Bandwidth(MBps)": 8340.85}]}'
- mock_ssh.SSH().execute.return_value = (0, sample_output, '')
+ mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '')
r.run(self.result)
expected_result = jsonutils.loads(sample_output)
self.assertEqual(self.result, expected_result)
@@ -146,7 +146,7 @@ class RamspeedTestCase(unittest.TestCase):
"Bandwidth(MBps)": 14159.86}, {"Test_type": "INTEGER & WRITING",\
"Block_size(kb)": 16384, "Bandwidth(MBps)": 14128.94}, {"Test_type":\
"INTEGER & WRITING", "Block_size(kb)": 32768, "Bandwidth(MBps)": 8340.85}]}'
- mock_ssh.SSH().execute.return_value = (0, sample_output, '')
+ mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '')
self.assertRaises(AssertionError, r.run, self.result)
def test_ramspeed_unsuccessful_script_error(self, mock_ssh):
@@ -158,7 +158,7 @@ class RamspeedTestCase(unittest.TestCase):
args = {"options": options}
r = ramspeed.Ramspeed(args, self.ctx)
- mock_ssh.SSH().execute.return_value = (1, '', 'FOOBAR')
+ mock_ssh.SSH.from_node().execute.return_value = (1, '', 'FOOBAR')
self.assertRaises(RuntimeError, r.run, self.result)
def test_ramspeed_mem_successful_run_no_sla(self, mock_ssh):
@@ -177,7 +177,7 @@ class RamspeedTestCase(unittest.TestCase):
"Bandwidth(MBps)": 10057.48}, {"Test_type": "INTEGER Triad:",\
"Bandwidth(MBps)": 10116.27}, {"Test_type": "INTEGER AVERAGE:",\
"Bandwidth(MBps)": 9401.58}]}'
- mock_ssh.SSH().execute.return_value = (0, sample_output, '')
+ mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '')
r.run(self.result)
expected_result = jsonutils.loads(sample_output)
self.assertEqual(self.result, expected_result)
@@ -198,7 +198,7 @@ class RamspeedTestCase(unittest.TestCase):
"Bandwidth(MBps)": 10057.48}, {"Test_type": "INTEGER Triad:",\
"Bandwidth(MBps)": 10116.27}, {"Test_type": "INTEGER AVERAGE:",\
"Bandwidth(MBps)": 9401.58}]}'
- mock_ssh.SSH().execute.return_value = (0, sample_output, '')
+ mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '')
r.run(self.result)
expected_result = jsonutils.loads(sample_output)
self.assertEqual(self.result, expected_result)
@@ -219,7 +219,7 @@ class RamspeedTestCase(unittest.TestCase):
"Bandwidth(MBps)": 4300.48}, {"Test_type": "INTEGER Triad:",\
"Bandwidth(MBps)": 1300.27}, {"Test_type": "INTEGER AVERAGE:",\
"Bandwidth(MBps)": 2401.58}]}'
- mock_ssh.SSH().execute.return_value = (0, sample_output, '')
+ mock_ssh.SSH.from_node().execute.return_value = (0, sample_output, '')
self.assertRaises(AssertionError, r.run, self.result)
def test_ramspeed_unsuccessful_unknown_type_run(self, mock_ssh):
@@ -231,7 +231,7 @@ class RamspeedTestCase(unittest.TestCase):
args = {'options': options}
r = ramspeed.Ramspeed(args, self.ctx)
- mock_ssh.SSH().execute.return_value = (1, '', 'No such type_id: 30 for \
+ mock_ssh.SSH.from_node().execute.return_value = (1, '', 'No such type_id: 30 for \
Ramspeed scenario')
self.assertRaises(RuntimeError, r.run, self.result)