summaryrefslogtreecommitdiffstats
path: root/tests/unit/benchmark/scenarios/compute/test_cyclictest.py
diff options
context:
space:
mode:
authorhoujingwen <houjingwen@huawei.com>2015-10-19 15:37:06 +0800
committerHou Jingwen <houjingwen@huawei.com>2015-10-22 00:55:25 +0000
commite4e8688e0633ef22b2ff0ea8ba739313d5299ecc (patch)
tree0fee27d4e504b36e9eb24530cf85a0d33fd0b463 /tests/unit/benchmark/scenarios/compute/test_cyclictest.py
parent9816c5aa786f7ec831c549b8ed4b5e8ef485da64 (diff)
Update sla check for scenarios
This patch modify the question that SLA check result is not complete. JIRA: YARDSTICK-172 Change-Id: I10438390baee92caf00dbfcdbdb833823ff8ce31 Signed-off-by: houjingwen <houjingwen@huawei.com>
Diffstat (limited to 'tests/unit/benchmark/scenarios/compute/test_cyclictest.py')
-rw-r--r--tests/unit/benchmark/scenarios/compute/test_cyclictest.py24
1 files changed, 18 insertions, 6 deletions
diff --git a/tests/unit/benchmark/scenarios/compute/test_cyclictest.py b/tests/unit/benchmark/scenarios/compute/test_cyclictest.py
index 3791b4a76..28dc4d6b3 100644
--- a/tests/unit/benchmark/scenarios/compute/test_cyclictest.py
+++ b/tests/unit/benchmark/scenarios/compute/test_cyclictest.py
@@ -51,12 +51,14 @@ class CyclictestTestCase(unittest.TestCase):
args = {
"options": options,
}
+ result = {}
+
c.server = mock_ssh.SSH()
sample_output = '{"min": 100, "avg": 500, "max": 1000}'
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
- result = c.run(args)
+ c.run(args, result)
expected_result = json.loads(sample_output)
self.assertEqual(result, expected_result)
@@ -80,12 +82,14 @@ class CyclictestTestCase(unittest.TestCase):
"options": options,
"sla": sla
}
+ result = {}
+
c.server = mock_ssh.SSH()
sample_output = '{"min": 100, "avg": 500, "max": 1000}'
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
- result = c.run(args)
+ c.run(args, result)
expected_result = json.loads(sample_output)
self.assertEqual(result, expected_result)
@@ -96,11 +100,13 @@ class CyclictestTestCase(unittest.TestCase):
"options": {},
"sla": {"max_min_latency": 10}
}
+ result = {}
+
c.server = mock_ssh.SSH()
sample_output = '{"min": 100, "avg": 500, "max": 1000}'
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
- self.assertRaises(AssertionError, c.run, args)
+ self.assertRaises(AssertionError, c.run, args, result)
def test_cyclictest_unsuccessful_sla_avg_latency(self, mock_ssh):
@@ -109,11 +115,13 @@ class CyclictestTestCase(unittest.TestCase):
"options": {},
"sla": {"max_avg_latency": 10}
}
+ result = {}
+
c.server = mock_ssh.SSH()
sample_output = '{"min": 100, "avg": 500, "max": 1000}'
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
- self.assertRaises(AssertionError, c.run, args)
+ self.assertRaises(AssertionError, c.run, args, result)
def test_cyclictest_unsuccessful_sla_max_latency(self, mock_ssh):
@@ -122,11 +130,13 @@ class CyclictestTestCase(unittest.TestCase):
"options": {},
"sla": {"max_max_latency": 10}
}
+ result = {}
+
c.server = mock_ssh.SSH()
sample_output = '{"min": 100, "avg": 500, "max": 1000}'
mock_ssh.SSH().execute.return_value = (0, sample_output, '')
- self.assertRaises(AssertionError, c.run, args)
+ self.assertRaises(AssertionError, c.run, args, result)
def test_cyclictest_unsuccessful_script_error(self, mock_ssh):
@@ -148,10 +158,12 @@ class CyclictestTestCase(unittest.TestCase):
"options": options,
"sla": sla
}
+ result = {}
+
c.server = mock_ssh.SSH()
mock_ssh.SSH().execute.return_value = (1, '', 'FOOBAR')
- self.assertRaises(RuntimeError, c.run, args)
+ self.assertRaises(RuntimeError, c.run, args, result)
def main():