Add support for Python 3
[yardstick.git] / tests / functional / test_cli_scenario.py
1 ##############################################################################
2 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
3 #
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9
10
11 from __future__ import absolute_import
12 import unittest
13
14 from tests.functional import utils
15
16
17 class ScenarioTestCase(unittest.TestCase):
18
19     def setUp(self):
20         super(ScenarioTestCase, self).setUp()
21         self.yardstick = utils.Yardstick()
22
23     def test_scenario_list(self):
24         res = self.yardstick("scenario list")
25
26         self.assertIn("Lmbench", res)
27         self.assertIn("Perf", res)
28         self.assertIn("Fio", res)
29         self.assertIn("Ping", res)
30         self.assertIn("Iperf3", res)
31         self.assertIn("Pktgen", res)
32
33     def test_scenario_show_Lmbench(self):
34         res = self.yardstick("scenario show Lmbench")
35         lmbench = "Execute lmbench memory read latency"
36         "or memory bandwidth benchmark in a host" in res
37         self.assertTrue(lmbench)
38
39     def test_scenario_show_Perf(self):
40         res = self.yardstick("scenario show Perf")
41         perf = "Execute perf benchmark in a host" in res
42         self.assertTrue(perf)
43
44     def test_scenario_show_Fio(self):
45         res = self.yardstick("scenario show Fio")
46         fio = "Execute fio benchmark in a host" in res
47         self.assertTrue(fio)
48
49     def test_scenario_show_Ping(self):
50         res = self.yardstick("scenario show Ping")
51         ping = "Execute ping between two hosts" in res
52         self.assertTrue(ping)
53
54     def test_scenario_show_Iperf3(self):
55         res = self.yardstick("scenario show Iperf3")
56         iperf3 = "Execute iperf3 between two hosts" in res
57         self.assertTrue(iperf3)
58
59     def test_scenario_show_Pktgen(self):
60         res = self.yardstick("scenario show Pktgen")
61         pktgen = "Execute pktgen between two hosts" in res
62         self.assertTrue(pktgen)